|
From: <fd...@us...> - 2008-08-15 00:37:42
|
Revision: 4440
http://jnode.svn.sourceforge.net/jnode/?rev=4440&view=rev
Author: fduminy
Date: 2008-08-15 00:37:38 +0000 (Fri, 15 Aug 2008)
Log Message:
-----------
reverted all changes from revision 4439
Revision Links:
--------------
http://jnode.svn.sourceforge.net/jnode/?rev=4439&view=rev
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java
trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
trunk/gui/src/test/org/jnode/test/gui/FBConsole.java
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java 2008-08-15 00:05:22 UTC (rev 4439)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/ScrollableTextScreenConsole.java 2008-08-15 00:37:38 UTC (rev 4440)
@@ -29,7 +29,6 @@
import org.jnode.driver.input.KeyboardEvent;
import org.jnode.driver.input.PointerEvent;
import org.jnode.driver.textscreen.ScrollableTextScreen;
-import org.jnode.driver.textscreen.x86.AbstractPcBufferTextScreen;
/**
* @author Ewout Prangsma (ep...@us...)
@@ -55,11 +54,8 @@
final ScrollableTextScreen screen = getScrollableTextScreen();
screen.scrollUp(rows);
- //FIXME : the need to explicitly do the following call will be removed a bit later
- if(screen instanceof AbstractPcBufferTextScreen) {
- final int length = rows * screen.getWidth();
- ((AbstractPcBufferTextScreen) screen).sync(screen.getHeight() * screen.getWidth() - length, length);
- }
+ final int length = rows * screen.getWidth();
+ screen.sync(screen.getHeight() * screen.getWidth() - length, length);
}
/**
@@ -70,11 +66,7 @@
public void scrollDown(int rows) {
final ScrollableTextScreen screen = getScrollableTextScreen();
screen.scrollDown(rows);
-
- //FIXME : the need to explicitly do the following call will be removed a bit later
- if(screen instanceof AbstractPcBufferTextScreen) {
- ((AbstractPcBufferTextScreen) screen).sync(0, rows * screen.getWidth());
- }
+ screen.sync(0, rows * screen.getWidth());
}
/**
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-08-15 00:05:22 UTC (rev 4439)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-08-15 00:37:38 UTC (rev 4440)
@@ -34,7 +34,6 @@
import org.jnode.driver.console.spi.ConsolePrintStream;
import org.jnode.driver.textscreen.ScrollableTextScreen;
import org.jnode.driver.textscreen.TextScreen;
-import org.jnode.driver.textscreen.x86.AbstractPcBufferTextScreen;
import org.jnode.system.event.FocusEvent;
import org.jnode.system.event.FocusListener;
import org.jnode.vm.VmSystem;
@@ -318,10 +317,7 @@
private void syncScreen(int offset, int size) {
if (isFocused()) {
- //FIXME : the need to explicitly do the following call will be removed a bit later
- if(screen instanceof AbstractPcBufferTextScreen) {
- ((AbstractPcBufferTextScreen) screen).sync(offset, size);
- }
+ screen.sync(offset, size);
}
}
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java 2008-08-15 00:05:22 UTC (rev 4439)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/TextScreen.java 2008-08-15 00:37:38 UTC (rev 4440)
@@ -118,6 +118,13 @@
public int getOffset(int x, int y);
/**
+ * Synchronize the state with the actual device.
+ * @param offset
+ * @param length
+ */
+ public void sync(int offset, int length);
+
+ /**
* Create an in-memory buffer text screen that is compatible
* with this screen.
*
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java 2008-08-15 00:05:22 UTC (rev 4439)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java 2008-08-15 00:37:38 UTC (rev 4440)
@@ -47,7 +47,7 @@
* Synchronize the state with the actual device.
*/
@Override
- public final void sync(int offset, int length) {
+ public void sync(int offset, int length) {
copyTo(parent, offset, length);
}
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java 2008-08-15 00:05:22 UTC (rev 4439)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java 2008-08-15 00:37:38 UTC (rev 4440)
@@ -172,7 +172,15 @@
throw new UnsupportedOperationException();
}
+ /**
+ * Synchronize the state with the actual device.
+ */
@Override
+ public void sync(int offset, int length) {
+ // Nothing to do here
+ }
+
+ @Override
public int setCursor(int x, int y) {
return 0; // TODO what should we return if we don't call instance.setCursor ?
}
Modified: trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java 2008-08-15 00:05:22 UTC (rev 4439)
+++ trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java 2008-08-15 00:37:38 UTC (rev 4440)
@@ -295,6 +295,7 @@
}
};
+ @Override
public void sync(int offset, int length) {
SwingUtilities.invokeLater(repaintCmd);
}
Modified: trunk/gui/src/test/org/jnode/test/gui/FBConsole.java
===================================================================
--- trunk/gui/src/test/org/jnode/test/gui/FBConsole.java 2008-08-15 00:05:22 UTC (rev 4439)
+++ trunk/gui/src/test/org/jnode/test/gui/FBConsole.java 2008-08-15 00:37:38 UTC (rev 4440)
@@ -145,6 +145,8 @@
}
+
+ @Override
public void sync(int offset, int length) {
screen.repaint();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-08-15 15:18:47
|
Revision: 4444
http://jnode.svn.sourceforge.net/jnode/?rev=4444&view=rev
Author: fduminy
Date: 2008-08-15 15:18:43 +0000 (Fri, 15 Aug 2008)
Log Message:
-----------
added @Override annotations + some final keywords
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java
trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FbTextScreen.java
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java 2008-08-15 14:23:37 UTC (rev 4443)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/x86/AbstractPcBufferTextScreen.java 2008-08-15 15:18:43 UTC (rev 4444)
@@ -59,27 +59,31 @@
/**
* @see org.jnode.driver.textscreen.TextScreen#copyContent(int, int, int)
*/
- public void copyContent(int srcOffset, int destOffset, int length) {
+ @Override
+ public final void copyContent(int srcOffset, int destOffset, int length) {
System.arraycopy(buffer, srcOffset, buffer, destOffset, length);
}
/**
* @see org.jnode.driver.textscreen.TextScreen#getChar(int)
*/
- public char getChar(int offset) {
+ @Override
+ public final char getChar(int offset) {
return (char) (buffer[offset] & 0xFF);
}
/**
* @see org.jnode.driver.textscreen.TextScreen#getColor(int)
*/
- public int getColor(int offset) {
+ @Override
+ public final int getColor(int offset) {
return (char) ((buffer[offset] >> 8) & 0xFF);
}
/**
* @see org.jnode.driver.textscreen.TextScreen#set(int, char, int, int)
*/
+ @Override
public void set(int offset, char ch, int count, int color) {
final char v = (char) ((ch & 0xFF) | ((color & 0xFF) << 8));
count = Math.min(count, buffer.length - offset);
@@ -92,7 +96,8 @@
* @see org.jnode.driver.textscreen.TextScreen#set(int, char[], int, int,
* int)
*/
- public void set(int offset, char[] ch, int chOfs, int length, int color) {
+ @Override
+ public void set(final int offset, final char[] ch, final int chOfs, int length, int color) {
color = (color & 0xFF) << 8;
length = Math.min(length, buffer.length - offset);
for (int i = 0; i < length; i++) {
@@ -175,7 +180,7 @@
public abstract void sync(int offset, int length);
@Override
- public int setCursor(int x, int y) {
+ public final int setCursor(int x, int y) {
this.cursorIndex = getOffset(x, y);
setParentCursor(x, y);
return cursorIndex;
@@ -183,7 +188,8 @@
protected abstract void setParentCursor(int x, int y);
- public int setCursorVisible(boolean visible) {
+ @Override
+ public final int setCursorVisible(boolean visible) {
this.cursorVisible = visible;
return cursorIndex;
}
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java 2008-08-15 14:23:37 UTC (rev 4443)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcBufferTextScreen.java 2008-08-15 15:18:43 UTC (rev 4444)
@@ -47,7 +47,7 @@
* Synchronize the state with the actual device.
*/
@Override
- public void sync(int offset, int length) {
+ public final void sync(int offset, int length) {
copyTo(parent, offset, length);
}
Modified: trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FbTextScreen.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FbTextScreen.java 2008-08-15 14:23:37 UTC (rev 4443)
+++ trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FbTextScreen.java 2008-08-15 15:18:43 UTC (rev 4444)
@@ -117,12 +117,6 @@
}
- public void sync(int offset, int length) {
- if (painter != null) {
- painter.repaint();
- }
- }
-
public int setCursor(int x, int y) {
cursorOffset = getOffset(x, y);
sync(cursorOffset, 1);
@@ -136,6 +130,13 @@
return cursorOffset;
}
+ @Override
+ public void sync(int offset, int length) {
+ if (painter != null) {
+ painter.repaint();
+ }
+ }
+
/**
* Copy the content of the given rawData into this screen.
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-08-17 11:37:58
|
Revision: 4456
http://jnode.svn.sourceforge.net/jnode/?rev=4456&view=rev
Author: fduminy
Date: 2008-08-17 11:37:55 +0000 (Sun, 17 Aug 2008)
Log Message:
-----------
instead of using System.out, PartitionHelper is now using a provided PrintStream (out)
Modified Paths:
--------------
trunk/distr/src/apps/org/jnode/apps/jpartition/commands/BaseDeviceCommand.java
trunk/distr/src/apps/org/jnode/apps/jpartition/commands/InitMbrCommand.java
trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java
trunk/fs/src/fs/org/jnode/partitions/command/PartitionHelper.java
Modified: trunk/distr/src/apps/org/jnode/apps/jpartition/commands/BaseDeviceCommand.java
===================================================================
--- trunk/distr/src/apps/org/jnode/apps/jpartition/commands/BaseDeviceCommand.java 2008-08-17 06:46:30 UTC (rev 4455)
+++ trunk/distr/src/apps/org/jnode/apps/jpartition/commands/BaseDeviceCommand.java 2008-08-17 11:37:55 UTC (rev 4456)
@@ -23,7 +23,8 @@
protected final PartitionHelper createPartitionHelper() throws CommandException {
try {
- return new PartitionHelper(device);
+ //FIXME replace System.out by output stream from (Console)ViewFactory
+ return new PartitionHelper(device, System.out);
} catch (DeviceNotFoundException e) {
throw new CommandException(e);
} catch (ApiNotFoundException e) {
Modified: trunk/distr/src/apps/org/jnode/apps/jpartition/commands/InitMbrCommand.java
===================================================================
--- trunk/distr/src/apps/org/jnode/apps/jpartition/commands/InitMbrCommand.java 2008-08-17 06:46:30 UTC (rev 4455)
+++ trunk/distr/src/apps/org/jnode/apps/jpartition/commands/InitMbrCommand.java 2008-08-17 11:37:55 UTC (rev 4456)
@@ -14,7 +14,8 @@
protected void doExecute() throws CommandException {
PartitionHelper helper;
try {
- helper = new PartitionHelper(device);
+ //FIXME replace System.out by output stream from (Console)ViewFactory
+ helper = new PartitionHelper(device, System.out);
helper.initMbr();
} catch (Throwable t) {
throw new CommandException(t);
Modified: trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java 2008-08-17 06:46:30 UTC (rev 4455)
+++ trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java 2008-08-17 11:37:55 UTC (rev 4456)
@@ -116,7 +116,7 @@
err.println(dev.getId() + " is not an IDE device");
exit(1);
}
- final PartitionHelper helper = new PartitionHelper(dev.getId());
+ final PartitionHelper helper = new PartitionHelper(dev.getId(), out);
if (FLAG_BOOTABLE.isSet()) {
helper.toggleBootable(getPartitionNumber(helper));
Modified: trunk/fs/src/fs/org/jnode/partitions/command/PartitionHelper.java
===================================================================
--- trunk/fs/src/fs/org/jnode/partitions/command/PartitionHelper.java 2008-08-17 06:46:30 UTC (rev 4455)
+++ trunk/fs/src/fs/org/jnode/partitions/command/PartitionHelper.java 2008-08-17 11:37:55 UTC (rev 4456)
@@ -1,6 +1,7 @@
package org.jnode.partitions.command;
import java.io.IOException;
+import java.io.PrintStream;
import javax.naming.NameNotFoundException;
@@ -30,30 +31,32 @@
private final MasterBootRecord MBR;
private BootSector bs;
+
+ private final PrintStream out;
- public PartitionHelper(String deviceId) throws DeviceNotFoundException, ApiNotFoundException,
+ public PartitionHelper(String deviceId, PrintStream out) throws DeviceNotFoundException, ApiNotFoundException,
IOException, NameNotFoundException {
- this((IDEDevice) DeviceUtils.getDeviceManager().getDevice(deviceId));
+ this((IDEDevice) DeviceUtils.getDeviceManager().getDevice(deviceId), out);
}
- public PartitionHelper(IDEDevice device) throws DeviceNotFoundException, ApiNotFoundException,
+ public PartitionHelper(IDEDevice device, PrintStream out) throws DeviceNotFoundException, ApiNotFoundException,
IOException {
this.current = device;
this.api = current.getAPI(BlockDeviceAPI.class);
this.MBR = new MasterBootRecord(api);
+ this.out = out;
reloadMBR();
}
public void initMbr() throws DeviceNotFoundException, ApiNotFoundException, IOException {
- System.out.println("Initialize MBR ...");
+ out.println("Initialize MBR ...");
BootSector oldMBR = bs;
bs = new GrubBootSector(PLAIN_MASTER_BOOT_SECTOR);
if (MBR.containsPartitionTable()) {
- System.out
- .println("This device already contains a partition table. Copy the already existing partitions.");
+ out.println("This device already contains a partition table. Copy the already existing partitions.");
for (int i = 0; i < 4; i++) {
final IBMPartitionTableEntry oldEntry = oldMBR.getPartition(i);
@@ -70,7 +73,7 @@
// reloadMBR();
}
- public void write() throws IOException {
+ public void write() throws IOException, Exception {
bs.write(api);
reloadMBR();
@@ -81,11 +84,11 @@
devMan.stop(current);
devMan.start(current);
} catch (DeviceNotFoundException e) {
- e.printStackTrace();
+ throw new Exception("error while restarting device", e);
} catch (DriverException e) {
- e.printStackTrace();
+ throw new Exception("error while restarting device", e);
} catch (NameNotFoundException e) {
- e.printStackTrace();
+ throw new Exception("error while restarting device", e);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-19 10:40:34
|
Revision: 4465
http://jnode.svn.sourceforge.net/jnode/?rev=4465&view=rev
Author: lsantha
Date: 2008-08-19 10:40:30 +0000 (Tue, 19 Aug 2008)
Log Message:
-----------
Code style fixes.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
trunk/shell/src/shell/org/jnode/shell/CommandThreadImpl.java
trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-08-19 07:45:28 UTC (rev 4464)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2008-08-19 10:40:30 UTC (rev 4465)
@@ -464,7 +464,7 @@
}
private final void ensureVisible(TextScreen scr, int row) {
- if(scr instanceof ScrollableTextScreen) {
+ if (scr instanceof ScrollableTextScreen) {
((ScrollableTextScreen) scr).ensureVisible(row, isFocused());
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/CommandThreadImpl.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandThreadImpl.java 2008-08-19 07:45:28 UTC (rev 4464)
+++ trunk/shell/src/shell/org/jnode/shell/CommandThreadImpl.java 2008-08-19 10:40:30 UTC (rev 4465)
@@ -98,7 +98,7 @@
public void waitFor() {
try {
join();
- } catch (InterruptedException ie){
+ } catch (InterruptedException ie) {
//ignore
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java 2008-08-19 07:45:28 UTC (rev 4464)
+++ trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java 2008-08-19 10:40:30 UTC (rev 4465)
@@ -163,8 +163,7 @@
@Override
public void describeArgument(org.jnode.shell.syntax.Argument<?> arg, PrintStream out) {
format(out, new Cell[]{new Cell(4, 16), new Cell(2, NOMINAL_WIDTH - 22)},
- new String[]{arg.getLabel(),
- "(" + arg.getTypeDescription() + ") " + arg.getDescription()});
+ new String[]{arg.getLabel(), "(" + arg.getTypeDescription() + ") " + arg.getDescription()});
}
protected void format(PrintStream out, Cell[] cells, String[] texts) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-19 20:07:45
|
Revision: 4469
http://jnode.svn.sourceforge.net/jnode/?rev=4469&view=rev
Author: lsantha
Date: 2008-08-19 20:07:41 +0000 (Tue, 19 Aug 2008)
Log Message:
-----------
Fixed ouput paths and module dependencies. This enables compiling the JNode sources with Idea.
Modified Paths:
--------------
trunk/JNode.ipr
trunk/builder/builder.iml
trunk/core/core.iml
trunk/distr/distr.iml
trunk/fs/fs.iml
trunk/gui/gui.iml
trunk/jnode.iml
trunk/net/net.iml
trunk/shell/shell.iml
trunk/sound/sound.iml
trunk/textui/textui.iml
Modified: trunk/JNode.ipr
===================================================================
--- trunk/JNode.ipr 2008-08-19 19:59:21 UTC (rev 4468)
+++ trunk/JNode.ipr 2008-08-19 20:07:41 UTC (rev 4469)
@@ -140,7 +140,7 @@
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="DEPRECATION" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
- <option name="MAXIMUM_HEAP_SIZE" value="128" />
+ <option name="MAXIMUM_HEAP_SIZE" value="1024" />
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" />
@@ -337,6 +337,7 @@
</entry>
</map>
</option>
+ <option name="myVersion" value="123" />
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="svn" />
Modified: trunk/builder/builder.iml
===================================================================
--- trunk/builder/builder.iml 2008-08-19 19:59:21 UTC (rev 4468)
+++ trunk/builder/builder.iml 2008-08-19 20:07:41 UTC (rev 4469)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/classes" />
+ <output url="file://$MODULE_DIR$/build/classes" />
<exclude-output />
<exclude-exploded />
<content url="file://$MODULE_DIR$">
@@ -29,15 +29,6 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/dom4j.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
<orderEntry type="library" name="core" level="project" />
<orderEntry type="module-library">
<library>
@@ -78,15 +69,6 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/lib/classycle.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
<root url="jar://$MODULE_DIR$/lib/pmd/xmlParserAPIs-2.6.2.jar!/" />
</CLASSES>
<JAVADOC />
@@ -96,7 +78,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/lib/itext-1.3.jar!/" />
+ <root url="jar://$MODULE_DIR$/../core/lib/asm-1.5.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -105,7 +87,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/../core/lib/asm-1.5.3.jar!/" />
+ <root url="jar://$MODULE_DIR$/../core/lib/asm-attrs-1.5.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -114,7 +96,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/../core/lib/asm-attrs-1.5.3.jar!/" />
+ <root url="jar://$MODULE_DIR$/../core/lib/asm-util-1.5.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -123,7 +105,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/../core/lib/asm-util-1.5.3.jar!/" />
+ <root url="jar://$MODULE_DIR$/lib/bcel-5.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -132,12 +114,13 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/lib/bcel-5.1.jar!/" />
+ <root url="jar://$MODULE_DIR$/lib/nanoxml-2.2.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="fs" />
<orderEntryProperties />
</component>
</module>
Modified: trunk/core/core.iml
===================================================================
--- trunk/core/core.iml 2008-08-19 19:59:21 UTC (rev 4468)
+++ trunk/core/core.iml 2008-08-19 20:07:41 UTC (rev 4469)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/classes" />
+ <output url="file://$MODULE_DIR$/build/classes" />
<exclude-output />
<exclude-exploded />
<content url="file://$MODULE_DIR$">
@@ -28,6 +28,24 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="core" level="project" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/mmtk/mmtk.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/mauve.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
</module>
Modified: trunk/distr/distr.iml
===================================================================
--- trunk/distr/distr.iml 2008-08-19 19:59:21 UTC (rev 4468)
+++ trunk/distr/distr.iml 2008-08-19 20:07:41 UTC (rev 4469)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/classes" />
+ <output url="file://$MODULE_DIR$/build/classes" />
<exclude-output />
<exclude-exploded />
<content url="file://$MODULE_DIR$">
@@ -37,6 +37,7 @@
</library>
</orderEntry>
<orderEntry type="module" module-name="gui" />
+ <orderEntry type="module" module-name="fs" />
<orderEntryProperties />
</component>
</module>
Modified: trunk/fs/fs.iml
===================================================================
--- trunk/fs/fs.iml 2008-08-19 19:59:21 UTC (rev 4468)
+++ trunk/fs/fs.iml 2008-08-19 20:07:41 UTC (rev 4469)
@@ -4,7 +4,7 @@
<connections />
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/classes" />
+ <output url="file://$MODULE_DIR$/build/classes" />
<exclude-output />
<exclude-exploded />
<content url="file://$MODULE_DIR$">
@@ -45,6 +45,24 @@
</library>
</orderEntry>
<orderEntry type="module" module-name="net" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../core/lib/junit.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../core/lib/jfunc.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
</module>
Modified: trunk/gui/gui.iml
===================================================================
--- trunk/gui/gui.iml 2008-08-19 19:59:21 UTC (rev 4468)
+++ trunk/gui/gui.iml 2008-08-19 20:07:41 UTC (rev 4469)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/classes" />
+ <output url="file://$MODULE_DIR$/build/classes" />
<exclude-output />
<exclude-exploded />
<content url="file://$MODULE_DIR$">
Modified: trunk/jnode.iml
===================================================================
--- trunk/jnode.iml 2008-08-19 19:59:21 UTC (rev 4468)
+++ trunk/jnode.iml 2008-08-19 20:07:41 UTC (rev 4469)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/classes" />
+ <output url="file://$MODULE_DIR$/build/classes" />
<exclude-output />
<exclude-exploded />
<content url="file://$MODULE_DIR$">
Modified: trunk/net/net.iml
===================================================================
--- trunk/net/net.iml 2008-08-19 19:59:21 UTC (rev 4468)
+++ trunk/net/net.iml 2008-08-19 20:07:41 UTC (rev 4469)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/classes" />
+ <output url="file://$MODULE_DIR$/build/classes" />
<exclude-output />
<exclude-exploded />
<content url="file://$MODULE_DIR$">
@@ -24,6 +24,15 @@
<jarDirectory url="file://$MODULE_DIR$/lib" recursive="false" />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../core/lib/commons-net-1.1.0.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
</module>
Modified: trunk/shell/shell.iml
===================================================================
--- trunk/shell/shell.iml 2008-08-19 19:59:21 UTC (rev 4468)
+++ trunk/shell/shell.iml 2008-08-19 20:07:41 UTC (rev 4469)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/classes" />
+ <output url="file://$MODULE_DIR$/build/classes" />
<exclude-output />
<exclude-exploded />
<content url="file://$MODULE_DIR$">
@@ -13,6 +13,15 @@
<orderEntry type="library" name="shell" level="project" />
<orderEntry type="library" name="core" level="project" />
<orderEntry type="module" module-name="core" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/bsh-2.0b5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
</module>
Modified: trunk/sound/sound.iml
===================================================================
--- trunk/sound/sound.iml 2008-08-19 19:59:21 UTC (rev 4468)
+++ trunk/sound/sound.iml 2008-08-19 20:07:41 UTC (rev 4469)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/build/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/driver" isTestSource="false" />
Modified: trunk/textui/textui.iml
===================================================================
--- trunk/textui/textui.iml 2008-08-19 19:59:21 UTC (rev 4468)
+++ trunk/textui/textui.iml 2008-08-19 20:07:41 UTC (rev 4469)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/classes" />
+ <output url="file://$MODULE_DIR$/build/classes" />
<exclude-output />
<exclude-exploded />
<content url="file://$MODULE_DIR$">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-08-20 22:04:01
|
Revision: 4473
http://jnode.svn.sourceforge.net/jnode/?rev=4473&view=rev
Author: fduminy
Date: 2008-08-20 22:03:55 +0000 (Wed, 20 Aug 2008)
Log Message:
-----------
removed export for packages that doesn't exist
Modified Paths:
--------------
trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java
trunk/core/descriptors/org.classpath.ext.corba.xml
trunk/core/descriptors/org.classpath.ext.core.xml
trunk/core/descriptors/org.classpath.tools.xml
trunk/core/descriptors/org.jnode.driver.xml
trunk/core/descriptors/org.jnode.runtime.core.xml
trunk/fs/descriptors/org.jnode.fs.iso9660.xml
trunk/fs/descriptors/org.jnode.fs.ntfs.xml
trunk/fs/descriptors/org.jnode.partitions.command.xml
trunk/gui/descriptors/org.jnode.awt.swingpeers.xml
trunk/shell/descriptors/org.jnode.shell.command.xml
trunk/shell/descriptors/org.jnode.shell.xml
Modified: trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2008-08-20 22:03:55 UTC (rev 4473)
@@ -1308,7 +1308,6 @@
addCompileHighOptLevel("org.jnode.security");
addCompileHighOptLevel("org.jnode.system");
addCompileHighOptLevel("org.jnode.system.event");
- addCompileHighOptLevel("org.jnode.system.util");
addCompileHighOptLevel("org.jnode.util");
addCompileHighOptLevel("org.jnode.vm");
addCompileHighOptLevel("org.jnode.vm.bytecode");
Modified: trunk/core/descriptors/org.classpath.ext.corba.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.corba.xml 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/core/descriptors/org.classpath.ext.corba.xml 2008-08-20 22:03:55 UTC (rev 4473)
@@ -44,20 +44,6 @@
<export name="org.omg.PortableServer.ServantLocatorPackage.*"/>
<export name="org.omg.SendingContext.*"/>
<export name="org.omg.stub.java.rmi.*"/>
-
- <export name="gnu.javax.rmi.CORBA.*"/>
-
- <export name="gnu.CORBA.*"/>
- <export name="gnu.CORBA.CDR.*"/>
- <export name="gnu.CORBA.DynAn.*"/>
- <export name="gnu.CORBA.GIOP.*"/>
- <export name="gnu.CORBA.GIOP.v1_0.*"/>
- <export name="gnu.CORBA.GIOP.v1_2.*"/>
- <export name="gnu.CORBA.Interceptor.*"/>
- <export name="gnu.CORBA.interfaces.*"/>
- <export name="gnu.CORBA.NamingService.*"/>
- <export name="gnu.CORBA.Poa.*"/>
- <export name="gnu.CORBA.typecodes.*"/>
</library>
</runtime>
Modified: trunk/core/descriptors/org.classpath.ext.core.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.core.xml 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/core/descriptors/org.classpath.ext.core.xml 2008-08-20 22:03:55 UTC (rev 4473)
@@ -36,11 +36,9 @@
<export name="gnu.java.net.protocol.file.*"/>
<export name="gnu.java.net.protocol.ftp.*"/>
<export name="gnu.java.net.protocol.http.*"/>
- <export name="gnu.java.net.protocol.http.event.*"/>
<export name="gnu.java.net.protocol.jar.*"/>
<export name="gnu.java.rmi.*"/>
<export name="gnu.java.rmi.dgc.*"/>
- <export name="gnu.java.rmi.registry.*"/>
<export name="gnu.java.rmi.server.*"/>
<export name="gnu.java.rmi.activation.*"/>
Modified: trunk/core/descriptors/org.classpath.tools.xml
===================================================================
--- trunk/core/descriptors/org.classpath.tools.xml 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/core/descriptors/org.classpath.tools.xml 2008-08-20 22:03:55 UTC (rev 4473)
@@ -19,22 +19,9 @@
<export name="gnu.classpath.tools.jarsigner.*"/>
<export name="gnu.classpath.tools.keytool.*"/>
<export name="gnu.classpath.tools.native2ascii.*"/>
- <export name="gnu.classpath.tools.orbd.*"/>
<export name="gnu.classpath.tools.rmid.*"/>
<export name="gnu.classpath.tools.rmiregistry.*"/>
<export name="gnu.classpath.tools.serialver.*"/>
- <export name="gnu.classpath.tools.tnameserv.*"/>
-
- <export name="org.objectweb.asm.*"/>
- <export name="org.objectweb.asm.attrs.*"/>
- <export name="org.objectweb.asm.commons.*"/>
- <export name="org.objectweb.asm.optimizer.*"/>
- <export name="org.objectweb.asm.signature.*"/>
- <export name="org.objectweb.asm.tree.*"/>
- <export name="org.objectweb.asm.tree.analysis.*"/>
- <export name="org.objectweb.asm.util.*"/>
- <export name="org.objectweb.asm.util.attrs.*"/>
- <export name="org.objectweb.asm.xml.*"/>
</library>
</runtime>
@@ -43,11 +30,9 @@
<alias name="jarsigner" class="gnu.classpath.tools.jarsigner.Main"/>
<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="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"/>
- <alias name="tnameserv" class="gnu.classpath.tools.tnameserv.Main"/>
</extension>
<extension point="org.jnode.security.permissions">
Modified: trunk/core/descriptors/org.jnode.driver.xml
===================================================================
--- trunk/core/descriptors/org.jnode.driver.xml 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/core/descriptors/org.jnode.driver.xml 2008-08-20 22:03:55 UTC (rev 4473)
@@ -15,7 +15,6 @@
<runtime>
<library name="jnode-core.jar">
<export name="org.jnode.driver.*"/>
- <export name="org.jnode.driver.util.*"/>
<export name="org.jnode.driver.virtual.*"/>
</library>
</runtime>
Modified: trunk/core/descriptors/org.jnode.runtime.core.xml
===================================================================
--- trunk/core/descriptors/org.jnode.runtime.core.xml 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/core/descriptors/org.jnode.runtime.core.xml 2008-08-20 22:03:55 UTC (rev 4473)
@@ -26,7 +26,6 @@
<export name="org.jnode.protocol.system.*"/>
<export name="org.jnode.system.*"/>
<export name="org.jnode.system.event.*"/>
- <export name="org.jnode.system.util.*"/>
</library>
</runtime>
Modified: trunk/fs/descriptors/org.jnode.fs.iso9660.xml
===================================================================
--- trunk/fs/descriptors/org.jnode.fs.iso9660.xml 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/fs/descriptors/org.jnode.fs.iso9660.xml 2008-08-20 22:03:55 UTC (rev 4473)
@@ -16,7 +16,6 @@
<runtime>
<library name="jnode-fs.jar">
<export name="org.jnode.fs.iso9660.*"/>
- <export name="org.jnode.fs.iso9660.attributes.*"/>
</library>
</runtime>
Modified: trunk/fs/descriptors/org.jnode.fs.ntfs.xml
===================================================================
--- trunk/fs/descriptors/org.jnode.fs.ntfs.xml 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/fs/descriptors/org.jnode.fs.ntfs.xml 2008-08-20 22:03:55 UTC (rev 4473)
@@ -16,7 +16,6 @@
<runtime>
<library name="jnode-fs.jar">
<export name="org.jnode.fs.ntfs.*"/>
- <export name="org.jnode.fs.ntfs.attributes.*"/>
</library>
</runtime>
Modified: trunk/fs/descriptors/org.jnode.partitions.command.xml
===================================================================
--- trunk/fs/descriptors/org.jnode.partitions.command.xml 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/fs/descriptors/org.jnode.partitions.command.xml 2008-08-20 22:03:55 UTC (rev 4473)
@@ -17,7 +17,6 @@
<runtime>
<library name="jnode-fs.jar">
<export name="org.jnode.partitions.command.*"/>
- <export name="org.jnode.partitions.help.argument.*"/>
</library>
</runtime>
Modified: trunk/gui/descriptors/org.jnode.awt.swingpeers.xml
===================================================================
--- trunk/gui/descriptors/org.jnode.awt.swingpeers.xml 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/gui/descriptors/org.jnode.awt.swingpeers.xml 2008-08-20 22:03:55 UTC (rev 4473)
@@ -15,7 +15,6 @@
<runtime>
<library name="jnode-gui.jar">
<export name="org.jnode.awt.swingpeers.*"/>
- <export name="org.jnode.awt.swingpeers.event.*"/>
</library>
</runtime>
Modified: trunk/shell/descriptors/org.jnode.shell.command.xml
===================================================================
--- trunk/shell/descriptors/org.jnode.shell.command.xml 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/shell/descriptors/org.jnode.shell.command.xml 2008-08-20 22:03:55 UTC (rev 4473)
@@ -14,9 +14,6 @@
<runtime>
<library name="jnode-shell.jar">
<export name="org.jnode.shell.command.*"/>
- <export name="org.jnode.shell.command.benchmark.*"/>
- <export name="org.jnode.shell.command.benchmark.jgfutil.*"/>
- <export name="org.jnode.shell.command.benchmark.section1.*"/>
</library>
</runtime>
Modified: trunk/shell/descriptors/org.jnode.shell.xml
===================================================================
--- trunk/shell/descriptors/org.jnode.shell.xml 2008-08-20 20:49:35 UTC (rev 4472)
+++ trunk/shell/descriptors/org.jnode.shell.xml 2008-08-20 22:03:55 UTC (rev 4473)
@@ -18,7 +18,6 @@
<export name="org.jnode.shell.*"/>
<export name="org.jnode.shell.alias.*"/>
<export name="org.jnode.shell.alias.def.*"/>
- <export name="org.jnode.shell.alias.util.*"/>
<export name="org.jnode.shell.def.*"/>
<export name="org.jnode.shell.help.*"/>
<export name="org.jnode.shell.help.argument.*"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-21 18:18:01
|
Revision: 4476
http://jnode.svn.sourceforge.net/jnode/?rev=4476&view=rev
Author: lsantha
Date: 2008-08-21 18:17:58 +0000 (Thu, 21 Aug 2008)
Log Message:
-----------
Created Netbeans project.
Added Paths:
-----------
trunk/netbeans/
trunk/netbeans/manifest.mf
trunk/netbeans/nbbuild.xml
trunk/netbeans/nbproject/
trunk/netbeans/nbproject/build-impl.xml
trunk/netbeans/nbproject/genfiles.properties
trunk/netbeans/nbproject/private/
trunk/netbeans/nbproject/private/config.properties
trunk/netbeans/nbproject/private/private.properties
trunk/netbeans/nbproject/private/private.xml
trunk/netbeans/nbproject/project.properties
trunk/netbeans/nbproject/project.xml
Added: trunk/netbeans/manifest.mf
===================================================================
--- trunk/netbeans/manifest.mf (rev 0)
+++ trunk/netbeans/manifest.mf 2008-08-21 18:17:58 UTC (rev 4476)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
Added: trunk/netbeans/nbbuild.xml
===================================================================
--- trunk/netbeans/nbbuild.xml (rev 0)
+++ trunk/netbeans/nbbuild.xml 2008-08-21 18:17:58 UTC (rev 4476)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<project name="JNode" default="default" basedir=".">
+ <description>Builds, tests, and runs the project JNode.</description>
+ <import file="nbproject/build-impl.xml"/>
+ <!--
+
+ There exist several targets which are by default empty and which can be
+ used for execution of your tasks. These targets are usually executed
+ before and after some main targets. They are:
+
+ -pre-init: called before initialization of project properties
+ -post-init: called after initialization of project properties
+ -pre-compile: called before javac compilation
+ -post-compile: called after javac compilation
+ -pre-compile-single: called before javac compilation of single file
+ -post-compile-single: called after javac compilation of single file
+ -pre-compile-test: called before javac compilation of JUnit tests
+ -post-compile-test: called after javac compilation of JUnit tests
+ -pre-compile-test-single: called before javac compilation of single JUnit test
+ -post-compile-test-single: called after javac compilation of single JUunit test
+ -pre-jar: called before JAR building
+ -post-jar: called after JAR building
+ -post-clean: called after cleaning build products
+
+ (Targets beginning with '-' are not intended to be called on their own.)
+
+ Example of inserting an obfuscator after compilation could look like this:
+
+ <target name="-post-compile">
+ <obfuscate>
+ <fileset dir="${build.classes.dir}"/>
+ </obfuscate>
+ </target>
+
+ For list of available properties check the imported
+ nbproject/build-impl.xml file.
+
+
+ Another way to customize the build is by overriding existing main targets.
+ The targets of interest are:
+
+ -init-macrodef-javac: defines macro for javac compilation
+ -init-macrodef-junit: defines macro for junit execution
+ -init-macrodef-debug: defines macro for class debugging
+ -init-macrodef-java: defines macro for class execution
+ -do-jar-with-manifest: JAR building (if you are using a manifest)
+ -do-jar-without-manifest: JAR building (if you are not using a manifest)
+ run: execution of project
+ -javadoc-build: Javadoc generation
+ test-report: JUnit report generation
+
+ An example of overriding the target for project execution could look like this:
+
+ <target name="run" depends="JNode-impl.jar">
+ <exec dir="bin" executable="launcher.exe">
+ <arg file="${dist.jar}"/>
+ </exec>
+ </target>
+
+ Notice that the overridden target depends on the jar target and not only on
+ the compile target as the regular run target does. Again, for a list of available
+ properties which you can use, check the target you are overriding in the
+ nbproject/build-impl.xml file.
+
+ -->
+</project>
Added: trunk/netbeans/nbproject/build-impl.xml
===================================================================
--- trunk/netbeans/nbproject/build-impl.xml (rev 0)
+++ trunk/netbeans/nbproject/build-impl.xml 2008-08-21 18:17:58 UTC (rev 4476)
@@ -0,0 +1,870 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT ***
+*** EDIT ../build.xml INSTEAD ***
+
+For the purpose of easier reading the script
+is divided into following sections:
+
+ - initialization
+ - compilation
+ - jar
+ - execution
+ - debugging
+ - javadoc
+ - junit compilation
+ - junit execution
+ - junit debugging
+ - applet
+ - cleanup
+
+ -->
+<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="JNode-impl">
+ <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
+ <!--
+ ======================
+ INITIALIZATION SECTION
+ ======================
+ -->
+ <target name="-pre-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="-pre-init" name="-init-private">
+ <property file="nbproject/private/config.properties"/>
+ <property file="nbproject/private/configs/${config}.properties"/>
+ <property file="nbproject/private/private.properties"/>
+ </target>
+ <target depends="-pre-init,-init-private" name="-init-user">
+ <property file="${user.properties.file}"/>
+ <!-- The two properties below are usually overridden -->
+ <!-- by the active platform. Just a fallback. -->
+ <property name="default.javac.source" value="1.4"/>
+ <property name="default.javac.target" value="1.4"/>
+ </target>
+ <target depends="-pre-init,-init-private,-init-user" name="-init-project">
+ <property file="nbproject/configs/${config}.properties"/>
+ <property file="nbproject/project.properties"/>
+ </target>
+ <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
+ <available file="${manifest.file}" property="manifest.available"/>
+ <condition property="manifest.available+main.class">
+ <and>
+ <isset property="manifest.available"/>
+ <isset property="main.class"/>
+ <not>
+ <equals arg1="${main.class}" arg2="" trim="true"/>
+ </not>
+ </and>
+ </condition>
+ <condition property="manifest.available+main.class+mkdist.available">
+ <and>
+ <istrue value="${manifest.available+main.class}"/>
+ <isset property="libs.CopyLibs.classpath"/>
+ </and>
+ </condition>
+ <condition property="have.tests">
+ <or/>
+ </condition>
+ <condition property="have.sources">
+ <or>
+ <available file="${src.core.dir}"/>
+ <available file="${src.apps.dir}"/>
+ <available file="${src.emu.dir}"/>
+ <available file="${src.install.dir}"/>
+ <available file="${src.test.dir}"/>
+ <available file="${src.driver.dir}"/>
+ <available file="${src.fs.dir}"/>
+ <available file="${src.test2.dir}"/>
+ <available file="${src.awt.dir}"/>
+ <available file="${src.desktop.dir}"/>
+ <available file="${src.driver2.dir}"/>
+ <available file="${src.font.dir}"/>
+ <available file="${src.test3.dir}"/>
+ <available file="${src.thinlet.dir}"/>
+ <available file="${src.driver3.dir}"/>
+ <available file="${src.net.dir}"/>
+ <available file="${src.test4.dir}"/>
+ <available file="${src.shell.dir}"/>
+ <available file="${src.test5.dir}"/>
+ <available file="${src.driver4.dir}"/>
+ <available file="${src.sound.dir}"/>
+ <available file="${src.test6.dir}"/>
+ <available file="${src.textui.dir}"/>
+ <available file="${src.driver5.dir}"/>
+ <available file="${src.nanoxml.dir}"/>
+ <available file="${src.icedtea.dir}"/>
+ <available file="${src.mmtk-vm.dir}"/>
+ <available file="${src.com.dir}"/>
+ <available file="${src.java.dir}"/>
+ <available file="${src.javax.dir}"/>
+ <available file="${src.org.dir}"/>
+ <available file="${src.sun.dir}"/>
+ <available file="${src.vm.dir}"/>
+ <available file="${src.test7.dir}"/>
+ <available file="${src.vmmagic.dir}"/>
+ <available file="${src.dir}"/>
+ <available file="${configure.dir}"/>
+ <available file="${ext.dir}"/>
+ <available file="${gnu.dir}"/>
+ <available file="${java.dir}"/>
+ <available file="${javax.dir}"/>
+ <available file="${tools.dir}"/>
+ <available file="${vm.dir}"/>
+ </or>
+ </condition>
+ <condition property="netbeans.home+have.tests">
+ <and>
+ <isset property="netbeans.home"/>
+ <isset property="have.tests"/>
+ </and>
+ </condition>
+ <condition property="no.javadoc.preview">
+ <and>
+ <isset property="javadoc.preview"/>
+ <isfalse value="${javadoc.preview}"/>
+ </and>
+ </condition>
+ <property name="run.jvmargs" value=""/>
+ <property name="javac.compilerargs" value=""/>
+ <property name="work.dir" value="${basedir}"/>
+ <condition property="no.deps">
+ <and>
+ <istrue value="${no.dependencies}"/>
+ </and>
+ </condition>
+ <property name="javac.debug" value="true"/>
+ <property name="javadoc.preview" value="true"/>
+ <property name="application.args" value=""/>
+ <property name="source.encoding" value="${file.encoding}"/>
+ <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
+ <and>
+ <isset property="javadoc.encoding"/>
+ <not>
+ <equals arg1="${javadoc.encoding}" arg2=""/>
+ </not>
+ </and>
+ </condition>
+ <property name="javadoc.encoding.used" value="${source.encoding}"/>
+ <property name="includes" value="**"/>
+ <property name="excludes" value=""/>
+ <property name="do.depend" value="false"/>
+ <condition property="do.depend.true">
+ <istrue value="${do.depend}"/>
+ </condition>
+ <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
+ <and>
+ <isset property="jaxws.endorsed.dir"/>
+ <available file="nbproject/jaxws-build.xml"/>
+ </and>
+ </condition>
+ </target>
+ <target name="-post-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
+ <fail unless="src.core.dir">Must set src.core.dir</fail>
+ <fail unless="src.apps.dir">Must set src.apps.dir</fail>
+ <fail unless="src.emu.dir">Must set src.emu.dir</fail>
+ <fail unless="src.install.dir">Must set src.install.dir</fail>
+ <fail unless="src.test.dir">Must set src.test.dir</fail>
+ <fail unless="src.driver.dir">Must set src.driver.dir</fail>
+ <fail unless="src.fs.dir">Must set src.fs.dir</fail>
+ <fail unless="src.test2.dir">Must set src.test2.dir</fail>
+ <fail unless="src.awt.dir">Must set src.awt.dir</fail>
+ <fail unless="src.desktop.dir">Must set src.desktop.dir</fail>
+ <fail unless="src.driver2.dir">Must set src.driver2.dir</fail>
+ <fail unless="src.font.dir">Must set src.font.dir</fail>
+ <fail unless="src.test3.dir">Must set src.test3.dir</fail>
+ <fail unless="src.thinlet.dir">Must set src.thinlet.dir</fail>
+ <fail unless="src.driver3.dir">Must set src.driver3.dir</fail>
+ <fail unless="src.net.dir">Must set src.net.dir</fail>
+ <fail unless="src.test4.dir">Must set src.test4.dir</fail>
+ <fail unless="src.shell.dir">Must set src.shell.dir</fail>
+ <fail unless="src.test5.dir">Must set src.test5.dir</fail>
+ <fail unless="src.driver4.dir">Must set src.driver4.dir</fail>
+ <fail unless="src.sound.dir">Must set src.sound.dir</fail>
+ <fail unless="src.test6.dir">Must set src.test6.dir</fail>
+ <fail unless="src.textui.dir">Must set src.textui.dir</fail>
+ <fail unless="src.driver5.dir">Must set src.driver5.dir</fail>
+ <fail unless="src.nanoxml.dir">Must set src.nanoxml.dir</fail>
+ <fail unless="src.icedtea.dir">Must set src.icedtea.dir</fail>
+ <fail unless="src.mmtk-vm.dir">Must set src.mmtk-vm.dir</fail>
+ <fail unless="src.com.dir">Must set src.com.dir</fail>
+ <fail unless="src.java.dir">Must set src.java.dir</fail>
+ <fail unless="src.javax.dir">Must set src.javax.dir</fail>
+ <fail unless="src.org.dir">Must set src.org.dir</fail>
+ <fail unless="src.sun.dir">Must set src.sun.dir</fail>
+ <fail unless="src.vm.dir">Must set src.vm.dir</fail>
+ <fail unless="src.test7.dir">Must set src.test7.dir</fail>
+ <fail unless="src.vmmagic.dir">Must set src.vmmagic.dir</fail>
+ <fail unless="src.dir">Must set src.dir</fail>
+ <fail unless="configure.dir">Must set configure.dir</fail>
+ <fail unless="ext.dir">Must set ext.dir</fail>
+ <fail unless="gnu.dir">Must set gnu.dir</fail>
+ <fail unless="java.dir">Must set java.dir</fail>
+ <fail unless="javax.dir">Must set javax.dir</fail>
+ <fail unless="tools.dir">Must set tools.dir</fail>
+ <fail unless="vm.dir">Must set vm.dir</fail>
+ <fail unless="build.dir">Must set build.dir</fail>
+ <fail unless="dist.dir">Must set dist.dir</fail>
+ <fail unless="build.classes.dir">Must set build.classes.dir</fail>
+ <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
+ <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
+ <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
+ <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
+ <fail unless="dist.jar">Must set dist.jar</fail>
+ </target>
+ <target name="-init-macrodef-property">
+ <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute name="name"/>
+ <attribute name="value"/>
+ <sequential>
+ <property name="@{name}" value="${@{value}}"/>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-javac">
+ <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${src.core.dir}:${src.apps.dir}:${src.emu.dir}:${src.install.dir}:${src.test.dir}:${src.driver.dir}:${src.fs.dir}:${src.test2.dir}:${src.awt.dir}:${src.desktop.dir}:${src.driver2.dir}:${src.font.dir}:${src.test3.dir}:${src.thinlet.dir}:${src.driver3.dir}:${src.net.dir}:${src.test4.dir}:${src.shell.dir}:${src.test5.dir}:${src.driver4.dir}:${src.sound.dir}:${src.test6.dir}:${src.textui.dir}:${src.driver5.dir}:${src.nanoxml.dir}:${src.icedtea.dir}:${src.mmtk-vm.dir}:${src.com.dir}:${src.java.dir}:${src.javax.dir}:${src.org.dir}:${src.sun.dir}:${src.vm.dir}:${src.test7.dir}:${src.vmmagic.dir}:${src.dir}:${configure.dir}:${ext.dir}:${gnu.dir}:${java.dir}:${javax.dir}:${tools.dir}:${vm.dir}" name="srcdir"/>
+ <attribute default="${build.classes.dir}" name="destdir"/>
+ <attribute default="${javac.classpath}" name="classpath"/>
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="${javac.debug}" name="debug"/>
+ <attribute default="" name="sourcepath"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
+ <customize/>
+ </javac>
+ </sequential>
+ </macrodef>
+ <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${src.core.dir}:${src.apps.dir}:${src.emu.dir}:${src.install.dir}:${src.test.dir}:${src.driver.dir}:${src.fs.dir}:${src.test2.dir}:${src.awt.dir}:${src.desktop.dir}:${src.driver2.dir}:${src.font.dir}:${src.test3.dir}:${src.thinlet.dir}:${src.driver3.dir}:${src.net.dir}:${src.test4.dir}:${src.shell.dir}:${src.test5.dir}:${src.driver4.dir}:${src.sound.dir}:${src.test6.dir}:${src.textui.dir}:${src.driver5.dir}:${src.nanoxml.dir}:${src.icedtea.dir}:${src.mmtk-vm.dir}:${src.com.dir}:${src.java.dir}:${src.javax.dir}:${src.org.dir}:${src.sun.dir}:${src.vm.dir}:${src.test7.dir}:${src.vmmagic.dir}:${src.dir}:${configure.dir}:${ext.dir}:${gnu.dir}:${java.dir}:${javax.dir}:${tools.dir}:${vm.dir}" name="srcdir"/>
+ <attribute default="${build.classes.dir}" name="destdir"/>
+ <attribute default="${javac.classpath}" name="classpath"/>
+ <sequential>
+ <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ </depend>
+ </sequential>
+ </macrodef>
+ <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${build.classes.dir}" name="destdir"/>
+ <sequential>
+ <fail unless="javac.includes">Must set javac.includes</fail>
+ <pathconvert pathsep="," property="javac.includes.binary">
+ <path>
+ <filelist dir="@{destdir}" files="${javac.includes}"/>
+ </path>
+ <globmapper from="*.java" to="*.class"/>
+ </pathconvert>
+ <delete>
+ <files includes="${javac.includes.binary}"/>
+ </delete>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-junit">
+ <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <sequential>
+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
+ <batchtest todir="${build.test.results.dir}"/>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg line="${run.jvmargs}"/>
+ </junit>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-nbjpda">
+ <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute default="${main.class}" name="name"/>
+ <attribute default="${debug.classpath}" name="classpath"/>
+ <attribute default="" name="stopclassname"/>
+ <sequential>
+ <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ </nbjpdastart>
+ </sequential>
+ </macrodef>
+ <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute default="${build.classes.dir}" name="dir"/>
+ <sequential>
+ <nbjpdareload>
+ <fileset dir="@{dir}" includes="${fix.classes}">
+ <include name="${fix.includes}*.class"/>
+ </fileset>
+ </nbjpdareload>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-debug-args">
+ <property name="version-output" value="java version "${ant.java.version}"/>
+ <condition property="have-jdk-older-than-1.4">
+ <or>
+ <contains string="${version-output}" substring="java version "1.0"/>
+ <contains string="${version-output}" substring="java version "1.1"/>
+ <contains string="${version-output}" substring="java version "1.2"/>
+ <contains string="${version-output}" substring="java version "1.3"/>
+ </or>
+ </condition>
+ <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
+ <istrue value="${have-jdk-older-than-1.4}"/>
+ </condition>
+ </target>
+ <target depends="-init-debug-args" name="-init-macrodef-debug">
+ <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${main.class}" name="classname"/>
+ <attribute default="${debug.classpath}" name="classpath"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <java classname="@{classname}" dir="${work.dir}" fork="true">
+ <jvmarg line="${debug-args-line}"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
+ <jvmarg line="${run.jvmargs}"/>
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="run-sys-prop."/>
+ <mapper from="run-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <customize/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-java">
+ <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute default="${main.class}" name="classname"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <java classname="@{classname}" dir="${work.dir}" fork="true">
+ <jvmarg line="${run.jvmargs}"/>
+ <classpath>
+ <path path="${run.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="run-sys-prop."/>
+ <mapper from="run-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <customize/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-presetdef-jar">
+ <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <jar compress="${jar.compress}" jarfile="${dist.jar}">
+ <j2seproject1:fileset dir="${build.classes.dir}"/>
+ </jar>
+ </presetdef>
+ </target>
+ <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
+ <!--
+ ===================
+ COMPILATION SECTION
+ ===================
+ -->
+ <target depends="init" name="deps-jar" unless="no.deps"/>
+ <target depends="init,deps-jar" name="-pre-pre-compile">
+ <mkdir dir="${build.classes.dir}"/>
+ </target>
+ <target name="-pre-compile">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target if="do.depend.true" name="-compile-depend">
+ <j2seproject3:depend/>
+ </target>
+ <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
+ <j2seproject3:javac/>
+ <copy todir="${build.classes.dir}">
+ <fileset dir="${src.core.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.apps.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.emu.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.install.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.test.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.driver.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.fs.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.test2.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.awt.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.desktop.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.driver2.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.font.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.test3.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.thinlet.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.driver3.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.net.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.test4.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.shell.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.test5.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.driver4.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.sound.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.test6.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.textui.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.driver5.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.nanoxml.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.icedtea.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.mmtk-vm.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.com.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.java.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset dir="${src.javax.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ <fileset d...
[truncated message content] |
|
From: <cr...@us...> - 2008-08-24 05:36:32
|
Revision: 4488
http://jnode.svn.sourceforge.net/jnode/?rev=4488&view=rev
Author: crawley
Date: 2008-08-24 05:36:29 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
Change Emu to use the 'alias' and 'syntax' extension points in selected
plugin descriptors, rather than relying on hard wired aliases (and no syntax).
Modified Paths:
--------------
trunk/distr/src/emu/org/jnode/emu/EditEmu.java
trunk/distr/src/emu/org/jnode/emu/Emu.java
trunk/distr/src/emu/org/jnode/emu/ShellEmu.java
trunk/shell/src/shell/org/jnode/shell/syntax/DefaultSyntaxManager.java
trunk/shell/src/shell/org/jnode/shell/syntax/SyntaxManager.java
trunk/shell/src/shell/org/jnode/shell/syntax/SyntaxSpecLoader.java
Added Paths:
-----------
trunk/distr/src/emu/org/jnode/emu/EmuException.java
Modified: trunk/distr/src/emu/org/jnode/emu/EditEmu.java
===================================================================
--- trunk/distr/src/emu/org/jnode/emu/EditEmu.java 2008-08-23 21:51:35 UTC (rev 4487)
+++ trunk/distr/src/emu/org/jnode/emu/EditEmu.java 2008-08-24 05:36:29 UTC (rev 4488)
@@ -11,14 +11,13 @@
*/
public class EditEmu extends Emu {
public static void main(String[] argv) throws Exception {
- initEnv();
-
-
- if (argv.length == 0) {
- System.out.println("No file specified");
+ if (argv.length == 0 || argv[0].startsWith("-")) {
+ System.err.println("Usage: editEmu <file> [<jnode-home>]");
return;
}
+ initEnv(argv.length > 1 ? new File(argv[1]) : null);
+
SwingTextScreenConsoleManager cm = new SwingTextScreenConsoleManager();
final TextScreenConsole console = cm.createConsole(
null,
Modified: trunk/distr/src/emu/org/jnode/emu/Emu.java
===================================================================
--- trunk/distr/src/emu/org/jnode/emu/Emu.java 2008-08-23 21:51:35 UTC (rev 4487)
+++ trunk/distr/src/emu/org/jnode/emu/Emu.java 2008-08-24 05:36:29 UTC (rev 4488)
@@ -1,16 +1,29 @@
package org.jnode.emu;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.naming.NameAlreadyBoundException;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
+
+import org.apache.log4j.Priority;
import org.jnode.naming.InitialNaming;
import org.jnode.naming.NameSpace;
+import org.jnode.nanoxml.XMLElement;
+import org.jnode.plugin.ConfigurationElement;
import org.jnode.shell.ShellManager;
+import org.jnode.shell.syntax.PluginSyntaxSpecAdapter;
+import org.jnode.shell.syntax.SyntaxBundle;
import org.jnode.shell.syntax.SyntaxManager;
import org.jnode.shell.syntax.DefaultSyntaxManager;
+import org.jnode.shell.syntax.SyntaxSpecAdapter;
+import org.jnode.shell.syntax.SyntaxSpecLoader;
+import org.jnode.shell.syntax.XMLSyntaxSpecAdapter;
import org.jnode.shell.alias.AliasManager;
import org.jnode.shell.alias.def.DefaultAliasManager;
import org.jnode.shell.def.DefaultShellManager;
@@ -19,10 +32,33 @@
/**
* @author Levente S\u00e1ntha
+ * @author Stephen Crawley
*/
-public class Emu {
- protected static void initEnv() throws NamingException {
+public abstract class Emu {
+ private static final String[] ALL_PROJECTS = new String[] {
+ "core", "distr", "fs", "gui", "net", "shell", "sound", "textui"
+ };
+
+ private static final String[] PLUGIN_NAMES = new String[] {
+ "org.jnode.shell.command",
+ "org.jnode.shell.command.driver.console",
+ "org.jnode.apps.editor",
+ "org.jnode.apps.edit",
+ "org.jnode.apps.console",
+ };
+
+ /**
+ * Initialize a minimal subset of JNode services to allow us to run JNode commands.
+ *
+ * @param root the notional JNode sandbox root directory or <code>null</code>.
+ * @throws EmuException
+ */
+ protected static void initEnv(File root) throws EmuException {
if (true) {
+ if (root == null) {
+ root = new File("").getAbsoluteFile();
+ System.err.println("Assuming that the JNode root is '" + root + "'");
+ }
InitialNaming.setNameSpace(new NameSpace() {
private Map<Class<?>, Object> space = new HashMap<Class<?>, Object>();
@@ -45,20 +81,145 @@
return space.keySet();
}
});
+
+ try {
InitialNaming.bind(DeviceManager.NAME, DeviceManager.INSTANCE);
- AliasManager alias_mgr = new DefaultAliasManager(new DummyExtensionPoint()).createAliasManager();
- alias_mgr.add("console", "org.jnode.shell.command.driver.console.ConsoleCommand");
- alias_mgr.add("help", "org.jnode.shell.command.HelpCommand");
- alias_mgr.add("alias", "org.jnode.shell.command.AliasCommand");
- alias_mgr.add("exit", "org.jnode.shell.command.ExitCommand");
- alias_mgr.add("edit", "org.jnode.apps.edit.EditCommand");
- alias_mgr.add("leed", "org.jnode.apps.editor.LeedCommand");
- alias_mgr.add("sconsole", "org.jnode.apps.console.SwingConsole");
+ AliasManager aliasMgr =
+ new DefaultAliasManager(new DummyExtensionPoint()).createAliasManager();
+ SyntaxManager syntaxMgr =
+ new DefaultSyntaxManager(new DummyExtensionPoint()).createSyntaxManager();
+ for (String pluginName : PLUGIN_NAMES) {
+ configurePluginCommands(root, pluginName, aliasMgr, syntaxMgr);
+ }
System.setProperty("jnode.invoker", "default");
- InitialNaming.bind(AliasManager.NAME, alias_mgr);
+ InitialNaming.bind(AliasManager.NAME, aliasMgr);
InitialNaming.bind(ShellManager.NAME, new DefaultShellManager());
- InitialNaming.bind(SyntaxManager.NAME, new DefaultSyntaxManager(new DummyExtensionPoint()));
+ InitialNaming.bind(SyntaxManager.NAME, syntaxMgr);
InitialNaming.bind(Help.NAME, new DefaultHelp());
+ } catch (NamingException ex) {
+ throw new EmuException("Problem setting up InitialNaming bindings", ex);
+ }
}
}
+
+ /**
+ * Configure any command classes specified by a given plugin's descriptor
+ * @param root the root directory for the JNode sandbox.
+ * @param pluginName the plugin to be processed
+ * @param aliasMgr the alias manager to be populated
+ * @param syntaxMgr the syntax manager to be populated
+ * @throws EmuException
+ */
+ private static void configurePluginCommands(File root, String pluginName, AliasManager aliasMgr,
+ SyntaxManager syntaxMgr) throws EmuException {
+ XMLElement pluginDescriptor = loadPluginDescriptor(root, pluginName);
+ extractAliases(pluginDescriptor, aliasMgr);
+ extractSyntaxBundles(pluginDescriptor, syntaxMgr);
+ }
+
+ /**
+ * Populate the supplied syntax manager with syntax entries from a plugin descriptor.
+ * @param pluginDescriptor the plugin descriptor's root XML element
+ * @param syntaxMgr the syntax manager to be populated.
+ * @throws EmuException
+ */
+ private static void extractSyntaxBundles(XMLElement pluginDescriptor, SyntaxManager syntaxMgr)
+ throws EmuException {
+ XMLElement syntaxesDescriptor = findExtension(pluginDescriptor, SyntaxManager.SYNTAXES_EP_NAME);
+ if (syntaxesDescriptor == null) {
+ return;
+ }
+ SyntaxSpecLoader loader = new SyntaxSpecLoader();
+ for (XMLElement syntaxDescriptor : syntaxesDescriptor.getChildren()) {
+ if (!syntaxDescriptor.getName().equals("syntax")) {
+ continue;
+ }
+ SyntaxSpecAdapter adaptedElement = new XMLSyntaxSpecAdapter(syntaxDescriptor);
+ try {
+ SyntaxBundle bundle = loader.loadSyntax(adaptedElement);
+ if (bundle != null) {
+ syntaxMgr.add(bundle);
+ }
+ } catch (Exception ex) {
+ throw new EmuException("problem in syntax", ex);
+ }
+ }
+ }
+
+ /**
+ * Populate the supplied alias manager with aliases from a plugin descriptor.
+ * @param pluginDescriptor the plugin descriptor's root XML element
+ * @param aliasMgr the alias manager to be populated.
+ * @throws EmuException
+ */
+ private static void extractAliases(XMLElement pluginDescriptor, AliasManager aliasMgr) {
+ XMLElement aliasesDescriptor = findExtension(pluginDescriptor, AliasManager.ALIASES_EP_NAME);
+ if (aliasesDescriptor == null) {
+ return;
+ }
+ for (XMLElement aliasDescriptor : aliasesDescriptor.getChildren()) {
+ if (aliasDescriptor.getName().equals("alias")) {
+ String alias = aliasDescriptor.getStringAttribute("name");
+ String className = aliasDescriptor.getStringAttribute("class");
+ aliasMgr.add(alias, className);
+ }
+ }
+ }
+
+ /**
+ * Locate the descriptor for a given extension point.
+ * @param pluginDescriptor the plugin descriptor
+ * @param epName the extension point's name
+ * @return
+ */
+ private static XMLElement findExtension(XMLElement pluginDescriptor, String epName) {
+ for (XMLElement child : pluginDescriptor.getChildren()) {
+ if (child.getName().equals("extension") &&
+ epName.equals(child.getStringAttribute("point"))) {
+ return child;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Locate and load a plugin descriptor. We search the "descriptors" directory of
+ * each of the projects listed in ALL_PROJECTS
+ * @param root the notional root directory for the user's JNode sandbox.
+ * @param pluginName the name of the plugin we're trying to locate
+ * @return the loaded plugin descriptor or <code>null</code>
+ * @throws EmuException
+ */
+ private static XMLElement loadPluginDescriptor(File root, String pluginName)
+ throws EmuException {
+ File file = null;
+ for (String projectName : ALL_PROJECTS) {
+ file = new File(new File(new File(root, projectName), "descriptors"), pluginName + ".xml");
+ if (file.exists()) {
+ break;
+ }
+ }
+ if (!file.exists()) {
+ throw new EmuException("Cannot find plugin descriptor file for '" +
+ pluginName + "': " + file.getAbsolutePath());
+ }
+ BufferedReader br = null;
+ try {
+ XMLElement elem = new XMLElement();
+ br = new BufferedReader(new FileReader(file));
+ elem.parseFromReader(br);
+ if (!elem.getName().equals("plugin")) {
+ throw new EmuException("File does not contain a 'plugin' descriptor: " + file);
+ }
+ return elem;
+ } catch (IOException ex) {
+ throw new EmuException("Problem reading / parsing plugin descriptor file " + file, ex);
+ } finally {
+ try {
+ br.close();
+ } catch (IOException ex) {
+ // ignore
+ }
+ }
+ }
}
Added: trunk/distr/src/emu/org/jnode/emu/EmuException.java
===================================================================
--- trunk/distr/src/emu/org/jnode/emu/EmuException.java (rev 0)
+++ trunk/distr/src/emu/org/jnode/emu/EmuException.java 2008-08-24 05:36:29 UTC (rev 4488)
@@ -0,0 +1,12 @@
+package org.jnode.emu;
+
+public class EmuException extends Exception {
+
+ public EmuException(String message) {
+ super(message);
+ }
+
+ public EmuException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Modified: trunk/distr/src/emu/org/jnode/emu/ShellEmu.java
===================================================================
--- trunk/distr/src/emu/org/jnode/emu/ShellEmu.java 2008-08-23 21:51:35 UTC (rev 4487)
+++ trunk/distr/src/emu/org/jnode/emu/ShellEmu.java 2008-08-24 05:36:29 UTC (rev 4488)
@@ -1,5 +1,7 @@
package org.jnode.emu;
+import java.io.File;
+
import org.jnode.driver.console.ConsoleManager;
import org.jnode.driver.console.swing.SwingTextScreenConsoleManager;
import org.jnode.shell.CommandShell;
@@ -10,7 +12,11 @@
public class ShellEmu extends Emu {
public static void main(String[] argv) throws Exception {
- initEnv();
+ if (argv.length > 0 && argv[0].startsWith("-")) {
+ System.err.println("Usage: shellemu [<jnode-home>]");
+ return;
+ }
+ initEnv(argv.length > 0 ? new File(argv[0]) : null);
SwingTextScreenConsoleManager cm = new SwingTextScreenConsoleManager();
new Thread(new CommandShell(cm.createConsole(
"Console 1",
Modified: trunk/shell/src/shell/org/jnode/shell/syntax/DefaultSyntaxManager.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/syntax/DefaultSyntaxManager.java 2008-08-23 21:51:35 UTC (rev 4487)
+++ trunk/shell/src/shell/org/jnode/shell/syntax/DefaultSyntaxManager.java 2008-08-24 05:36:29 UTC (rev 4488)
@@ -115,17 +115,12 @@
System.out.println("Refreshing syntax list");
if (syntaxEP != null) {
syntaxes.clear();
- final Extension[] extensions = syntaxEP.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- final Extension ext = extensions[i];
- final ConfigurationElement[] elements =
- ext.getConfigurationElements();
+ for (Extension ext : syntaxEP.getExtensions()) {
SyntaxSpecLoader loader = new SyntaxSpecLoader();
-
- for (int j = 0; j < elements.length; j++) {
- SyntaxSpecAdapter element = new PluginSyntaxSpecAdapter(elements[j]);
+ for (ConfigurationElement element : ext.getConfigurationElements()) {
+ SyntaxSpecAdapter adaptedElement = new PluginSyntaxSpecAdapter(element);
try {
- SyntaxBundle bundle = loader.loadSyntax(element);
+ SyntaxBundle bundle = loader.loadSyntax(adaptedElement);
if (bundle != null) {
syntaxes.put(bundle.getAlias(), bundle);
}
Modified: trunk/shell/src/shell/org/jnode/shell/syntax/SyntaxManager.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/syntax/SyntaxManager.java 2008-08-23 21:51:35 UTC (rev 4487)
+++ trunk/shell/src/shell/org/jnode/shell/syntax/SyntaxManager.java 2008-08-24 05:36:29 UTC (rev 4488)
@@ -36,7 +36,7 @@
*/
public static final Class<SyntaxManager> NAME = SyntaxManager.class;
- public static final String ALIASES_EP_NAME = "org.jnode.shell.syntaxes";
+ public static final String SYNTAXES_EP_NAME = "org.jnode.shell.syntaxes";
/**
* Add a syntax bundle
Modified: trunk/shell/src/shell/org/jnode/shell/syntax/SyntaxSpecLoader.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/syntax/SyntaxSpecLoader.java 2008-08-23 21:51:35 UTC (rev 4487)
+++ trunk/shell/src/shell/org/jnode/shell/syntax/SyntaxSpecLoader.java 2008-08-24 05:36:29 UTC (rev 4488)
@@ -120,14 +120,14 @@
return new RepeatSyntax(label, childSyntax, minCount, maxCount, description);
} else if (kind.equals("sequence")) {
int nos = syntaxElement.getNosChildren();
- Syntax[] seq = new OptionSyntax[nos];
+ Syntax[] seq = new Syntax[nos];
for (int i = 0; i < nos; i++) {
seq[i] = doLoad(syntaxElement.getChild(i));
}
return new SequenceSyntax(label, description, seq);
} else if (kind.equals("optional")) {
int nos = syntaxElement.getNosChildren();
- Syntax[] seq = new OptionSyntax[nos];
+ Syntax[] seq = new Syntax[nos];
for (int i = 0; i < nos; i++) {
seq[i] = doLoad(syntaxElement.getChild(i));
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-24 08:13:32
|
Revision: 4489
http://jnode.svn.sourceforge.net/jnode/?rev=4489&view=rev
Author: lsantha
Date: 2008-08-24 08:13:29 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
Significantly improved the performance of openjdk-annotate task.
Modified Paths:
--------------
trunk/all/build.xml
trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2008-08-24 05:36:29 UTC (rev 4488)
+++ trunk/all/build.xml 2008-08-24 08:13:29 UTC (rev 4489)
@@ -751,17 +751,15 @@
</target>
<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"
- buildStartTime="${hotswap.class.tstamp}" pattern="${hotswap.class.tstamp.pattern}"
- trace="false" failonerror="true">
- <fileset dir="${root.dir}/core/build/classes">
- <patternset includes="**/*.class"/>
- </fileset>
- </oj-annotate>
+ buildStartTime="${hotswap.class.tstamp}"
+ pattern="${hotswap.class.tstamp.pattern}"
+ trace="false"
+ failonerror="true"
+ basedir="${root.dir}/core/build/classes"/>
</target>
<!-- check that all native methods are properly implemented for JNode -->
Modified: trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java 2008-08-24 05:36:29 UTC (rev 4488)
+++ trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java 2008-08-24 08:13:29 UTC (rev 4489)
@@ -65,6 +65,7 @@
private String buildStartTime = "";
private String pattern = "";
private long startTime = 0;
+ private String baseDir;
private Properties annotations = new Properties();
@@ -76,8 +77,15 @@
throw new BuildException("invalid buildStartTime or pattern", e);
}
- if (readProperties()) {
- processFiles();
+ try {
+ if (readProperties()) {
+ for(String file : classesFiles){
+ File classFile = new File(baseDir, file);
+ processFile(classFile);
+ }
+ }
+ } catch (IOException ioe) {
+ throw new BuildException(ioe);
}
}
@@ -108,6 +116,10 @@
this.pattern = pattern;
}
+ public void setBaseDir(String baseDir) {
+ this.baseDir = baseDir;
+ }
+
/**
* Read the properties file. For now, it simply contains a list of
* classes that need the SharedStatics annotation.
@@ -191,16 +203,15 @@
*/
@Override
protected void processFile(File classFile) throws IOException {
+ if (classFile.lastModified() < startTime) {
+ return;
+ }
+
String annotations = getAnnotations(classFile);
if (annotations == null) {
return;
}
- if (classFile.lastModified() < startTime) {
- System.out.println("Skipping already annotated file " + classFile.getName());
- return;
- }
-
File tmpFile = new File(classFile.getParentFile(), classFile.getName() + ".tmp");
FileInputStream fis = null;
boolean classIsModified = false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-24 10:01:45
|
Revision: 4490
http://jnode.svn.sourceforge.net/jnode/?rev=4490&view=rev
Author: lsantha
Date: 2008-08-24 10:01:42 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
Added support for customizing standard Java system properties java.home, java.io.tmp, user.home in jnode.properties.
Modified Paths:
--------------
trunk/all/build.xml
trunk/builder/build.xml
trunk/core/build.xml
trunk/core/core.iml
trunk/core/src/core/org/jnode/vm/VmSystem.java
trunk/jnode.properties.dist
Added Paths:
-----------
trunk/core/src/template/
trunk/core/src/template/org/
trunk/core/src/template/org/jnode/
trunk/core/src/template/org/jnode/vm/
trunk/core/src/template/org/jnode/vm/VmSystemSettings.java
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2008-08-24 08:13:29 UTC (rev 4489)
+++ trunk/all/build.xml 2008-08-24 10:01:42 UTC (rev 4490)
@@ -214,6 +214,8 @@
<!-- Call the assemble target of all subprojects -->
<target name="assemble-projects" depends="prepare">
+ <!-- pre compile tasks needed for compilation -->
+ <ant target="pre-compile" dir="${root.dir}/builder" inheritall="on" inheritrefs="on" />
<jnode.antall target="assemble"/>
</target>
Modified: trunk/builder/build.xml
===================================================================
--- trunk/builder/build.xml 2008-08-24 08:13:29 UTC (rev 4489)
+++ trunk/builder/build.xml 2008-08-24 10:01:42 UTC (rev 4490)
@@ -28,6 +28,28 @@
<mkdir dir="${jnasm-assembler-gen.dir}"/>
</target>
+ <!-- Compile the Template ANT task needed for compiling the core -->
+ <target name="pre-compile" depends="prepare">
+ <javac destdir="${my-classes.dir}"
+ debug="on"
+ optimize="on"
+ fork="off"
+ compiler="modern"
+ includeJavaRuntime="true"
+ target="${java.target}"
+ source="${java.source}"
+ encoding="${java.encoding}"
+ excludes="**/*-template.java,**/package-info.java"
+ srcdir="${my-src.dir}/builder/">
+ <bootclasspath path="${jnode-core.jar}"/>
+ <compilerarg value="${compilerarg}"/>
+ <filename name="org/jnode/ant/taskdefs/TemplateTask.java" />
+ </javac>
+ <jar jarfile="${jnode-builder.jar}"
+ basedir="${my-classes.dir}"
+ includes="org/jnode/ant/taskdefs/**"/>
+ </target>
+
<!-- Compile all subproject java files -->
<target name="compile" depends="prepare">
<javacc target="${jnasm-src.dir}/preprocessor/gen/JNAsmPP.jj"
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2008-08-24 08:13:29 UTC (rev 4489)
+++ trunk/core/build.xml 2008-08-24 10:01:42 UTC (rev 4490)
@@ -109,6 +109,14 @@
<ExpandTest classname="PrimitiveLongTest" type="long"/>
<ExpandTest classname="PrimitiveFloatTest" type="float"/>
<ExpandTest classname="PrimitiveDoubleTest" type="double"/>
+
+ <taskdef name="template" classname="org.jnode.ant.taskdefs.TemplateTask" classpathref="cp-jnode"/>
+ <template file="${my-src.dir}/template/org/jnode/vm/VmSystemSettings.java"
+ tofile="${my-gen.dir}/org/jnode/vm/VmSystemSettings.java">
+ <token name="@java.home@" value="${jnode.java.home}"/>
+ <token name="@java.io.tmpdir@" value="${jnode.java.io.tmpdir}"/>
+ <token name="@user.home@" value="${jnode.user.home}"/>
+ </template>
</target>
<!-- Compile all subproject java files -->
Modified: trunk/core/core.iml
===================================================================
--- trunk/core/core.iml 2008-08-24 08:13:29 UTC (rev 4489)
+++ trunk/core/core.iml 2008-08-24 10:01:42 UTC (rev 4490)
@@ -22,6 +22,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/openjdk/org" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/openjdk/sun" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/openjdk/vm" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/template" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/vmmagic" isTestSource="false" />
</content>
Modified: trunk/core/src/core/org/jnode/vm/VmSystem.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmSystem.java 2008-08-24 08:13:29 UTC (rev 4489)
+++ trunk/core/src/core/org/jnode/vm/VmSystem.java 2008-08-24 10:01:42 UTC (rev 4490)
@@ -324,6 +324,7 @@
res.put("swing.handleTopLevelPaint", "false");
+ VmSystemSettings.insertSystemProperties(res);
}
/**
Added: trunk/core/src/template/org/jnode/vm/VmSystemSettings.java
===================================================================
--- trunk/core/src/template/org/jnode/vm/VmSystemSettings.java (rev 0)
+++ trunk/core/src/template/org/jnode/vm/VmSystemSettings.java 2008-08-24 10:01:42 UTC (rev 4490)
@@ -0,0 +1,21 @@
+/*
+ * $
+ */
+package org.jnode.vm;
+
+import java.util.Properties;
+
+/**
+ * @author Levente S\u00e1ntha
+ */
+public class VmSystemSettings {
+ private static final boolean ENABLED = false;
+
+ public static void insertSystemProperties(Properties props) {
+ if (ENABLED) {
+ props.put("java.home", "@java.home@");
+ props.put("java.io.tmpdir", "@java.io.tmpdir@");
+ props.put("user.home", "@user.home@");
+ }
+ }
+}
Modified: trunk/jnode.properties.dist
===================================================================
--- trunk/jnode.properties.dist 2008-08-24 08:13:29 UTC (rev 4489)
+++ trunk/jnode.properties.dist 2008-08-24 10:01:42 UTC (rev 4490)
@@ -85,3 +85,11 @@
# to the VMX file's location!
#vmware.vmx.overrides=<some-file-containing-vmx-settings>
+
+# -----------------------------------------------
+# Custom system properties
+# -----------------------------------------------
+
+jnode.java.home=/jnode
+jnode.java.io.tmpdir=/jnode/tmp
+jnode.user.home=/jnode/home
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-24 11:38:16
|
Revision: 4492
http://jnode.svn.sourceforge.net/jnode/?rev=4492&view=rev
Author: lsantha
Date: 2008-08-24 11:38:12 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
Code style fixes.
Modified Paths:
--------------
trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java
trunk/distr/src/emu/org/jnode/emu/Emu.java
trunk/fs/src/fs/org/jnode/fs/ext2/command/FormatExt2Command.java
trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java
Modified: trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java 2008-08-24 10:02:34 UTC (rev 4491)
+++ trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java 2008-08-24 11:38:12 UTC (rev 4492)
@@ -79,7 +79,7 @@
try {
if (readProperties()) {
- for(String file : classesFiles){
+ for (String file : classesFiles) {
File classFile = new File(baseDir, file);
processFile(classFile);
}
@@ -206,7 +206,7 @@
if (classFile.lastModified() < startTime) {
return;
}
-
+
String annotations = getAnnotations(classFile);
if (annotations == null) {
return;
Modified: trunk/distr/src/emu/org/jnode/emu/Emu.java
===================================================================
--- trunk/distr/src/emu/org/jnode/emu/Emu.java 2008-08-24 10:02:34 UTC (rev 4491)
+++ trunk/distr/src/emu/org/jnode/emu/Emu.java 2008-08-24 11:38:12 UTC (rev 4492)
@@ -10,46 +10,42 @@
import javax.naming.NameAlreadyBoundException;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
-
-import org.apache.log4j.Priority;
import org.jnode.naming.InitialNaming;
import org.jnode.naming.NameSpace;
import org.jnode.nanoxml.XMLElement;
-import org.jnode.plugin.ConfigurationElement;
import org.jnode.shell.ShellManager;
-import org.jnode.shell.syntax.PluginSyntaxSpecAdapter;
+import org.jnode.shell.alias.AliasManager;
+import org.jnode.shell.alias.def.DefaultAliasManager;
+import org.jnode.shell.def.DefaultShellManager;
+import org.jnode.shell.help.Help;
+import org.jnode.shell.help.def.DefaultHelp;
+import org.jnode.shell.syntax.DefaultSyntaxManager;
import org.jnode.shell.syntax.SyntaxBundle;
import org.jnode.shell.syntax.SyntaxManager;
-import org.jnode.shell.syntax.DefaultSyntaxManager;
import org.jnode.shell.syntax.SyntaxSpecAdapter;
import org.jnode.shell.syntax.SyntaxSpecLoader;
import org.jnode.shell.syntax.XMLSyntaxSpecAdapter;
-import org.jnode.shell.alias.AliasManager;
-import org.jnode.shell.alias.def.DefaultAliasManager;
-import org.jnode.shell.def.DefaultShellManager;
-import org.jnode.shell.help.Help;
-import org.jnode.shell.help.def.DefaultHelp;
/**
* @author Levente S\u00e1ntha
* @author Stephen Crawley
*/
public abstract class Emu {
- private static final String[] ALL_PROJECTS = new String[] {
+ private static final String[] ALL_PROJECTS = new String[]{
"core", "distr", "fs", "gui", "net", "shell", "sound", "textui"
};
-
- private static final String[] PLUGIN_NAMES = new String[] {
+
+ private static final String[] PLUGIN_NAMES = new String[]{
"org.jnode.shell.command",
"org.jnode.shell.command.driver.console",
"org.jnode.apps.editor",
"org.jnode.apps.edit",
"org.jnode.apps.console",
};
-
+
/**
* Initialize a minimal subset of JNode services to allow us to run JNode commands.
- *
+ *
* @param root the notional JNode sandbox root directory or <code>null</code>.
* @throws EmuException
*/
@@ -81,21 +77,21 @@
return space.keySet();
}
});
-
+
try {
- InitialNaming.bind(DeviceManager.NAME, DeviceManager.INSTANCE);
- AliasManager aliasMgr =
- new DefaultAliasManager(new DummyExtensionPoint()).createAliasManager();
- SyntaxManager syntaxMgr =
- new DefaultSyntaxManager(new DummyExtensionPoint()).createSyntaxManager();
- for (String pluginName : PLUGIN_NAMES) {
- configurePluginCommands(root, pluginName, aliasMgr, syntaxMgr);
- }
- System.setProperty("jnode.invoker", "default");
- InitialNaming.bind(AliasManager.NAME, aliasMgr);
- InitialNaming.bind(ShellManager.NAME, new DefaultShellManager());
- InitialNaming.bind(SyntaxManager.NAME, syntaxMgr);
- InitialNaming.bind(Help.NAME, new DefaultHelp());
+ InitialNaming.bind(DeviceManager.NAME, DeviceManager.INSTANCE);
+ AliasManager aliasMgr =
+ new DefaultAliasManager(new DummyExtensionPoint()).createAliasManager();
+ SyntaxManager syntaxMgr =
+ new DefaultSyntaxManager(new DummyExtensionPoint()).createSyntaxManager();
+ for (String pluginName : PLUGIN_NAMES) {
+ configurePluginCommands(root, pluginName, aliasMgr, syntaxMgr);
+ }
+ System.setProperty("jnode.invoker", "default");
+ InitialNaming.bind(AliasManager.NAME, aliasMgr);
+ InitialNaming.bind(ShellManager.NAME, new DefaultShellManager());
+ InitialNaming.bind(SyntaxManager.NAME, syntaxMgr);
+ InitialNaming.bind(Help.NAME, new DefaultHelp());
} catch (NamingException ex) {
throw new EmuException("Problem setting up InitialNaming bindings", ex);
}
@@ -104,14 +100,15 @@
/**
* Configure any command classes specified by a given plugin's descriptor
- * @param root the root directory for the JNode sandbox.
+ *
+ * @param root the root directory for the JNode sandbox.
* @param pluginName the plugin to be processed
- * @param aliasMgr the alias manager to be populated
- * @param syntaxMgr the syntax manager to be populated
+ * @param aliasMgr the alias manager to be populated
+ * @param syntaxMgr the syntax manager to be populated
* @throws EmuException
*/
private static void configurePluginCommands(File root, String pluginName, AliasManager aliasMgr,
- SyntaxManager syntaxMgr) throws EmuException {
+ SyntaxManager syntaxMgr) throws EmuException {
XMLElement pluginDescriptor = loadPluginDescriptor(root, pluginName);
extractAliases(pluginDescriptor, aliasMgr);
extractSyntaxBundles(pluginDescriptor, syntaxMgr);
@@ -119,11 +116,12 @@
/**
* Populate the supplied syntax manager with syntax entries from a plugin descriptor.
+ *
* @param pluginDescriptor the plugin descriptor's root XML element
- * @param syntaxMgr the syntax manager to be populated.
+ * @param syntaxMgr the syntax manager to be populated.
* @throws EmuException
*/
- private static void extractSyntaxBundles(XMLElement pluginDescriptor, SyntaxManager syntaxMgr)
+ private static void extractSyntaxBundles(XMLElement pluginDescriptor, SyntaxManager syntaxMgr)
throws EmuException {
XMLElement syntaxesDescriptor = findExtension(pluginDescriptor, SyntaxManager.SYNTAXES_EP_NAME);
if (syntaxesDescriptor == null) {
@@ -148,8 +146,9 @@
/**
* Populate the supplied alias manager with aliases from a plugin descriptor.
+ *
* @param pluginDescriptor the plugin descriptor's root XML element
- * @param aliasMgr the alias manager to be populated.
+ * @param aliasMgr the alias manager to be populated.
* @throws EmuException
*/
private static void extractAliases(XMLElement pluginDescriptor, AliasManager aliasMgr) {
@@ -168,14 +167,15 @@
/**
* Locate the descriptor for a given extension point.
+ *
* @param pluginDescriptor the plugin descriptor
- * @param epName the extension point's name
+ * @param epName the extension point's name
* @return
*/
private static XMLElement findExtension(XMLElement pluginDescriptor, String epName) {
for (XMLElement child : pluginDescriptor.getChildren()) {
if (child.getName().equals("extension") &&
- epName.equals(child.getStringAttribute("point"))) {
+ epName.equals(child.getStringAttribute("point"))) {
return child;
}
}
@@ -185,12 +185,13 @@
/**
* Locate and load a plugin descriptor. We search the "descriptors" directory of
* each of the projects listed in ALL_PROJECTS
- * @param root the notional root directory for the user's JNode sandbox.
+ *
+ * @param root the notional root directory for the user's JNode sandbox.
* @param pluginName the name of the plugin we're trying to locate
* @return the loaded plugin descriptor or <code>null</code>
* @throws EmuException
*/
- private static XMLElement loadPluginDescriptor(File root, String pluginName)
+ private static XMLElement loadPluginDescriptor(File root, String pluginName)
throws EmuException {
File file = null;
for (String projectName : ALL_PROJECTS) {
@@ -200,8 +201,8 @@
}
}
if (!file.exists()) {
- throw new EmuException("Cannot find plugin descriptor file for '" +
- pluginName + "': " + file.getAbsolutePath());
+ throw new EmuException("Cannot find plugin descriptor file for '" +
+ pluginName + "': " + file.getAbsolutePath());
}
BufferedReader br = null;
try {
Modified: trunk/fs/src/fs/org/jnode/fs/ext2/command/FormatExt2Command.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ext2/command/FormatExt2Command.java 2008-08-24 10:02:34 UTC (rev 4491)
+++ trunk/fs/src/fs/org/jnode/fs/ext2/command/FormatExt2Command.java 2008-08-24 11:38:12 UTC (rev 4492)
@@ -23,12 +23,11 @@
import java.util.HashMap;
import java.util.Map;
-
import org.jnode.fs.command.AbstractFormatCommand;
import org.jnode.fs.ext2.BlockSize;
import org.jnode.fs.ext2.Ext2FileSystem;
-import org.jnode.fs.ext2.Ext2FileSystemFormatter;
-import org.jnode.shell.syntax.Argument;
+import org.jnode.fs.ext2.Ext2FileSystemFormatter;
+import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.MappedArgument;
/**
@@ -39,14 +38,16 @@
private static class BlockSizeArgument extends MappedArgument<BlockSize> {
private static final Map<String, BlockSize> MAP = new HashMap<String, BlockSize>();
+
static {
MAP.put("1k", BlockSize._1Kb);
MAP.put("2k", BlockSize._2Kb);
MAP.put("4k", BlockSize._4Kb);
}
+
public BlockSizeArgument() {
super("blockSize", Argument.OPTIONAL, new BlockSize[0],
- MAP, true, "block size for EXT2 filesystem (default 4k)");
+ MAP, true, "block size for EXT2 filesystem (default 4k)");
}
@Override
@@ -68,10 +69,10 @@
@Override
protected Ext2FileSystemFormatter getFormatter() {
- if(ARG_BLOCK_SIZE.isSet()){
- return new Ext2FileSystemFormatter(ARG_BLOCK_SIZE.getValue());
- } else {
- return new Ext2FileSystemFormatter(BlockSize._4Kb);
- }
+ if (ARG_BLOCK_SIZE.isSet()) {
+ return new Ext2FileSystemFormatter(ARG_BLOCK_SIZE.getValue());
+ } else {
+ return new Ext2FileSystemFormatter(BlockSize._4Kb);
+ }
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java 2008-08-24 10:02:34 UTC (rev 4491)
+++ trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java 2008-08-24 11:38:12 UTC (rev 4492)
@@ -18,14 +18,13 @@
* 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.help.def;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeSet;
-
import org.jnode.shell.help.Argument;
import org.jnode.shell.help.Help;
import org.jnode.shell.help.Parameter;
@@ -44,7 +43,7 @@
public static final String RESOURCE_NAME = "messages.properties";
private static final int NOMINAL_WIDTH = 75;
/* start with 80 spaces ... */
- private static String spaces =
+ private static String spaces =
" ";
/**
@@ -55,7 +54,8 @@
/**
* Shows the complete help for a command.
- * @see Help#help(org.jnode.shell.help.Help.Info, String)
+ *
+ * @see Help#help(org.jnode.shell.help.Help.Info, String)
*/
public void help(Info info, String command, PrintStream out) {
final Syntax[] syntaxes = info.getSyntaxes();
@@ -73,8 +73,8 @@
usage(syntaxes, bundle, out);
if (bundle.getDescription() != null) {
out.println("\n" + Help.getLocalizedHelp("help.description") + ":");
- format(out, new Cell[]{new Cell(4, NOMINAL_WIDTH - 4)},
- new String[]{bundle.getDescription()});
+ format(out, new Cell[]{new Cell(4, NOMINAL_WIDTH - 4)},
+ new String[]{bundle.getDescription()});
}
Map<String, TreeSet<String>> flagMap = buildFlagMap(syntaxes);
boolean first = true;
@@ -101,14 +101,14 @@
private Map<String, TreeSet<String>> buildFlagMap(SyntaxBundle syntaxes) {
HashMap<String, TreeSet<String>> res = new HashMap<String, TreeSet<String>>();
- for (org.jnode.shell.syntax.Syntax syntax: syntaxes.getSyntaxes()) {
+ for (org.jnode.shell.syntax.Syntax syntax : syntaxes.getSyntaxes()) {
buildFlagMap(syntax, res);
}
return res;
}
- private void buildFlagMap(org.jnode.shell.syntax.Syntax syntax,
- HashMap<String, TreeSet<String>> res) {
+ private void buildFlagMap(org.jnode.shell.syntax.Syntax syntax,
+ HashMap<String, TreeSet<String>> res) {
if (syntax instanceof OptionSyntax) {
OptionSyntax os = (OptionSyntax) syntax;
String key = os.getArgName();
@@ -140,7 +140,7 @@
if (syntax.getDescription() != null) {
out.println("\n" + Help.getLocalizedHelp("help.description") + ":");
format(out, new Cell[]{new Cell(4, NOMINAL_WIDTH - 4)},
- new String[]{syntax.getDescription()});
+ new String[]{syntax.getDescription()});
}
final Parameter[] params = syntax.getParams();
if (params.length != 0) {
@@ -180,8 +180,8 @@
int usageLength = usageText.length();
int commandLength = command.length();
Cell[] cells =
- new Cell[] {new Cell(0, usageLength), new Cell(1, commandLength),
- new Cell(1, NOMINAL_WIDTH - 2 - usageLength - commandLength)};
+ new Cell[]{new Cell(0, usageLength), new Cell(1, commandLength),
+ new Cell(1, NOMINAL_WIDTH - 2 - usageLength - commandLength)};
String[] texts = new String[]{usageText, command, null};
String[] texts2 = new String[]{"", "", null};
org.jnode.shell.syntax.Syntax[] syntaxes = syntaxBundle.getSyntaxes();
@@ -202,33 +202,33 @@
}
public void describeParameter(Parameter param, PrintStream out) {
- format(out, new Cell[]{new Cell(2, 18), new Cell(2, NOMINAL_WIDTH - 22)},
- new String[]{param.getName(), param.getDescription()});
+ format(out, new Cell[]{new Cell(2, 18), new Cell(2, NOMINAL_WIDTH - 22)},
+ new String[]{param.getName(), param.getDescription()});
}
public void describeArgument(Argument arg, PrintStream out) {
format(out, new Cell[]{new Cell(4, 16), new Cell(2, NOMINAL_WIDTH - 22)},
- new String[]{arg.getName(), arg.getDescription()});
+ new String[]{arg.getName(), arg.getDescription()});
}
@Override
public void describeArgument(org.jnode.shell.syntax.Argument<?> arg, PrintStream out) {
String description = "(" + arg.getTypeDescription() + ") " + arg.getDescription();
format(out, new Cell[]{new Cell(4, 16), new Cell(2, NOMINAL_WIDTH - 22)},
- new String[]{"<" + arg.getLabel() + ">", description});
+ new String[]{"<" + arg.getLabel() + ">", description});
}
@Override
public void describeOption(FlagArgument arg, TreeSet<String> flagTokens, PrintStream out) {
StringBuffer sb = new StringBuffer();
- for (String flagToken: flagTokens) {
+ for (String flagToken : flagTokens) {
if (sb.length() > 0) {
sb.append(" | ");
}
sb.append(flagToken);
}
format(out, new Cell[]{new Cell(4, 16), new Cell(2, NOMINAL_WIDTH - 22)},
- new String[]{sb.toString(), arg.getDescription()});
+ new String[]{sb.toString(), arg.getDescription()});
}
protected void format(PrintStream out, Cell[] cells, String[] texts) {
@@ -265,6 +265,7 @@
/**
* Get a String consisting of 'count' spaces.
+ *
* @param count the number of spaces
* @return the string
*/
@@ -299,8 +300,9 @@
/**
* Construct a Cell with a leading margin and a text width.
+ *
* @param margin the number of leading spaces for the Cell
- * @param width the width of the text part of the Cell
+ * @param width the width of the text part of the Cell
*/
protected Cell(int margin, int width) {
this.margin = margin;
@@ -311,7 +313,7 @@
}
/**
- * Heuristically, split of a head substring of 'text' to fit within this Cell's width. We try
+ * Heuristically, split of a head substring of 'text' to fit within this Cell's width. We try
* to split at a space character, but if this will make the text too ragged, we simply chop.
*/
protected String fit(String text) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-08-24 14:03:08
|
Revision: 4493
http://jnode.svn.sourceforge.net/jnode/?rev=4493&view=rev
Author: crawley
Date: 2008-08-24 14:03:04 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
Fix TAB completion to use the current interpreter to escape any
meta-characters in each completion found.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/CompletionInfo.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java
trunk/shell/src/shell/org/jnode/shell/CommandInterpreter.java
trunk/shell/src/shell/org/jnode/shell/CommandShell.java
trunk/shell/src/shell/org/jnode/shell/DefaultInterpreter.java
trunk/shell/src/shell/org/jnode/shell/RedirectingInterpreter.java
trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneInterpreter.java
trunk/shell/src/shell/org/jnode/shell/syntax/URLArgument.java
trunk/shell/src/test/org/jnode/test/shell/CompletionInfoTest.java
Added Paths:
-----------
trunk/shell/src/shell/org/jnode/shell/CommandCompletions.java
Modified: trunk/core/src/driver/org/jnode/driver/console/CompletionInfo.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/CompletionInfo.java 2008-08-24 11:38:12 UTC (rev 4492)
+++ trunk/core/src/driver/org/jnode/driver/console/CompletionInfo.java 2008-08-24 14:03:04 UTC (rev 4493)
@@ -29,14 +29,8 @@
* @author Ewout Prangsma (ep...@us...)
* @author cr...@jn...
*/
-public class CompletionInfo {
- private static final SortedSet<String> NO_COMPLETIONS =
- Collections.unmodifiableSortedSet(new TreeSet<String>());
+public interface CompletionInfo {
- private TreeSet<String> completions;
-
- private int completionStart = -1;
-
/**
* This method is called to register a possible completion. A null or empty
* completion string will be quietly ignored.
@@ -45,18 +39,7 @@
* @param partial if <code>true</code>, further completions of the
* completion string may be possible.
*/
- public void addCompletion(String completion, boolean partial) {
- if (completion == null || completion.length() == 0) {
- return;
- }
- if (completions == null) {
- completions = new TreeSet<String>();
- }
- if (!partial) {
- completion += ' ';
- }
- completions.add(completion);
- }
+ public void addCompletion(String completion, boolean partial);
/**
* This method is called to register a completion than cannot be completed
@@ -64,53 +47,22 @@
*
* @param completion the completion string
*/
- public void addCompletion(String completion) {
- addCompletion(completion, false);
- }
+ public void addCompletion(String completion);
/**
* Retrieve the completion details.
*
* @return a TreeSet consisting of all possible completions
*/
- public SortedSet<String> getCompletions() {
- return completions == null ? NO_COMPLETIONS : completions;
- }
+ public SortedSet<String> getCompletions();
/**
- * Render for debug purposes
- */
- public String toString() {
- StringBuilder sb = new StringBuilder("CompletionInfo{");
- sb.append("competionStart=").append(completionStart);
- sb.append(",completions=");
- if (completions == null) {
- sb.append("null");
- } else {
- sb.append("{");
- boolean first = true;
- for (String completion : completions) {
- if (first) {
- first = false;
- } else {
- sb.append(",");
- }
- sb.append(completion);
- }
- sb.append("]");
- }
- return sb.toString();
- }
-
- /**
* The completion start is the offset in the original string of the first
* character to be replaced with the 'completed'.
*
* @return the completion start position, or <code>-1</code>
*/
- public int getCompletionStart() {
- return completionStart;
- }
+ public int getCompletionStart();
/**
* Set the completion start position. This can only be set once. After that,
@@ -118,15 +70,7 @@
*
* @param completionStart
*/
- public void setCompletionStart(int completionStart) {
- if (this.completionStart != completionStart) {
- if (this.completionStart != -1) {
- throw new IllegalArgumentException(
- "completionStart cannot be changed");
- }
- this.completionStart = completionStart;
- }
- }
+ public void setCompletionStart(int completionStart);
/**
* Get the combined completion string. If there are multiple alternatives,
@@ -136,31 +80,5 @@
*
* @return the combined completion, or <code>null</code>.
*/
- public String getCompletion() {
- if (completions == null) {
- return null;
- }
- int nos = completions.size();
- if (nos == 0) {
- return null;
- }
- if (nos == 1) {
- return completions.first();
- }
- String common = completions.first();
- for (String completion : completions) {
- if (common != completion && !completion.startsWith(common)) {
- for (int i = 0; i < common.length(); i++) {
- if (common.charAt(i) != completion.charAt(i)) {
- if (i == 0) {
- return null;
- }
- common = common.substring(0, i);
- break;
- }
- }
- }
- }
- return common;
- }
+ public String getCompletion();
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java 2008-08-24 11:38:12 UTC (rev 4492)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java 2008-08-24 14:03:04 UTC (rev 4493)
@@ -231,9 +231,9 @@
final int nbLines = (items.length / nbColumns) + (lastLineIsFull ? 0 : 1);
String[] lines = new String[nbLines];
- StringBuilder line = new StringBuilder(SCREEN_WIDTH);
int lineNum = 0;
for (int itemNum = 0; itemNum < items.length;) {
+ StringBuilder line = new StringBuilder(SCREEN_WIDTH);
for (int c = 0; c < nbColumns; c++) {
final String item = items[itemNum++];
line.append(item);
@@ -246,9 +246,7 @@
if (itemNum >= items.length) break;
}
-
lines[lineNum++] = line.toString();
- line.setLength(0); // clear the buffer
}
return lines;
Added: trunk/shell/src/shell/org/jnode/shell/CommandCompletions.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandCompletions.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/CommandCompletions.java 2008-08-24 14:03:04 UTC (rev 4493)
@@ -0,0 +1,190 @@
+/*
+ * $Id: CompletionInfo.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.shell;
+
+import java.util.Collections;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.jnode.driver.console.CompletionInfo;
+
+/**
+ * @author Ewout Prangsma (ep...@us...)
+ * @author cr...@jn...
+ */
+public class CommandCompletions implements CompletionInfo {
+ private static final SortedSet<String> NO_COMPLETIONS =
+ Collections.unmodifiableSortedSet(new TreeSet<String>());
+
+ private TreeSet<String> completions;
+
+ private int completionStart = -1;
+
+ private final CommandInterpreter interpreter;
+
+ /**
+ * Instantiate with a CommandInterpreter instance that will be used
+ * to escape shell meta-characters in the completions.
+ * @param interpreter the CommandInterpreter for escaping completions.
+ */
+ public CommandCompletions(CommandInterpreter interpreter) {
+ this.interpreter = interpreter;
+ }
+
+ /**
+ * Instantiate without a CommandInterpreter. Completions are captured
+ * as-is.
+ */
+ public CommandCompletions() {
+ this.interpreter = null;
+ }
+
+ /**
+ * This method is called to register a possible completion. A null or empty
+ * completion string will be quietly ignored.
+ *
+ * @param completion the completion string
+ * @param partial if <code>true</code>, further completions of the
+ * completion string may be possible.
+ */
+ public void addCompletion(String completion, boolean partial) {
+ if (completion == null || completion.length() == 0) {
+ return;
+ }
+ if (completions == null) {
+ completions = new TreeSet<String>();
+ }
+ if (interpreter != null) {
+ completion = interpreter.escapeWord(completion);
+ }
+ if (!partial) {
+ completion += ' ';
+ }
+ completions.add(completion);
+ }
+
+ /**
+ * This method is called to register a completion than cannot be completed
+ * further. A null or empty completion string will be quietly ignored.
+ *
+ * @param completion the completion string
+ */
+ public void addCompletion(String completion) {
+ addCompletion(completion, false);
+ }
+
+ /**
+ * Retrieve the completion details.
+ *
+ * @return a TreeSet consisting of all possible completions
+ */
+ public SortedSet<String> getCompletions() {
+ return completions == null ? NO_COMPLETIONS : completions;
+ }
+
+ /**
+ * Render for debug purposes
+ */
+ public String toString() {
+ StringBuilder sb = new StringBuilder("CompletionInfo{");
+ sb.append("competionStart=").append(completionStart);
+ sb.append(",completions=");
+ if (completions == null) {
+ sb.append("null");
+ } else {
+ sb.append("{");
+ boolean first = true;
+ for (String completion : completions) {
+ if (first) {
+ first = false;
+ } else {
+ sb.append(",");
+ }
+ sb.append(completion);
+ }
+ sb.append("]");
+ }
+ return sb.toString();
+ }
+
+ /**
+ * The completion start is the offset in the original string of the first
+ * character to be replaced with the 'completed'.
+ *
+ * @return the completion start position, or <code>-1</code>
+ */
+ public int getCompletionStart() {
+ return completionStart;
+ }
+
+ /**
+ * Set the completion start position. This can only be set once. After that,
+ * attempts to change the start position will throw {@link IllegalArgumentException}.
+ *
+ * @param completionStart
+ */
+ public void setCompletionStart(int completionStart) {
+ if (this.completionStart != completionStart) {
+ if (this.completionStart != -1) {
+ throw new IllegalArgumentException(
+ "completionStart cannot be changed");
+ }
+ this.completionStart = completionStart;
+ }
+ }
+
+ /**
+ * Get the combined completion string. If there are multiple alternatives,
+ * this will be the longest common left substring of the alternatives. If
+ * the substring is zero length, or if there were no alternatives in the
+ * first place, the result is <code>null</code>.
+ *
+ * @return the combined completion, or <code>null</code>.
+ */
+ public String getCompletion() {
+ if (completions == null) {
+ return null;
+ }
+ int nos = completions.size();
+ if (nos == 0) {
+ return null;
+ }
+ if (nos == 1) {
+ return completions.first();
+ }
+ String common = completions.first();
+ for (String completion : completions) {
+ if (common != completion && !completion.startsWith(common)) {
+ for (int i = 0; i < common.length(); i++) {
+ if (common.charAt(i) != completion.charAt(i)) {
+ if (i == 0) {
+ return null;
+ }
+ common = common.substring(0, i);
+ break;
+ }
+ }
+ }
+ }
+ return common;
+ }
+}
Modified: trunk/shell/src/shell/org/jnode/shell/CommandInterpreter.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandInterpreter.java 2008-08-24 11:38:12 UTC (rev 4492)
+++ trunk/shell/src/shell/org/jnode/shell/CommandInterpreter.java 2008-08-24 14:03:04 UTC (rev 4493)
@@ -64,4 +64,14 @@
* @return the name
*/
String getName();
+
+ /**
+ * Add escape sequences (or quotes) to protect any characters in the
+ * supplied word so that it can (for example) be appended to a partial
+ * command line by the completer.
+ *
+ * @param word the word to be escaped
+ * @return the word with any necessary escaping or quoting added.
+ */
+ String escapeWord(String word);
}
Modified: trunk/shell/src/shell/org/jnode/shell/CommandShell.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2008-08-24 11:38:12 UTC (rev 4492)
+++ trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2008-08-24 14:03:04 UTC (rev 4493)
@@ -613,7 +613,7 @@
public CompletionInfo complete(String partial) {
if (!readingCommand) {
// dummy completion behavior for application input.
- return new CompletionInfo();
+ return new CommandCompletions();
}
// workaround to set the currentShell to this shell
@@ -625,7 +625,7 @@
}
// do command completion
- completion = new CompletionInfo();
+ completion = new CommandCompletions(interpreter);
try {
Completable cl = parseCommandLine(partial);
if (cl != null) {
Modified: trunk/shell/src/shell/org/jnode/shell/DefaultInterpreter.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/DefaultInterpreter.java 2008-08-24 11:38:12 UTC (rev 4492)
+++ trunk/shell/src/shell/org/jnode/shell/DefaultInterpreter.java 2008-08-24 14:03:04 UTC (rev 4493)
@@ -128,7 +128,73 @@
res.setArgumentAnticipated(tokenizer.whitespaceAfterLast());
return res;
}
+
+ @Override
+ public String escapeWord(String word) {
+ return escapeWord(word, false);
+ }
+ protected String escapeWord(String word, boolean escapeRedirects) {
+ final int len = word.length();
+ StringBuilder sb = new StringBuilder(len);
+ for (int i = 0; i < len; i++) {
+ char ch = word.charAt(i);
+ switch (ch) {
+ case ESCAPE_B:
+ sb.append(ESCAPE_CHAR).append(B);
+ break;
+ case ESCAPE_N:
+ sb.append(ESCAPE_CHAR).append(N);
+ break;
+ case ESCAPE_R:
+ sb.append(ESCAPE_CHAR).append(R);
+ break;
+ case ESCAPE_T:
+ sb.append(ESCAPE_CHAR).append(T);
+ break;
+ case ESCAPE_CHAR:
+ sb.append(ESCAPE_CHAR).append(ESCAPE_CHAR);
+ break;
+ case FULL_ESCAPE_CHAR:
+ sb.append(ESCAPE_CHAR).append(FULL_ESCAPE_CHAR);
+ break;
+ case QUOTE_CHAR:
+ sb.append(ESCAPE_CHAR).append(QUOTE_CHAR);
+ break;
+ case COMMENT_CHAR:
+ sb.append(ESCAPE_CHAR).append(COMMENT_CHAR);
+ break;
+ case SPACE_CHAR:
+ sb.append(ESCAPE_CHAR).append(SPACE_CHAR);
+ break;
+ case PIPE_CHAR:
+ if (escapeRedirects) {
+ sb.append(ESCAPE_CHAR).append(PIPE_CHAR);
+ } else {
+ sb.append(PIPE_CHAR);
+ }
+ break;
+ case SEND_OUTPUT_TO_CHAR:
+ if (escapeRedirects) {
+ sb.append(ESCAPE_CHAR).append(SEND_OUTPUT_TO_CHAR);
+ } else {
+ sb.append(SEND_OUTPUT_TO_CHAR);
+ }
+ break;
+ case GET_INPUT_FROM_CHAR:
+ if (escapeRedirects) {
+ sb.append(ESCAPE_CHAR).append(GET_INPUT_FROM_CHAR);
+ } else {
+ sb.append(GET_INPUT_FROM_CHAR);
+ }
+ break;
+ default:
+ sb.append(ch);
+ }
+ }
+ return sb.toString();
+ }
+
/**
* A simple command line tokenizer for the 'built-in' interpreters. It
* understands quoting, some '\' escapes, and (depending on constructor
Modified: trunk/shell/src/shell/org/jnode/shell/RedirectingInterpreter.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/RedirectingInterpreter.java 2008-08-24 11:38:12 UTC (rev 4492)
+++ trunk/shell/src/shell/org/jnode/shell/RedirectingInterpreter.java 2008-08-24 14:03:04 UTC (rev 4493)
@@ -81,6 +81,11 @@
List<CommandDescriptor> commands = new LinkedList<CommandDescriptor>();
return parse(tokenizer, commands, true);
}
+
+ @Override
+ public String escapeWord(String word) {
+ return escapeWord(word, true);
+ }
/**
* This method parses the shell input into command lines. If we are completing,
Modified: trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneInterpreter.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneInterpreter.java 2008-08-24 11:38:12 UTC (rev 4492)
+++ trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneInterpreter.java 2008-08-24 14:03:04 UTC (rev 4493)
@@ -132,6 +132,12 @@
// TODO Auto-generated method stub
return null;
}
+
+ @Override
+ public String escapeWord(String word) {
+ // TODO Auto-generated method stub
+ return null;
+ }
int interpret(CommandShell shell, String command, OutputStream capture, boolean source)
throws ShellException {
Modified: trunk/shell/src/shell/org/jnode/shell/syntax/URLArgument.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/syntax/URLArgument.java 2008-08-24 11:38:12 UTC (rev 4492)
+++ trunk/shell/src/shell/org/jnode/shell/syntax/URLArgument.java 2008-08-24 14:03:04 UTC (rev 4493)
@@ -24,6 +24,7 @@
import java.net.URL;
import org.jnode.driver.console.CompletionInfo;
+import org.jnode.shell.CommandCompletions;
import org.jnode.shell.CommandLine.Token;
/**
@@ -71,7 +72,7 @@
(url.getQuery() == null || url.getQuery().length() == 0)) {
// Use a FileArgument to do the work of completing the pathname,
// capturing the results using our own CompletionInfo object.
- CompletionInfo myCompletion = new CompletionInfo();
+ CompletionInfo myCompletion = new CommandCompletions();
new FileArgument(null, getFlags()).complete(myCompletion, url.getPath());
// Then turn the completions back into "file:" URLs
for (String c : myCompletion.getCompletions()) {
Modified: trunk/shell/src/test/org/jnode/test/shell/CompletionInfoTest.java
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/CompletionInfoTest.java 2008-08-24 11:38:12 UTC (rev 4492)
+++ trunk/shell/src/test/org/jnode/test/shell/CompletionInfoTest.java 2008-08-24 14:03:04 UTC (rev 4493)
@@ -24,6 +24,7 @@
import java.util.SortedSet;
import junit.framework.TestCase;
import org.jnode.driver.console.CompletionInfo;
+import org.jnode.shell.CommandCompletions;
/**
* Test key methods of the CompletionInfo class.
@@ -33,11 +34,11 @@
public class CompletionInfoTest extends TestCase {
public void testConstructor() {
- new CompletionInfo();
+ new CommandCompletions();
}
public void testAddCompletion() {
- CompletionInfo ci = new CompletionInfo();
+ CompletionInfo ci = new CommandCompletions();
ci.addCompletion("full-1");
ci.addCompletion("full-2", false);
@@ -52,7 +53,7 @@
}
public void testSetCompletionStart() {
- CompletionInfo ci = new CompletionInfo();
+ CompletionInfo ci = new CommandCompletions();
assertEquals(-1, ci.getCompletionStart());
ci.setCompletionStart(-1);
assertEquals(-1, ci.getCompletionStart());
@@ -69,7 +70,7 @@
}
public void testGetCompletion() {
- CompletionInfo ci = new CompletionInfo();
+ CompletionInfo ci = new CommandCompletions();
assertEquals(null, ci.getCompletion());
ci.addCompletion("full-1");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-08-24 19:35:03
|
Revision: 4497
http://jnode.svn.sourceforge.net/jnode/?rev=4497&view=rev
Author: fduminy
Date: 2008-08-24 19:34:59 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
first version of jar packager tool. It allows easy testing of third party applications
Modified Paths:
--------------
trunk/all/build.xml
trunk/builder/src/builder/org/jnode/build/InitJarBuilder.java
trunk/builder/src/builder/org/jnode/build/InitJarsBuilder.java
trunk/builder/src/builder/org/jnode/build/PluginList.java
trunk/builder/src/builder/org/jnode/build/PluginTask.java
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2008-08-24 16:08:36 UTC (rev 4496)
+++ trunk/all/build.xml 2008-08-24 19:34:59 UTC (rev 4497)
@@ -223,7 +223,8 @@
<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}">
+ <plugin todir="${plugins.dir}" tmpdir="${build.dir}/tmp/plugins" pluginDir="${descriptors.dir}"
+ userApplicationsDir="${user.applications.dir}" userApplicationsProperty="userApplications">
<libalias name="jnode-core.jar" alias="${jnode-core.jar}"/>
<libalias name="jnode-distr.jar" alias="${jnode-distr.jar}"/>
<libalias name="jnode-fs.jar" alias="${jnode-fs.jar}"/>
@@ -294,7 +295,8 @@
<taskdef name="initjars" classname="org.jnode.build.InitJarsBuilder" classpathref="cp-jnode"/>
<initjars destdir="${initjars.dir}"
pluginDir="${plugins.dir}"
- systemPluginList="${basedir}/conf/system-plugin-list.xml">
+ systemPluginList="${basedir}/conf/system-plugin-list.xml"
+ userPlugins="${userApplications}">
<fileset dir="${basedir}/conf">
<exclude name="system-plugin-list.xml"/>
<include name="*plugin-list.xml"/>
Modified: trunk/builder/src/builder/org/jnode/build/InitJarBuilder.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/InitJarBuilder.java 2008-08-24 16:08:36 UTC (rev 4496)
+++ trunk/builder/src/builder/org/jnode/build/InitJarBuilder.java 2008-08-24 19:34:59 UTC (rev 4497)
@@ -47,6 +47,8 @@
private File destDir;
private File destFile;
+
+ private String userPlugins;
public void execute() throws BuildException {
@@ -57,6 +59,11 @@
final long lmPI;
try {
piList = getPluginList();
+
+ if ((userPlugins != null) && !userPlugins.isEmpty()) {
+ piList.processUserPlugins(userPlugins);
+ }
+
systemPluginList = getSystemPluginList();
if ((destFile == null) && (destDir != null)) {
destFile = new File(destDir, piList.getName() + ".jgz");
@@ -281,4 +288,8 @@
public final void setDestDir(File destDir) {
this.destDir = destDir;
}
+
+ public void setUserPlugins(String userPlugins) {
+ this.userPlugins = userPlugins;
+ }
}
Modified: trunk/builder/src/builder/org/jnode/build/InitJarsBuilder.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/InitJarsBuilder.java 2008-08-24 16:08:36 UTC (rev 4496)
+++ trunk/builder/src/builder/org/jnode/build/InitJarsBuilder.java 2008-08-24 19:34:59 UTC (rev 4497)
@@ -42,7 +42,9 @@
private final ArrayList<FileSet> fileSets = new ArrayList<FileSet>();
private File pluginDir;
private File systemPluginListFile;
-
+
+ private String userPlugins;
+
/**
* Add a fileset to this task.
*
@@ -72,6 +74,11 @@
builder.setSystemPluginList(systemPluginListFile);
builder.setPluginList(listFile);
builder.setDestDir(getDestDir());
+
+ // FIXME we should put the plugin list ("full-plugin-list.xml") outside
+ if (listFiles[j].equals("full-plugin-list.xml") && (userPlugins != null)) {
+ builder.setUserPlugins(userPlugins);
+ }
builder.execute();
}
@@ -120,5 +127,8 @@
public final void setSystemPluginList(File systemPluginListFile) {
this.systemPluginListFile = systemPluginListFile;
}
-
+
+ public void setUserPlugins(String userPlugins) {
+ this.userPlugins = userPlugins;
+ }
}
Modified: trunk/builder/src/builder/org/jnode/build/PluginList.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/PluginList.java 2008-08-24 16:08:36 UTC (rev 4496)
+++ trunk/builder/src/builder/org/jnode/build/PluginList.java 2008-08-24 19:34:59 UTC (rev 4497)
@@ -33,9 +33,10 @@
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
-import org.jnode.nanoxml.XMLElement;
+
import org.apache.tools.ant.taskdefs.Manifest;
import org.apache.tools.ant.taskdefs.ManifestException;
+import org.jnode.nanoxml.XMLElement;
import org.jnode.plugin.PluginException;
/**
@@ -43,12 +44,12 @@
*/
public final class PluginList {
- private final URL[] descrList;
+ private final List<URL> descrList;
- private final URL[] pluginList;
+ private final List<URL> pluginList;
private final String name;
-
+
private Manifest manifest;
private List<PluginList> includes = new ArrayList<PluginList>();
@@ -58,8 +59,8 @@
public PluginList(File file, File defaultDir, String targetArch)
throws PluginException, MalformedURLException {
this.defaultDir = defaultDir;
- final ArrayList<URL> descrList = new ArrayList<URL>();
- final ArrayList<URL> pluginList = new ArrayList<URL>();
+ descrList = new ArrayList<URL>();
+ pluginList = new ArrayList<URL>();
final XMLElement root = new XMLElement(new Hashtable(), true, false);
try {
final FileReader r = new FileReader(file);
@@ -86,24 +87,12 @@
if (e.getName().equals("plugin")) {
final String id = e.getStringAttribute("id");
- final URL descrUrl;
- final URL pluginUrl;
- if (id != null) {
- File f = findPlugin(defaultDir, id);
- pluginUrl = f.toURL();
- descrUrl = new URL("jar:" + pluginUrl + "!/plugin.xml");
- } else {
+ if (id == null) {
throw new PluginException("id attribute expected on "
+ e.getName());
}
- if (pluginList.contains(pluginUrl)) {
- throw new PluginException("can't use the same id(" + id
- + ") for multiple plugins");
- }
-
- descrList.add(descrUrl);
- pluginList.add(pluginUrl);
+ addPlugin(descrList, pluginList, id);
} else if (e.getName().equals("manifest")) {
manifest = parseManifest(e);
} else if (e.getName().equals("include")) {
@@ -113,11 +102,22 @@
throw new PluginException("Unknown element " + e.getName());
}
}
- this.descrList = descrList.toArray(new URL[descrList.size()]);
- this.pluginList = pluginList
- .toArray(new URL[pluginList.size()]);
}
+
+ private void addPlugin(List<URL> descrList, List<URL> pluginList, String id)
+ throws MalformedURLException, PluginException {
+ final File f = findPlugin(defaultDir, id);
+ final URL pluginUrl = f.toURL();
+ final URL descrUrl = new URL("jar:" + pluginUrl + "!/plugin.xml");
+ if (pluginList.contains(pluginUrl)) {
+ throw new PluginException("can't use the same id(" + id + ") for multiple plugins");
+ }
+
+ descrList.add(descrUrl);
+ pluginList.add(pluginUrl);
+ }
+
private File findPlugin(File dir, final String id) {
// System.out.println("Find " + id + " in " + dir);
String[] names = dir.list(new FilenameFilter() {
@@ -181,8 +181,8 @@
}
}
- descrList.addAll(Arrays.asList(inc.descrList));
- pluginList.addAll(Arrays.asList(inc.pluginList));
+ descrList.addAll(inc.descrList);
+ pluginList.addAll(inc.pluginList);
}
/**
@@ -193,8 +193,8 @@
*/
public long lastModified() throws IOException {
long max = 0;
- for (int i = 0; i < descrList.length; i++) {
- final URLConnection conn2 = pluginList[i].openConnection();
+ for (URL url : descrList) {
+ final URLConnection conn2 = url.openConnection();
max = Math.max(max, conn2.getLastModified());
}
for (PluginList inc : includes) {
@@ -209,7 +209,7 @@
* @return URL[]
*/
public URL[] getDescriptorUrlList() {
- return descrList;
+ return descrList.toArray(new URL[descrList.size()]);
}
/**
@@ -218,7 +218,7 @@
* @return URL[]
*/
public URL[] getPluginList() {
- return pluginList;
+ return pluginList.toArray(new URL[pluginList.size()]);
}
/**
@@ -245,4 +245,17 @@
throw new RuntimeException(e);
}
}
+
+ /**
+ * Add user plugins to the list
+ * @param userPlugins
+ * @throws MalformedURLException
+ * @throws PluginException
+ */
+ public void processUserPlugins(String userPlugins) throws MalformedURLException, PluginException {
+ for (String pluginId : userPlugins.split(",")) {
+ System.out.println("Adding user plugin " + pluginId);
+ addPlugin(descrList, pluginList, pluginId);
+ }
+ }
}
Modified: trunk/builder/src/builder/org/jnode/build/PluginTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/PluginTask.java 2008-08-24 16:08:36 UTC (rev 4496)
+++ trunk/builder/src/builder/org/jnode/build/PluginTask.java 2008-08-24 19:34:59 UTC (rev 4497)
@@ -24,15 +24,27 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
+import java.io.FilenameFilter;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
@@ -40,6 +52,7 @@
import org.apache.tools.ant.taskdefs.Manifest;
import org.apache.tools.ant.taskdefs.ManifestException;
import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.ZipFileSet;
import org.apache.tools.ant.util.FileUtils;
import org.jnode.nanoxml.XMLElement;
@@ -57,6 +70,9 @@
private File todir;
private File tmpDir = new File(System.getProperty("java.io.tmpdir"));
+ private File userApplicationsDir;
+ private String userApplicationsProperty;
+
public ZipFileSet createDescriptors() {
final ZipFileSet fs = new ZipFileSet();
descriptorSets.add(fs);
@@ -86,6 +102,7 @@
int max_thread_count = 10;
int max_plugin_count = 500;
+ StringBuilder userPlugins = new StringBuilder();
final AtomicBoolean failure = new AtomicBoolean(false);
ThreadPoolExecutor executor = new ThreadPoolExecutor(max_thread_count, max_thread_count, 60, TimeUnit.SECONDS,
@@ -93,7 +110,6 @@
@Override
protected void afterExecute(Runnable r, Throwable t) {
if (t != null) {
- // at least one plugin task failed
failure.set(true);
}
}
@@ -111,6 +127,21 @@
});
}
}
+ if ((userApplicationsDir != null) && userApplicationsDir.exists() && userApplicationsDir.isDirectory()) {
+ File[] userJars = userApplicationsDir.listFiles(new FilenameFilter() {
+
+ @Override
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar");
+ }
+
+ });
+
+ for (File userJar : userJars) {
+ processUserJar(executor, descriptors, userJar, userPlugins);
+ }
+ }
+
executor.shutdown();
try {
executor.awaitTermination(10, TimeUnit.MINUTES);
@@ -121,8 +152,218 @@
if (failure.get()) {
throw new RuntimeException("At least one plugin task failed : see above errors");
}
+
+ // that must be called after completion of all plugin tasks
+ if ((userPlugins.length() > 0) && (userPlugins.charAt(userPlugins.length() - 1) == ',')) {
+ userPlugins.deleteCharAt(userPlugins.length() - 1);
+ }
+ getProject().setProperty(userApplicationsProperty, userPlugins.toString());
}
+
+ /**
+ * Attention : userPluginList must be a StringBuilder because it's accessed from multiple threads
+ * @param executor
+ * @param descriptors
+ * @param userJar
+ * @param userPluginList
+ */
+ private void processUserJar(ExecutorService executor, final Map<String, File> descriptors, final File userJar,
+ final StringBuilder userPluginList) {
+ executor.execute(new Runnable() {
+ public void run() {
+ final String jarName = userJar.getName();
+ final String pluginId = jarName.substring(0, jarName.length() - 4); // remove ".jar"
+
+ userPluginList.append(pluginId + ",");
+
+ // replace ".jar" by ".xml"
+ final String pluginDesc = pluginId + ".xml";
+
+ // FIXME remove the explicit reference to "cp"
+ // add user jar to path named "cp" (used in build.xml)
+ Path path = (Path) getProject().getReference("cp");
+ path.createPathElement().setLocation(userJar);
+
+ // create the lib alias
+ final String alias = pluginId + ".jar";
+ LibAlias libAlias = createLibAlias();
+ libAlias.setName(alias);
+ libAlias.setAlias(userJar);
+
+ final File descriptorFile = new File(userJar.getParent(), pluginDesc);
+ if (!descriptorFile.exists()) {
+ // build the descriptor from scratch
+ buildDescriptor(userJar, descriptorFile, pluginId, alias);
+ }
+
+ buildPlugin(descriptors, descriptorFile);
+ }
+ });
+ }
+ private void buildDescriptor(File userJar, File descriptorFile, String pluginId, String alias) {
+ PrintStream out = null;
+ try {
+ out = new PrintStream(descriptorFile);
+
+ out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ out.println("<!DOCTYPE plugin SYSTEM \"jnode.dtd\">");
+
+ out.println("<plugin id=\"" + pluginId + "\"");
+ out.println(" name=\"" + pluginId + "\"");
+ out.println(" version=\"\"");
+ out.println(" license-name=\"unspecified\">");
+
+ out.println(" <runtime>");
+ out.println(" <library name=\"" + alias + "\">");
+ out.println(" <export name=\"*\"/>");
+ out.println(" </library>");
+ out.println(" </runtime>");
+
+ List<String> mainClasses = searchMain(userJar);
+ if (!mainClasses.isEmpty()) {
+ out.println(" <extension point=\"org.jnode.shell.aliases\">");
+ for (String mainClass : mainClasses) {
+ int idx = mainClass.lastIndexOf('.');
+ String name = (idx < 0) ? mainClass : mainClass.substring(idx + 1);
+ out.println(" <alias name=\"" + name + "\" class=\"" + mainClass + "\"/>");
+ System.out.println(pluginId + " : added alias " + name + " for class " + mainClass);
+ }
+
+ out.println(" </extension>");
+ } else {
+ System.err.println("WARNING : no main found for plugin " + pluginId);
+ }
+
+ // FIXME using AllPermission is bad ! we must avoid that
+ out.println(" <extension point=\"org.jnode.security.permissions\">");
+ out.println(" <permission class=\"java.security.AllPermission\" />");
+ out.println(" </extension>");
+
+ out.println("</plugin>");
+ } catch (IOException ioe) {
+ throw new BuildException(ioe);
+ } finally {
+ if (out != null) {
+ out.close();
+ }
+ }
+ }
+
+ private List<String> searchMain(File userJar) throws FileNotFoundException, IOException {
+ List<String> mainList = new ArrayList<String>();
+
+ JarFile jarFile = null;
+ try {
+ jarFile = new JarFile(userJar);
+
+ // try to find the main class from the manifest
+ Object value = jarFile.getManifest().getMainAttributes().get(Attributes.Name.MAIN_CLASS);
+ if (value == null) {
+ String name = Attributes.Name.MAIN_CLASS.toString();
+ value = jarFile.getManifest().getAttributes(name).get(Attributes.Name.MAIN_CLASS);
+ }
+
+ if (value != null) {
+ mainList.add(String.valueOf(value));
+ } else {
+ // scan the jar to find the main classes
+ for (Enumeration<JarEntry> e = jarFile.entries(); e.hasMoreElements(); ) {
+ final JarEntry entry = e.nextElement();
+ final String name = entry.getName();
+ InputStream is = null;
+
+ try {
+ if (name.endsWith(".class")) {
+ String className = name.substring(0, name.length() - ".class".length());
+ className = className.replace('/', '.');
+
+ is = jarFile.getInputStream(entry);
+ ClassLoader cl = new InputStreamLoader(is, (int) entry.getSize());
+ Class<?> clazz = Class.forName(className, false, cl);
+ Method m = clazz.getMethod("main", new Class<?>[]{String[].class});
+ if ((m.getModifiers() & Modifier.STATIC) == Modifier.STATIC) {
+ mainList.add(className);
+ }
+ }
+ } catch (ClassNotFoundException cnfe) {
+ cnfe.printStackTrace();
+ // ignore
+ } catch (SecurityException se) {
+ se.printStackTrace();
+ // ignore
+ } catch (NoSuchMethodException nsme) {
+ // such error is expected for non-main classes => ignore
+ } catch (Throwable t) {
+ t.printStackTrace();
+ // ignore
+ } finally {
+ if (is != null) {
+ is.close();
+ }
+ }
+ }
+ }
+ } finally {
+ if (jarFile != null) {
+ jarFile.close();
+ }
+ }
+
+ return mainList;
+ }
+
+ private static class InputStreamLoader extends ClassLoader {
+ private InputStream inputStream;
+ private int size;
+
+ public InputStreamLoader(InputStream inputStream, int size) {
+ this.inputStream = inputStream;
+ this.size = size;
+ }
+
+ public Class loadClass(String className) throws ClassNotFoundException {
+ return loadClass(className, true);
+ }
+
+ public synchronized Class loadClass(String className, boolean resolve)
+ throws ClassNotFoundException {
+ Class<?> result;
+
+ try {
+
+ result = super.findSystemClass(className);
+
+ } catch (ClassNotFoundException e) {
+ byte[] classData = null;
+
+ try {
+ classData = new byte[size];
+ inputStream.read(classData);
+ } catch (IOException ioe) {
+ throw new ClassNotFoundException(className, ioe);
+ }
+
+ if (classData == null) {
+ throw new ClassNotFoundException(className);
+ }
+
+ result = defineClass(className, classData, 0, classData.length);
+
+ if (result == null) {
+ throw new ClassFormatError();
+ }
+
+ if (resolve) {
+ resolveClass(result);
+ }
+ }
+
+ return result;
+ }
+ }
+
+
/**
* @param descriptors map of fullPluginId to File descriptor
* @param descriptor the plugin descriptor XML
@@ -239,4 +480,17 @@
this.tmpDir = tmpDir;
}
+ /**
+ * @param file
+ */
+ public void setUserApplicationsDir(File file) {
+ userApplicationsDir = file;
+ }
+
+ /**
+ * @param file
+ */
+ public void setUserApplicationsProperty(String name) {
+ userApplicationsProperty = name;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-25 20:26:26
|
Revision: 4504
http://jnode.svn.sourceforge.net/jnode/?rev=4504&view=rev
Author: lsantha
Date: 2008-08-25 20:19:53 +0000 (Mon, 25 Aug 2008)
Log Message:
-----------
Added support for running ${java.home}/jnode.ini one time in the shell after JNode startup.
Modified Paths:
--------------
trunk/all/conf/default-plugin-list.xml
trunk/all/conf/full-plugin-list.xml
trunk/all/conf/tests-plugin-list.xml
trunk/shell/src/shell/org/jnode/shell/CommandShell.java
Modified: trunk/all/conf/default-plugin-list.xml
===================================================================
--- trunk/all/conf/default-plugin-list.xml 2008-08-25 20:11:10 UTC (rev 4503)
+++ trunk/all/conf/default-plugin-list.xml 2008-08-25 20:19:53 UTC (rev 4504)
@@ -7,6 +7,7 @@
<plugin-list name="default">
<manifest>
<attribute key="Main-Class" value="org.jnode.shell.CommandShell"/>
+ <attribute key="Main-Class-Arg" value="boot"/>
</manifest>
<plugin id="org.jnode.work"/>
Modified: trunk/all/conf/full-plugin-list.xml
===================================================================
--- trunk/all/conf/full-plugin-list.xml 2008-08-25 20:11:10 UTC (rev 4503)
+++ trunk/all/conf/full-plugin-list.xml 2008-08-25 20:19:53 UTC (rev 4504)
@@ -3,6 +3,7 @@
<plugin-list name="full">
<manifest>
<attribute key="Main-Class" value="org.jnode.shell.CommandShell"/>
+ <attribute key="Main-Class-Arg" value="boot"/>
</manifest>
<include file="default-plugin-list.xml"/>
Modified: trunk/all/conf/tests-plugin-list.xml
===================================================================
--- trunk/all/conf/tests-plugin-list.xml 2008-08-25 20:11:10 UTC (rev 4503)
+++ trunk/all/conf/tests-plugin-list.xml 2008-08-25 20:19:53 UTC (rev 4504)
@@ -3,6 +3,7 @@
<plugin-list name="tests">
<manifest>
<attribute key="Main-Class" value="org.jnode.shell.CommandShell"/>
+ <attribute key="Main-Class-Arg" value="boot"/>
</manifest>
<include file="full-plugin-list.xml"/>
Modified: trunk/shell/src/shell/org/jnode/shell/CommandShell.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2008-08-25 20:11:10 UTC (rev 4503)
+++ trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2008-08-25 20:19:53 UTC (rev 4504)
@@ -78,7 +78,8 @@
public static final String HISTORY_PROPERTY_NAME = "jnode.history";
public static final String HISTORY_DEFAULT = "true";
- public static final String HOME_PROPERTY_NAME = "user.home";
+ public static final String USER_HOME_PROPERTY_NAME = "user.home";
+ public static final String JAVA_HOME_PROPERTY_NAME = "java.home";
public static final String DIRECTORY_PROPERTY_NAME = "user.dir";
public static final String INITIAL_INVOKER = "proclet";
@@ -161,6 +162,8 @@
private Thread ownThread;
+ private boolean bootShell;
+
public TextConsole getConsole() {
return console;
}
@@ -168,6 +171,12 @@
public static void main(String[] args)
throws NameNotFoundException, ShellException {
CommandShell shell = new CommandShell();
+ for (String arg : args) {
+ if ("boot".equals(arg)) {
+ shell.bootShell = true;
+ break;
+ }
+ }
shell.run();
}
@@ -274,18 +283,34 @@
}
}
- final String user_home = System.getProperty(HOME_PROPERTY_NAME, "");
+ if (bootShell) {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
+ final String java_home = System.getProperty(JAVA_HOME_PROPERTY_NAME, "");
+ final File jnode_ini = new File(java_home + "/jnode.ini");
+ try {
+ if (jnode_ini.exists()) {
+ runCommandFile(jnode_ini);
+ }
+ } catch (IOException ex) {
+ errPs.println("Error while reading " + jnode_ini + ": " + ex.getMessage());
+ stackTrace(ex);
+ }
+ return null;
+ }
+ });
+ }
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
+ final String user_home = System.getProperty(USER_HOME_PROPERTY_NAME, "");
final File shell_ini = new File(user_home + "/shell.ini");
try {
if (shell_ini.exists()) {
runCommandFile(shell_ini);
}
} catch (IOException ex) {
- errPs.println("Error while reading " + shell_ini + ": "
- + ex.getMessage());
+ errPs.println("Error while reading " + shell_ini + ": " + ex.getMessage());
stackTrace(ex);
}
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-27 10:33:35
|
Revision: 4517
http://jnode.svn.sourceforge.net/jnode/?rev=4517&view=rev
Author: lsantha
Date: 2008-08-27 10:33:31 +0000 (Wed, 27 Aug 2008)
Log Message:
-----------
Added support for configuring securty during build.
Modified Paths:
--------------
trunk/core/build.xml
trunk/core/src/core/org/jnode/security/JNodeSecurityManager.java
trunk/jnode.properties.dist
Added Paths:
-----------
trunk/core/src/template/org/jnode/security/
trunk/core/src/template/org/jnode/security/JNodeSecurityManagerSettings.java
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2008-08-26 21:10:56 UTC (rev 4516)
+++ trunk/core/build.xml 2008-08-27 10:33:31 UTC (rev 4517)
@@ -117,6 +117,10 @@
<token name="@java.io.tmpdir@" value="${jnode.java.io.tmpdir}"/>
<token name="@user.home@" value="${jnode.user.home}"/>
</template>
+ <template file="${my-src.dir}/template/org/jnode/security/JNodeSecurityManagerSettings.java"
+ tofile="${my-gen.dir}/org/jnode/security/JNodeSecurityManagerSettings.java">
+ <token name="@jnode.security.enabled@" value="${jnode.security.enabled}"/>
+ </template>
</target>
<!-- Compile all subproject java files -->
Modified: trunk/core/src/core/org/jnode/security/JNodeSecurityManager.java
===================================================================
--- trunk/core/src/core/org/jnode/security/JNodeSecurityManager.java 2008-08-26 21:10:56 UTC (rev 4516)
+++ trunk/core/src/core/org/jnode/security/JNodeSecurityManager.java 2008-08-27 10:33:31 UTC (rev 4517)
@@ -36,12 +36,13 @@
*/
@Override
public void checkPermission(Permission perm) {
+ JNodeSecurityManagerSettings.checkPermission(perm, this);
+ }
+ void defaultCheckPermission(Permission perm) {
if (perm.implies(SET_SECURITY_MANAGER)) {
throw new SecurityException("Cannot override security manager");
}
super.checkPermission(perm);
-
}
-
}
Added: trunk/core/src/template/org/jnode/security/JNodeSecurityManagerSettings.java
===================================================================
--- trunk/core/src/template/org/jnode/security/JNodeSecurityManagerSettings.java (rev 0)
+++ trunk/core/src/template/org/jnode/security/JNodeSecurityManagerSettings.java 2008-08-27 10:33:31 UTC (rev 4517)
@@ -0,0 +1,19 @@
+package org.jnode.security;
+
+import java.security.Permission;
+
+/**
+ * @author Levente S\u00e1ntha
+ */
+public class JNodeSecurityManagerSettings {
+ private static final boolean ENABLED = false;
+ static void checkPermission(Permission perm, JNodeSecurityManager sm) {
+ boolean enabled = true;
+ if (ENABLED) {
+ enabled = Boolean.valueOf("@jnode.security.enabled@");
+ }
+ if (enabled){
+ sm.defaultCheckPermission(perm);
+ }
+ }
+}
Modified: trunk/jnode.properties.dist
===================================================================
--- trunk/jnode.properties.dist 2008-08-26 21:10:56 UTC (rev 4516)
+++ trunk/jnode.properties.dist 2008-08-27 10:33:31 UTC (rev 4517)
@@ -97,3 +97,9 @@
jnode.java.home=/jnode
jnode.java.io.tmpdir=/jnode/tmp
jnode.user.home=/jnode/home
+
+# -----------------------------------------------
+# Enable or disable security under JNode
+# -----------------------------------------------
+
+#jnode.security.enabled=true
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-08-31 16:51:37
|
Revision: 4520
http://jnode.svn.sourceforge.net/jnode/?rev=4520&view=rev
Author: fduminy
Date: 2008-08-31 16:51:31 +0000 (Sun, 31 Aug 2008)
Log Message:
-----------
defined plugin org.jnode.work as a system plugin so that it can be used by other system plugins
Modified Paths:
--------------
trunk/all/conf/default-plugin-list.xml
trunk/all/conf/install-plugin-list_disabled.xml
trunk/all/conf/shell-plugin-list.xml
trunk/all/conf/system-plugin-list.xml
trunk/core/descriptors/org.jnode.work.xml
Modified: trunk/all/conf/default-plugin-list.xml
===================================================================
--- trunk/all/conf/default-plugin-list.xml 2008-08-31 09:19:08 UTC (rev 4519)
+++ trunk/all/conf/default-plugin-list.xml 2008-08-31 16:51:31 UTC (rev 4520)
@@ -10,7 +10,6 @@
<attribute key="Main-Class-Arg" value="boot"/>
</manifest>
- <plugin id="org.jnode.work"/>
<plugin id="org.jnode.driver"/>
<plugin id="org.jnode.driver.block"/>
<plugin id="org.jnode.partitions"/>
Modified: trunk/all/conf/install-plugin-list_disabled.xml
===================================================================
--- trunk/all/conf/install-plugin-list_disabled.xml 2008-08-31 09:19:08 UTC (rev 4519)
+++ trunk/all/conf/install-plugin-list_disabled.xml 2008-08-31 16:51:31 UTC (rev 4520)
@@ -91,8 +91,6 @@
<plugin id="org.acplt.oncrpc"/>
- <plugin id="org.jnode.work"/>
-
<plugin id="charva"/>
<plugin id="org.jnode.shell"/>
</plugin-list>
Modified: trunk/all/conf/shell-plugin-list.xml
===================================================================
--- trunk/all/conf/shell-plugin-list.xml 2008-08-31 09:19:08 UTC (rev 4519)
+++ trunk/all/conf/shell-plugin-list.xml 2008-08-31 16:51:31 UTC (rev 4520)
@@ -4,7 +4,6 @@
<attribute key="Main-Class" value="org.jnode.shell.CommandShell"/>
</manifest>
- <plugin id="org.jnode.work"/>
<plugin id="org.jnode.driver"/>
<plugin id="org.jnode.driver.block"/>
<plugin id="org.jnode.partitions"/>
Modified: trunk/all/conf/system-plugin-list.xml
===================================================================
--- trunk/all/conf/system-plugin-list.xml 2008-08-31 09:19:08 UTC (rev 4519)
+++ trunk/all/conf/system-plugin-list.xml 2008-08-31 16:51:31 UTC (rev 4520)
@@ -16,8 +16,8 @@
<plugin id="org.jnode.util"/>
<plugin id="org.jnode.vm"/>
<plugin id="org.jnode.vm.core"/>
+ <plugin id="org.jnode.work"/>
-
<!--
Plugins needed for setting up
Modified: trunk/core/descriptors/org.jnode.work.xml
===================================================================
--- trunk/core/descriptors/org.jnode.work.xml 2008-08-31 09:19:08 UTC (rev 4519)
+++ trunk/core/descriptors/org.jnode.work.xml 2008-08-31 16:51:31 UTC (rev 4520)
@@ -4,6 +4,7 @@
<plugin id="org.jnode.work"
name="JNode Work management"
version="@VERSION@"
+ system="true"
provider-name="JNode.org"
license-name="lgpl"
class="org.jnode.work.WorkPlugin">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-08-31 18:12:27
|
Revision: 4522
http://jnode.svn.sourceforge.net/jnode/?rev=4522&view=rev
Author: fduminy
Date: 2008-08-31 18:12:16 +0000 (Sun, 31 Aug 2008)
Log Message:
-----------
jar packager tool :
- refactored for better separation with regular build
- now, each sub directory can be packaged as a jnode plugin, which will be automatically unzipped to a directory
Modified Paths:
--------------
trunk/all/build.xml
trunk/builder/build.xml
trunk/builder/src/builder/org/jnode/build/AbstractPluginsTask.java
trunk/builder/src/builder/org/jnode/build/InitJarBuilder.java
trunk/builder/src/builder/org/jnode/build/InitJarsBuilder.java
trunk/builder/src/builder/org/jnode/build/PluginList.java
trunk/builder/src/builder/org/jnode/build/PluginTask.java
Added Paths:
-----------
trunk/builder/src/builder/org/jnode/build/packager/
trunk/builder/src/builder/org/jnode/build/packager/PackagerTask.java
trunk/builder/src/builder/org/jnode/build/packager/PluginBuilder.java
trunk/builder/src/builder/org/jnode/build/packager/PluginListInsertor.java
trunk/builder/src/builder/org/jnode/build/packager/plugins.properties
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2008-08-31 16:58:22 UTC (rev 4521)
+++ trunk/all/build.xml 2008-08-31 18:12:16 UTC (rev 4522)
@@ -223,8 +223,9 @@
<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}"
- userApplicationsDir="${user.applications.dir}" userApplicationsProperty="userApplications">
+ <plugin todir="${plugins.dir}" tmpdir="${build.dir}/tmp/plugins" pluginDir="${descriptors.dir}">
+ <packager userApplicationsDir="${user.applications.dir}" pathRefId="cp"/>
+
<libalias name="jnode-core.jar" alias="${jnode-core.jar}"/>
<libalias name="jnode-distr.jar" alias="${jnode-distr.jar}"/>
<libalias name="jnode-fs.jar" alias="${jnode-fs.jar}"/>
@@ -295,8 +296,9 @@
<taskdef name="initjars" classname="org.jnode.build.InitJarsBuilder" classpathref="cp-jnode"/>
<initjars destdir="${initjars.dir}"
pluginDir="${plugins.dir}"
- systemPluginList="${basedir}/conf/system-plugin-list.xml"
- userPlugins="${userApplications}">
+ systemPluginList="${basedir}/conf/system-plugin-list.xml">
+ <insert userApplicationsDir="${user.applications.dir}"/>
+
<fileset dir="${basedir}/conf">
<exclude name="system-plugin-list.xml"/>
<include name="*plugin-list.xml"/>
Modified: trunk/builder/build.xml
===================================================================
--- trunk/builder/build.xml 2008-08-31 16:58:22 UTC (rev 4521)
+++ trunk/builder/build.xml 2008-08-31 18:12:16 UTC (rev 4522)
@@ -26,6 +26,10 @@
<mkdir dir="${my-classes.dir}"/>
<mkdir dir="${jnasm-preprocessor-gen.dir}"/>
<mkdir dir="${jnasm-assembler-gen.dir}"/>
+
+ <copy todir="${my-classes.dir}">
+ <fileset dir="${my-src.dir}/builder" includes="**/*.properties"/>
+ </copy>
</target>
<!-- Compile the Template ANT task needed for compiling the core -->
Modified: trunk/builder/src/builder/org/jnode/build/AbstractPluginsTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/AbstractPluginsTask.java 2008-08-31 16:58:22 UTC (rev 4521)
+++ trunk/builder/src/builder/org/jnode/build/AbstractPluginsTask.java 2008-08-31 18:12:16 UTC (rev 4522)
@@ -51,7 +51,7 @@
* @throws PluginException
* @throws MalformedURLException
*/
- protected PluginList getPluginList() throws PluginException,
+ public PluginList getPluginList() throws PluginException,
MalformedURLException {
if (pluginList == null) {
pluginList = new PluginList(pluginListFile, pluginDir, targetArch);
Modified: trunk/builder/src/builder/org/jnode/build/InitJarBuilder.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/InitJarBuilder.java 2008-08-31 16:58:22 UTC (rev 4521)
+++ trunk/builder/src/builder/org/jnode/build/InitJarBuilder.java 2008-08-31 18:12:16 UTC (rev 4522)
@@ -29,11 +29,13 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.GZip;
import org.apache.tools.ant.taskdefs.Jar;
import org.apache.tools.ant.taskdefs.Manifest;
import org.apache.tools.ant.types.FileSet;
+import org.jnode.build.packager.PluginListInsertor;
import org.jnode.plugin.PluginDescriptor;
import org.jnode.plugin.PluginException;
import org.jnode.plugin.PluginPrerequisite;
@@ -48,7 +50,7 @@
private File destFile;
- private String userPlugins;
+ private PluginListInsertor insertor;
public void execute() throws BuildException {
@@ -59,11 +61,11 @@
final long lmPI;
try {
piList = getPluginList();
-
- if ((userPlugins != null) && !userPlugins.isEmpty()) {
- piList.processUserPlugins(userPlugins);
+
+ if (insertor != null) {
+ insertor.insertInto(piList);
}
-
+
systemPluginList = getSystemPluginList();
if ((destFile == null) && (destDir != null)) {
destFile = new File(destDir, piList.getName() + ".jgz");
@@ -289,7 +291,7 @@
this.destDir = destDir;
}
- public void setUserPlugins(String userPlugins) {
- this.userPlugins = userPlugins;
+ public void setPackager(PluginListInsertor insertor) {
+ this.insertor = insertor;
}
}
Modified: trunk/builder/src/builder/org/jnode/build/InitJarsBuilder.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/InitJarsBuilder.java 2008-08-31 16:58:22 UTC (rev 4521)
+++ trunk/builder/src/builder/org/jnode/build/InitJarsBuilder.java 2008-08-31 18:12:16 UTC (rev 4522)
@@ -23,10 +23,12 @@
import java.io.File;
import java.util.ArrayList;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
+import org.jnode.build.packager.PluginListInsertor;
/**
* Task used to build several initjars.
@@ -43,7 +45,7 @@
private File pluginDir;
private File systemPluginListFile;
- private String userPlugins;
+ private PluginListInsertor insertor;
/**
* Add a fileset to this task.
@@ -75,9 +77,8 @@
builder.setPluginList(listFile);
builder.setDestDir(getDestDir());
- // FIXME we should put the plugin list ("full-plugin-list.xml") outside
- if (listFiles[j].equals("full-plugin-list.xml") && (userPlugins != null)) {
- builder.setUserPlugins(userPlugins);
+ if (insertor != null) {
+ builder.setPackager(insertor);
}
builder.execute();
@@ -128,7 +129,9 @@
this.systemPluginListFile = systemPluginListFile;
}
- public void setUserPlugins(String userPlugins) {
- this.userPlugins = userPlugins;
+ public PluginListInsertor createInsert() {
+ insertor = new PluginListInsertor();
+ insertor.setProject(getProject());
+ return insertor;
}
}
Modified: trunk/builder/src/builder/org/jnode/build/PluginList.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/PluginList.java 2008-08-31 16:58:22 UTC (rev 4521)
+++ trunk/builder/src/builder/org/jnode/build/PluginList.java 2008-08-31 18:12:16 UTC (rev 4522)
@@ -104,6 +104,10 @@
}
}
+ public void addPlugin(String id) throws MalformedURLException, PluginException {
+ addPlugin(descrList, pluginList, id);
+ }
+
private void addPlugin(List<URL> descrList, List<URL> pluginList, String id)
throws MalformedURLException, PluginException {
final File f = findPlugin(defaultDir, id);
@@ -245,17 +249,4 @@
throw new RuntimeException(e);
}
}
-
- /**
- * Add user plugins to the list
- * @param userPlugins
- * @throws MalformedURLException
- * @throws PluginException
- */
- public void processUserPlugins(String userPlugins) throws MalformedURLException, PluginException {
- for (String pluginId : userPlugins.split(",")) {
- System.out.println("Adding user plugin " + pluginId);
- addPlugin(descrList, pluginList, pluginId);
- }
- }
}
Modified: trunk/builder/src/builder/org/jnode/build/PluginTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/PluginTask.java 2008-08-31 16:58:22 UTC (rev 4521)
+++ trunk/builder/src/builder/org/jnode/build/PluginTask.java 2008-08-31 18:12:16 UTC (rev 4522)
@@ -22,29 +22,14 @@
package org.jnode.build;
import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FilenameFilter;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
@@ -52,11 +37,9 @@
import org.apache.tools.ant.taskdefs.Manifest;
import org.apache.tools.ant.taskdefs.ManifestException;
import org.apache.tools.ant.types.FileSet;
-import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.ZipFileSet;
import org.apache.tools.ant.util.FileUtils;
-import org.jnode.nanoxml.XMLElement;
-import org.jnode.nanoxml.XMLParseException;
+import org.jnode.build.packager.PluginBuilder;
import org.jnode.plugin.Library;
import org.jnode.plugin.PluginDescriptor;
import org.jnode.plugin.Runtime;
@@ -70,8 +53,7 @@
private File todir;
private File tmpDir = new File(System.getProperty("java.io.tmpdir"));
- private File userApplicationsDir;
- private String userApplicationsProperty;
+ private PluginBuilder packager;
public ZipFileSet createDescriptors() {
final ZipFileSet fs = new ZipFileSet();
@@ -102,7 +84,6 @@
int max_thread_count = 10;
int max_plugin_count = 500;
- StringBuilder userPlugins = new StringBuilder();
final AtomicBoolean failure = new AtomicBoolean(false);
ThreadPoolExecutor executor = new ThreadPoolExecutor(max_thread_count, max_thread_count, 60, TimeUnit.SECONDS,
@@ -127,19 +108,9 @@
});
}
}
- if ((userApplicationsDir != null) && userApplicationsDir.exists() && userApplicationsDir.isDirectory()) {
- File[] userJars = userApplicationsDir.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return name.endsWith(".jar");
- }
-
- });
-
- for (File userJar : userJars) {
- processUserJar(executor, descriptors, userJar, userPlugins);
- }
+ if (packager != null) {
+ packager.execute(executor, descriptors);
}
executor.shutdown();
@@ -153,240 +124,18 @@
throw new RuntimeException("At least one plugin task failed : see above errors");
}
- // that must be called after completion of all plugin tasks
- if ((userPlugins.length() > 0) && (userPlugins.charAt(userPlugins.length() - 1) == ',')) {
- userPlugins.deleteCharAt(userPlugins.length() - 1);
- }
- getProject().setProperty(userApplicationsProperty, userPlugins.toString());
- }
-
- /**
- * Attention : userPluginList must be a StringBuilder because it's accessed from multiple threads
- * @param executor
- * @param descriptors
- * @param userJar
- * @param userPluginList
- */
- private void processUserJar(ExecutorService executor, final Map<String, File> descriptors, final File userJar,
- final StringBuilder userPluginList) {
- executor.execute(new Runnable() {
- public void run() {
- final String jarName = userJar.getName();
- final String pluginId = jarName.substring(0, jarName.length() - 4); // remove ".jar"
-
- userPluginList.append(pluginId + ",");
-
- // replace ".jar" by ".xml"
- final String pluginDesc = pluginId + ".xml";
-
- // FIXME remove the explicit reference to "cp"
- // add user jar to path named "cp" (used in build.xml)
- Path path = (Path) getProject().getReference("cp");
- path.createPathElement().setLocation(userJar);
-
- // create the lib alias
- final String alias = pluginId + ".jar";
- LibAlias libAlias = createLibAlias();
- libAlias.setName(alias);
- libAlias.setAlias(userJar);
-
- final File descriptorFile = new File(userJar.getParent(), pluginDesc);
- if (!descriptorFile.exists()) {
- // build the descriptor from scratch
- buildDescriptor(userJar, descriptorFile, pluginId, alias);
- }
-
- buildPlugin(descriptors, descriptorFile);
- }
- });
- }
-
- private void buildDescriptor(File userJar, File descriptorFile, String pluginId, String alias) {
- PrintStream out = null;
- boolean success = false;
- try {
- out = new PrintStream(descriptorFile);
-
- out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
- out.println("<!DOCTYPE plugin SYSTEM \"jnode.dtd\">");
-
- out.println("<plugin id=\"" + pluginId + "\"");
- out.println(" name=\"" + pluginId + "\"");
- out.println(" version=\"\"");
- out.println(" license-name=\"unspecified\">");
-
- out.println(" <runtime>");
- out.println(" <library name=\"" + alias + "\">");
- out.println(" <export name=\"*\"/>");
- out.println(" </library>");
- out.println(" </runtime>");
-
- List<String> mainClasses = searchMain(userJar);
- if (!mainClasses.isEmpty()) {
- out.println(" <extension point=\"org.jnode.shell.aliases\">");
- for (String mainClass : mainClasses) {
- int idx = mainClass.lastIndexOf('.');
- String name = (idx < 0) ? mainClass : mainClass.substring(idx + 1);
- out.println(" <alias name=\"" + name + "\" class=\"" + mainClass + "\"/>");
- System.out.println(pluginId + " : added alias " + name + " for class " + mainClass);
- }
-
- out.println(" </extension>");
- } else {
- System.err.println("WARNING : no main found for plugin " + pluginId);
- }
-
- // FIXME using AllPermission is bad ! we must avoid that
- out.println(" <extension point=\"org.jnode.security.permissions\">");
- out.println(" <permission class=\"java.security.AllPermission\" />");
- out.println(" </extension>");
-
- out.println("</plugin>");
- success = true;
- } catch (IOException ioe) {
- throw new BuildException(ioe);
- } finally {
- if (out != null) {
- out.close();
- }
-
- if (!success) {
- // in case of failure, remove the incomplete descriptor file
- descriptorFile.delete();
- }
+ if (packager != null) {
+ // that must be called after completion of all plugin tasks
+ packager.finish();
}
}
-
- private List<String> searchMain(File userJar) throws FileNotFoundException, IOException {
- List<String> mainList = new ArrayList<String>();
-
- JarFile jarFile = null;
- try {
- jarFile = new JarFile(userJar);
-
- // try to find the main class from the manifest
- Object value = null;
-
- // do we have a manifest ?
- if (jarFile.getManifest() != null) {
- value = jarFile.getManifest().getMainAttributes().get(Attributes.Name.MAIN_CLASS);
- if (value == null) {
- String name = Attributes.Name.MAIN_CLASS.toString();
- final Attributes attr = jarFile.getManifest().getAttributes(name);
-
- // we have a manifest but do we have a main class defined inside ?
- if (attr != null) {
- value = attr.get(Attributes.Name.MAIN_CLASS);
- }
- }
- }
-
- if (value != null) {
- mainList.add(String.valueOf(value));
- } else {
- // scan the jar to find the main classes
- for (Enumeration<JarEntry> e = jarFile.entries(); e.hasMoreElements(); ) {
- final JarEntry entry = e.nextElement();
- final String name = entry.getName();
- InputStream is = null;
-
- try {
- if (name.endsWith(".class")) {
- String className = name.substring(0, name.length() - ".class".length());
- className = className.replace('/', '.');
- is = jarFile.getInputStream(entry);
- ClassLoader cl = new InputStreamLoader(is, (int) entry.getSize());
- Class<?> clazz = Class.forName(className, false, cl);
- Method m = clazz.getMethod("main", new Class<?>[]{String[].class});
- if ((m.getModifiers() & Modifier.STATIC) == Modifier.STATIC) {
- mainList.add(className);
- }
- }
- } catch (ClassNotFoundException cnfe) {
- cnfe.printStackTrace();
- // ignore
- } catch (SecurityException se) {
- se.printStackTrace();
- // ignore
- } catch (NoSuchMethodException nsme) {
- // such error is expected for non-main classes => ignore
- } catch (Throwable t) {
- t.printStackTrace();
- // ignore
- } finally {
- if (is != null) {
- is.close();
- }
- }
- }
- }
- } finally {
- if (jarFile != null) {
- jarFile.close();
- }
- }
-
- return mainList;
- }
-
- private static class InputStreamLoader extends ClassLoader {
- private InputStream inputStream;
- private int size;
-
- public InputStreamLoader(InputStream inputStream, int size) {
- this.inputStream = inputStream;
- this.size = size;
- }
-
- public Class loadClass(String className) throws ClassNotFoundException {
- return loadClass(className, true);
- }
-
- public synchronized Class loadClass(String className, boolean resolve)
- throws ClassNotFoundException {
- Class<?> result;
-
- try {
-
- result = super.findSystemClass(className);
-
- } catch (ClassNotFoundException e) {
- byte[] classData = null;
-
- try {
- classData = new byte[size];
- inputStream.read(classData);
- } catch (IOException ioe) {
- throw new ClassNotFoundException(className, ioe);
- }
-
- if (classData == null) {
- throw new ClassNotFoundException(className);
- }
-
- result = defineClass(className, classData, 0, classData.length);
-
- if (result == null) {
- throw new ClassFormatError();
- }
-
- if (resolve) {
- resolveClass(result);
- }
- }
-
- return result;
- }
- }
-
-
/**
* @param descriptors map of fullPluginId to File descriptor
* @param descriptor the plugin descriptor XML
* @throws BuildException on failure
*/
- protected void buildPlugin(Map<String, File> descriptors, File descriptor) throws BuildException {
+ public void buildPlugin(Map<String, File> descriptors, File descriptor) throws BuildException {
final PluginDescriptor descr = readDescriptor(descriptor);
final String fullId = descr.getId() + "_" + descr.getVersion();
@@ -457,18 +206,6 @@
return mf;
}
- protected void addResourceList(File pluginDescr, Collection<ZipFileSet> resources)
- throws XMLParseException, FileNotFoundException, IOException {
- final XMLElement xml = new XMLElement();
- xml.parseFromReader(new FileReader(pluginDescr));
-
-// XMLElement runtime = xml.g
-
- }
-
-// private final XMLElement getRuntimeElement(XMLElement xml) {
-// }
-
/**
* @return The destination directory
*/
@@ -497,17 +234,8 @@
this.tmpDir = tmpDir;
}
- /**
- * @param file
- */
- public void setUserApplicationsDir(File file) {
- userApplicationsDir = file;
+ public PluginBuilder createPackager() {
+ packager = new PluginBuilder(this);
+ return packager;
}
-
- /**
- * @param file
- */
- public void setUserApplicationsProperty(String name) {
- userApplicationsProperty = name;
- }
}
Added: trunk/builder/src/builder/org/jnode/build/packager/PackagerTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/packager/PackagerTask.java (rev 0)
+++ trunk/builder/src/builder/org/jnode/build/packager/PackagerTask.java 2008-08-31 18:12:16 UTC (rev 4522)
@@ -0,0 +1,111 @@
+package org.jnode.build.packager;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * Abstract class used for common stuff among packager tasks
+ *
+ * @author fabien
+ *
+ */
+public class PackagerTask extends Task {
+ protected static final String PROPERTIES_FILE = "plugins.properties";
+
+ /**
+ * The default properties for the packager tool
+ */
+ private static final Properties DEFAULT_PROPERTIES;
+
+ static {
+ Properties props;
+ try {
+ props = readProperties(PackagerTask.class.getResourceAsStream(PROPERTIES_FILE), null);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ props = new Properties();
+ }
+ DEFAULT_PROPERTIES = props;
+ }
+
+ // properties names
+ protected static final String USER_PLUGIN_IDS = "user.plugin.ids";
+ protected static final String PLUGIN_LIST_NAME = "plugin.list.name";
+
+ /**
+ * Directory for suer plugins/resources
+ */
+ protected File userApplicationsDir = null;
+
+ /**
+ * Define the directory where user put its own plugins/resources to add in jnode cdrom
+ * @param file
+ */
+ public final void setUserApplicationsDir(File file) {
+ if ((file != null) && file.exists() && file.isDirectory()) {
+ userApplicationsDir = file;
+ } else {
+ userApplicationsDir = null;
+ }
+ }
+
+ /**
+ * Is that task enabled ?
+ * @return
+ */
+ protected final boolean isEnabled() {
+ return (userApplicationsDir != null);
+ }
+
+ /**
+ * Get properties file used to configure the packager tool
+ * @return
+ */
+ protected final File getPropertiesFile() {
+ return isEnabled() ? new File(userApplicationsDir, PROPERTIES_FILE) : null;
+ }
+
+ /**
+ * Read the properties file used to configure the packager tool
+ * @return
+ */
+ protected final Properties readProperties() {
+ try {
+ return readProperties(new FileInputStream(getPropertiesFile()), DEFAULT_PROPERTIES);
+ } catch (FileNotFoundException e) {
+ throw new BuildException("failed to read properties file", e);
+ }
+ }
+
+ /**
+ * Read the properties from the given {@link InputStream}
+ *
+ * @param input
+ * @param defaultProps
+ * @return
+ */
+ private static final Properties readProperties(InputStream input, Properties defaultProps) {
+ Properties properties = (defaultProps == null) ? new Properties() : new Properties(defaultProps);
+
+ try {
+ properties.load(input);
+ } catch (IOException ioe) {
+ throw new BuildException("failed to read properties file", ioe);
+ } finally {
+ try {
+ input.close();
+ } catch (IOException ioe) {
+ throw new BuildException("failed to close input stream", ioe);
+ }
+ }
+
+ return properties;
+ }
+}
Added: trunk/builder/src/builder/org/jnode/build/packager/PluginBuilder.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/packager/PluginBuilder.java (rev 0)
+++ trunk/builder/src/builder/org/jnode/build/packager/PluginBuilder.java 2008-08-31 18:12:16 UTC (rev 4522)
@@ -0,0 +1,369 @@
+package org.jnode.build.packager;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+import org.jnode.build.BuildException;
+import org.jnode.build.PluginTask;
+import org.jnode.build.AbstractPluginTask.LibAlias;
+
+/**
+ * Class building new jnode plugins from third party jars/resources
+ *
+ * @author fabien
+ *
+ */
+public class PluginBuilder extends PackagerTask {
+ private final Task parent;
+
+ /**
+ * List of user plugin ids
+ */
+ private StringBuilder userPluginIds = new StringBuilder();
+
+ /**
+ * {@link Path} to third party jars for compilation purpose
+ */
+ private Path path;
+
+ public PluginBuilder(Task parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * Define the path reference for compilation
+ * @param pathRefId
+ */
+ public void setPathRefId(String pathRefId) {
+ this.path = (Path) parent.getProject().getReference(pathRefId);
+ }
+
+ /**
+ * Main method for build the jnode plugin
+ *
+ * @param executor
+ * @param descriptors
+ */
+ public void execute(ThreadPoolExecutor executor, final Map<String, File> descriptors) {
+ if (isEnabled()) {
+ if (path == null) {
+ throw new BuildException("pathRefId is mandatory");
+ }
+
+ File[] userJars = userApplicationsDir.listFiles(new FileFilter() {
+
+ @Override
+ public boolean accept(File pathname) {
+ return pathname.getName().endsWith(".jar") || pathname.isDirectory();
+ }
+
+ });
+
+ for (File userJar : userJars) {
+ processUserJar(executor, descriptors, userJar, userPluginIds);
+ }
+ }
+ }
+
+ /**
+ * Do finalization tasks. For instance, it's writing the plugin ids to the properties file
+ */
+ public void finish() {
+ if (isEnabled()) {
+ if ((userPluginIds.length() > 0) && (userPluginIds.charAt(userPlug...
[truncated message content] |
|
From: <fd...@us...> - 2008-09-01 11:15:35
|
Revision: 4525
http://jnode.svn.sourceforge.net/jnode/?rev=4525&view=rev
Author: fduminy
Date: 2008-09-01 11:15:29 +0000 (Mon, 01 Sep 2008)
Log Message:
-----------
- removed usage of System.err, System.out & e.printStacktrace()
- added Override annotations
Modified Paths:
--------------
trunk/distr/src/apps/org/jnode/apps/httpd/NanoHTTPDCommand.java
trunk/shell/src/shell/org/jnode/shell/command/OnHeapCommand.java
trunk/shell/src/shell/org/jnode/shell/command/RunCommand.java
trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java
trunk/shell/src/shell/org/jnode/shell/command/driver/console/ConsoleCommand.java
Modified: trunk/distr/src/apps/org/jnode/apps/httpd/NanoHTTPDCommand.java
===================================================================
--- trunk/distr/src/apps/org/jnode/apps/httpd/NanoHTTPDCommand.java 2008-09-01 09:41:10 UTC (rev 4524)
+++ trunk/distr/src/apps/org/jnode/apps/httpd/NanoHTTPDCommand.java 2008-09-01 11:15:29 UTC (rev 4525)
@@ -36,6 +36,7 @@
*/
public class NanoHTTPDCommand extends AbstractCommand {
+ @Override
public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err) throws Exception {
File file = new File("/jnode/index.htm"); // ram disk is fat, so no long extension, I guess
@@ -58,20 +59,14 @@
try {
Thread.sleep(250);
} catch (InterruptedException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ e.printStackTrace(err);
}
}
}
- public static void main(String[] args) {
- NanoHTTPDCommand nanoHTTPDCommand = new NanoHTTPDCommand();
-
- try {
- nanoHTTPDCommand.execute(null, System.in, System.out, System.err);
- } catch (Exception e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
+ public static void main(String[] args) throws Exception {
+ new NanoHTTPDCommand().execute(args);
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/command/OnHeapCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/OnHeapCommand.java 2008-09-01 09:41:10 UTC (rev 4524)
+++ trunk/shell/src/shell/org/jnode/shell/command/OnHeapCommand.java 2008-09-01 11:15:29 UTC (rev 4525)
@@ -49,12 +49,13 @@
}
public static void main(String[] args) throws Exception {
- new OnHeapCommand().execute(null, System.in, System.out, System.err);
+ new OnHeapCommand().execute(args);
}
/**
* Execute this command
*/
+ @Override
public void execute(CommandLine commandLine, InputStream in,
PrintStream out, PrintStream err) throws Exception {
out.println("on heap:");
Modified: trunk/shell/src/shell/org/jnode/shell/command/RunCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/RunCommand.java 2008-09-01 09:41:10 UTC (rev 4524)
+++ trunk/shell/src/shell/org/jnode/shell/command/RunCommand.java 2008-09-01 11:15:29 UTC (rev 4525)
@@ -52,6 +52,7 @@
new RunCommand().execute(args);
}
+ @Override
public void execute(CommandLine commandLine, InputStream in,
PrintStream out, PrintStream err) throws Exception {
final File file = ARG_FILE.getValue();
@@ -60,12 +61,12 @@
try {
shell = ShellUtils.getShellManager().getCurrentShell();
} catch (NameNotFoundException e) {
- e.printStackTrace();
+ e.printStackTrace(err);
exit(2);
}
if (shell == null) {
- System.err.println("Shell is null.");
+ err.println("Shell is null.");
exit(2);
}
Modified: trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java 2008-09-01 09:41:10 UTC (rev 4524)
+++ trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java 2008-09-01 11:15:29 UTC (rev 4525)
@@ -99,9 +99,9 @@
break;
}
} else if (ARG_DEVICE.isSet()) {
- showDevice(System.out, ARG_DEVICE.getValue());
+ showDevice(out, ARG_DEVICE.getValue());
} else {
- showDevices(System.out);
+ showDevices(out);
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/command/driver/console/ConsoleCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/driver/console/ConsoleCommand.java 2008-09-01 09:41:10 UTC (rev 4524)
+++ trunk/shell/src/shell/org/jnode/shell/command/driver/console/ConsoleCommand.java 2008-09-01 11:15:29 UTC (rev 4525)
@@ -82,7 +82,7 @@
boolean test = FLAG_TEST.isSet();
if (listConsoles) {
- conMgr.printConsoles(System.out);
+ conMgr.printConsoles(out);
} else if (newConsole) {
if (isolateNewConsole) {
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-09-13 08:02:26
|
Revision: 4556
http://jnode.svn.sourceforge.net/jnode/?rev=4556&view=rev
Author: crawley
Date: 2008-09-13 08:02:20 +0000 (Sat, 13 Sep 2008)
Log Message:
-----------
Converted the console subsystem to be natively character (Reader/Writer)
based rather than byte (Stream) based, and propagated the API changes
throughout the system.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java
trunk/core/src/core/org/jnode/log4j/config/VirtualConsoleAppender.java
trunk/core/src/core/org/jnode/util/Queue.java
trunk/core/src/driver/org/jnode/driver/console/TextConsole.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsoleManager.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsolePlugin.java
trunk/core/src/driver/org/jnode/driver/input/KeyboardEvent.java
trunk/distr/src/apps/org/jnode/apps/telnetd/RemoteConsoleManager.java
trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java
trunk/shell/src/shell/org/jnode/shell/CommandLine.java
trunk/shell/src/shell/org/jnode/shell/CommandRunner.java
trunk/shell/src/shell/org/jnode/shell/CommandShell.java
trunk/shell/src/shell/org/jnode/shell/DefaultCommandInvoker.java
trunk/shell/src/shell/org/jnode/shell/PathnamePattern.java
trunk/shell/src/shell/org/jnode/shell/Shell.java
trunk/shell/src/shell/org/jnode/shell/command/HelpCommand.java
trunk/shell/src/shell/org/jnode/shell/command/JavaCommand.java
trunk/shell/src/shell/org/jnode/shell/command/SyntaxCommand.java
trunk/shell/src/shell/org/jnode/shell/command/debug/RemoteOutputCommand.java
trunk/shell/src/shell/org/jnode/shell/command/driver/console/ConsoleCommand.java
trunk/shell/src/shell/org/jnode/shell/help/Argument.java
trunk/shell/src/shell/org/jnode/shell/help/CommandLineElement.java
trunk/shell/src/shell/org/jnode/shell/help/Help.java
trunk/shell/src/shell/org/jnode/shell/help/Parameter.java
trunk/shell/src/shell/org/jnode/shell/help/argument/EnumOptionArgument.java
trunk/shell/src/shell/org/jnode/shell/help/argument/OptionArgument.java
trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java
trunk/shell/src/shell/org/jnode/shell/io/BaseCommandIO.java
trunk/shell/src/shell/org/jnode/shell/io/CommandIO.java
trunk/shell/src/shell/org/jnode/shell/io/CommandIOMarker.java
trunk/shell/src/shell/org/jnode/shell/io/CommandInput.java
trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java
trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java
trunk/shell/src/shell/org/jnode/shell/syntax/Log4jLoggerArgument.java
trunk/shell/src/shell/org/jnode/shell/syntax/OptionSetSyntax.java
trunk/shell/src/test/org/jnode/test/shell/help/DefaultHelpTest.java
trunk/shell/src/test/org/jnode/test/shell/io/ReaderInputStreamTest.java
trunk/shell/src/test/org/jnode/test/shell/io/WriterOutputStreamTest.java
Added Paths:
-----------
trunk/core/src/core/org/jnode/log4j/config/JNodeConsoleAppender.java
trunk/core/src/core/org/jnode/util/ReaderInputStream.java
trunk/core/src/core/org/jnode/util/WriterOutputStream.java
trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleWriter.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java
trunk/shell/src/shell/org/jnode/shell/io/FanoutWriter.java
Removed Paths:
-------------
trunk/core/src/driver/org/jnode/driver/console/ConsoleInputStream.java
trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleOutputStream.java
trunk/core/src/driver/org/jnode/driver/console/spi/ConsolePrintStream.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardInputStream.java
trunk/shell/src/shell/org/jnode/shell/io/FanoutOutputStream.java
trunk/shell/src/shell/org/jnode/shell/io/ReaderInputStream.java
trunk/shell/src/shell/org/jnode/shell/io/WriterOutputStream.java
Added: trunk/core/src/core/org/jnode/log4j/config/JNodeConsoleAppender.java
===================================================================
--- trunk/core/src/core/org/jnode/log4j/config/JNodeConsoleAppender.java (rev 0)
+++ trunk/core/src/core/org/jnode/log4j/config/JNodeConsoleAppender.java 2008-09-13 08:02:20 UTC (rev 4556)
@@ -0,0 +1,74 @@
+/*
+ * $Id: Log4jConfigurePlugin.java 4387 2008-08-03 07:55:38Z fduminy $
+ *
+ * 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.log4j.config;
+
+import java.io.Writer;
+
+import org.apache.log4j.Layout;
+import org.apache.log4j.WriterAppender;
+import org.jnode.driver.console.TextConsole;
+
+/**
+ * Custom Log4j appender class for appending to JNode consoles. This appender
+ * avoids the unnecessary Writer to Stream to Writer wrappering that goes on
+ * if we use the standard Log4j ConsoleAppender. (JNode's consoles are natively
+ * character oriented rather than byte oriented.)
+ *
+ * @author cr...@jn...
+ */
+public class JNodeConsoleAppender extends WriterAppender {
+
+ private Writer writer;
+
+ /**
+ * Create an appender for a given JNode console.
+ * @param layout the appender's initial log message layout.
+ * @param console the target console.
+ * @param toErr if <code>true</code> output to the console's 'err' stream,
+ * otherwise to it's 'out' stream.
+ */
+ public JNodeConsoleAppender(Layout layout, TextConsole console, boolean toErr) {
+ super();
+ this.layout = layout;
+ this.immediateFlush = true;
+ this.writer = toErr ? console.getErr() : console.getOut();
+ super.setWriter(this.writer);
+ }
+
+ @Override
+ protected void closeWriter() {
+ // Ignore the close request. We don't own the writer.
+ }
+
+ @Override
+ public void activateOptions() {
+ super.setWriter(writer);
+ }
+
+ @Override
+ public synchronized void setWriter(Writer writer) {
+ if (writer != this.writer) {
+ throw new IllegalArgumentException("cannot change the writer");
+ }
+ super.setWriter(writer);
+ }
+
+}
Modified: trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java
===================================================================
--- trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java 2008-09-11 18:40:09 UTC (rev 4555)
+++ trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java 2008-09-13 08:02:20 UTC (rev 4556)
@@ -32,6 +32,7 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
+import org.apache.log4j.WriterAppender;
import org.jnode.driver.console.ConsoleManager;
import org.jnode.driver.console.TextConsole;
import org.jnode.naming.InitialNaming;
@@ -39,6 +40,7 @@
import org.jnode.plugin.PluginDescriptor;
import org.jnode.plugin.PluginException;
import org.jnode.system.BootLog;
+import org.jnode.util.WriterOutputStream;
/**
* @author Ewout Prangsma (ep...@us...)
@@ -58,6 +60,7 @@
* @see org.jnode.plugin.Plugin#startPlugin()
*/
protected void startPlugin() throws PluginException {
+ System.err.println("Running in Log4jConfigurePlugin.startPlugin");
final Logger root = Logger.getRootLogger();
try {
// Create the appenders
@@ -72,12 +75,23 @@
conMgr.registerConsole(console);
console.setAcceleratorKeyCode(KeyEvent.VK_F7);
- final VirtualConsoleAppender debugApp = new VirtualConsoleAppender(console, new PatternLayout(LAYOUT));
+ final VirtualConsoleAppender debugApp =
+ new VirtualConsoleAppender(console, new PatternLayout(LAYOUT));
debugApp.setThreshold(Level.DEBUG);
- BootLog.setDebugOut(new PrintStream(console.getOut()));
+ BootLog.setDebugOut(new PrintStream(new WriterOutputStream(console.getOut()), true));
- final ConsoleAppender infoApp = new ConsoleAppender(new PatternLayout(LAYOUT));
+ // This doesn't work yet. It sends to the F7 console, whereas we really want to send
+ // the log messages to the current active console.
+// final WriterAppender infoApp =
+// new JNodeConsoleAppender(new PatternLayout(LAYOUT), console, false);
+
+ // This kind of works. It sends to whatever System.out currently is at the point
+ // that the appender is created. But if this plugin is started too late, this will
+ // could be almost anything.
+ final WriterAppender infoApp =
+ new ConsoleAppender(new PatternLayout(LAYOUT));
infoApp.setThreshold(Level.INFO);
+ infoApp.setImmediateFlush(true);
// Add the new appenders
root.addAppender(debugApp);
@@ -86,10 +100,12 @@
// Remove the existing appenders.
for (Enumeration<?> appEnum = root.getAllAppenders(); appEnum.hasMoreElements();) {
final Appender appender = (Appender) appEnum.nextElement();
- if ((appender != debugApp) && (appender != infoApp)) {
+ if (appender != debugApp && appender != infoApp) {
root.removeAppender(appender);
}
}
+ System.err.println("Sending a test log message");
+ root.error("Test log message");
} catch (NameNotFoundException ex) {
root.error("ConsoleManager not found", ex);
}
Modified: trunk/core/src/core/org/jnode/log4j/config/VirtualConsoleAppender.java
===================================================================
--- trunk/core/src/core/org/jnode/log4j/config/VirtualConsoleAppender.java 2008-09-11 18:40:09 UTC (rev 4555)
+++ trunk/core/src/core/org/jnode/log4j/config/VirtualConsoleAppender.java 2008-09-13 08:02:20 UTC (rev 4556)
@@ -21,7 +21,6 @@
package org.jnode.log4j.config;
-import java.io.OutputStreamWriter;
import org.apache.log4j.Layout;
import org.apache.log4j.WriterAppender;
import org.jnode.driver.console.TextConsole;
@@ -38,6 +37,6 @@
*/
public VirtualConsoleAppender(TextConsole console, Layout layout) {
setLayout(layout);
- setWriter(new OutputStreamWriter(console.getOut()));
+ setWriter(console.getOut());
}
}
Modified: trunk/core/src/core/org/jnode/util/Queue.java
===================================================================
--- trunk/core/src/core/org/jnode/util/Queue.java 2008-09-11 18:40:09 UTC (rev 4555)
+++ trunk/core/src/core/org/jnode/util/Queue.java 2008-09-13 08:02:20 UTC (rev 4556)
@@ -27,6 +27,8 @@
* @author epr
*/
public class Queue<T> {
+
+ public static final int NO_WAIT = -1;
/**
* The actual queue
@@ -47,7 +49,7 @@
*/
public synchronized T get(boolean ignoreInteruptions, long timeout) {
while (queue.isEmpty()) {
- if (closed) {
+ if (closed || timeout == NO_WAIT) {
return null;
}
try {
@@ -62,7 +64,6 @@
return null;
}
}
- //T result = queue.get(0);
return queue.remove(0);
}
Added: trunk/core/src/core/org/jnode/util/ReaderInputStream.java
===================================================================
--- trunk/core/src/core/org/jnode/util/ReaderInputStream.java (rev 0)
+++ trunk/core/src/core/org/jnode/util/ReaderInputStream.java 2008-09-13 08:02:20 UTC (rev 4556)
@@ -0,0 +1,147 @@
+/*
+ * $Id: ThreadCommandInvoker.java 3374 2007-08-02 18:15:27Z lsantha $
+ *
+ * JNode.org
+ * Copyright (C) 2007 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.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+
+/**
+ * This class wraps a Reader with the InputStream API. It is used internally
+ * by the JNode shell, and is not recommended for general use.
+ *
+ * @author cr...@jn...
+ */
+public class ReaderInputStream extends InputStream {
+ private final Reader reader;
+
+ private CharBuffer chars = CharBuffer.allocate(1024);
+ private ByteBuffer bytes = ByteBuffer.allocate(2048);
+
+ private CharsetEncoder encoder;
+
+ public ReaderInputStream(Reader reader) {
+ this(reader, Charset.defaultCharset().name());
+ }
+
+ public ReaderInputStream(Reader reader, String encoding) {
+ this.reader = reader;
+ this.encoder = Charset.forName(encoding).newEncoder();
+ this.bytes.position(bytes.limit());
+ this.chars.position(chars.limit());
+ }
+
+ @Override
+ public synchronized int read() throws IOException {
+ if (bytes.remaining() == 0) {
+ if (fillBuffer(true) == -1) {
+ return -1;
+ }
+ }
+ return bytes.get();
+ }
+
+ @Override
+ public synchronized int read(byte[] b, int off, int len) throws IOException {
+ if (off < 0 || off > b.length || len < 0 || off + len > b.length || off + len < 0) {
+ throw new IndexOutOfBoundsException();
+ }
+ // This implementation is simple-minded. I'm sure we could recode it to avoid
+ // the 'bytes.get' copying step if we thought about it.
+ int count = 0;
+ do {
+ if (bytes.remaining() == 0) {
+ int nosRead = fillBuffer(count == 0);
+ if (nosRead <= 0) {
+ return count > 0 ? count : -1;
+ }
+ }
+ int toCopy = Math.min(bytes.remaining(), len);
+ bytes.get(b, off, toCopy);
+ count += toCopy;
+ len -= toCopy;
+ off += toCopy;
+ } while (count < len);
+ return count;
+ }
+
+ @Override
+ public int read(byte[] b) throws IOException {
+ return this.read(b, 0, b.length);
+ }
+
+ /**
+ * This method puts bytes into the (empty) 'bytes' buffer. It returns
+ * <code>false</code> if no bytes were copied either because the reader
+ * would have blocked or because it returned <code>-1</code>.
+ *
+ * @param wait if <code>true</code> allow the reader to block.
+ * @return the number of bytes added; <code>-1</code> if none were added
+ * and the reader is at the EOF.
+ * @throws IOException
+ */
+ private int fillBuffer(boolean wait) throws IOException {
+ bytes.clear();
+ // The loop is necessary because of the way that an encoder has to deal
+ // with UTF-16 surrogate pairs.
+ CoderResult cr = null;
+ int count;
+ do {
+ if (chars.remaining() == 0 || cr == CoderResult.UNDERFLOW) {
+ if (chars.remaining() == 0) {
+ if (!reader.ready() && !wait) {
+ bytes.flip();
+ return 0;
+ }
+ chars.clear();
+ } else {
+ char[] tmp = new char[chars.remaining()];
+ chars.get(tmp);
+ chars.clear();
+ chars.put(tmp);
+ }
+ if (reader.read(chars) == -1) {
+ chars.flip();
+ cr = encoder.encode(chars, bytes, true);
+ if (cr.isError()) {
+ cr.throwException();
+ }
+ count = bytes.position();
+ bytes.flip();
+ return count > 0 ? count : -1;
+ }
+ chars.flip();
+ }
+ cr = encoder.encode(chars, bytes, false);
+ if (cr.isError()) {
+ cr.throwException();
+ }
+ count = bytes.position();
+ } while (wait && count == 0);
+ bytes.flip();
+ return count;
+ }
+}
Added: trunk/core/src/core/org/jnode/util/WriterOutputStream.java
===================================================================
--- trunk/core/src/core/org/jnode/util/WriterOutputStream.java (rev 0)
+++ trunk/core/src/core/org/jnode/util/WriterOutputStream.java 2008-09-13 08:02:20 UTC (rev 4556)
@@ -0,0 +1,124 @@
+/*
+ * $Id: ShellManager.java 3571 2007-10-26 21:30:12Z 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.util;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CoderResult;
+
+/**
+ * This class wraps a Writer with the OutputStream API. It is used internally
+ * by the JNode shell, and is not recommended for general use.
+ *
+ * @author cr...@jn...
+ */
+public class WriterOutputStream extends OutputStream {
+
+ private ByteBuffer bytes = ByteBuffer.allocate(2048);
+ private CharBuffer chars = CharBuffer.allocate(2048);
+
+ private Writer writer;
+ private CharsetDecoder decoder;
+
+ public WriterOutputStream(Writer writer) {
+ this(writer, Charset.defaultCharset().name());
+ }
+
+ public WriterOutputStream(Writer writer, String encoding) {
+ this.writer = writer;
+ this.decoder = Charset.forName(encoding).newDecoder();
+ bytes.clear();
+ chars.clear();
+ }
+
+ @Override
+ public synchronized void write(int b) throws IOException {
+ bytes.put((byte) b);
+ if (bytes.remaining() == 0) {
+ flush(false);
+ }
+ }
+
+ @Override
+ public void flush() throws IOException {
+ flush(false);
+ writer.flush();
+ }
+
+ @Override
+ public void close() throws IOException {
+ flush(true);
+ writer.close();
+ }
+
+ private synchronized int flush(boolean all) throws IOException {
+ if (bytes.position() > 0) {
+ bytes.flip();
+ chars.clear();
+ CoderResult cr = decoder.decode(bytes, chars, all);
+ int count = chars.position();
+ if (count > 0) {
+ int pos = chars.arrayOffset();
+ writer.write(chars.array(), pos, count);
+ }
+ if (cr.isError() || (all && cr == CoderResult.UNDERFLOW)) {
+ cr.throwException();
+ }
+ if (bytes.remaining() > 0) {
+ byte[] tmp = new byte[bytes.remaining()];
+ bytes.get(tmp);
+ bytes.clear();
+ bytes.put(tmp);
+ } else {
+ bytes.clear();
+ }
+ return count;
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ public synchronized void write(byte[] b, int off, int len) throws IOException {
+ if (off < 0 || off > b.length || len < 0 || off + len > b.length || off + len < 0) {
+ throw new IndexOutOfBoundsException();
+ }
+ while (len > 0) {
+ int toWrite = Math.min(len, bytes.remaining());
+ bytes.put(b, off, toWrite);
+ off += toWrite;
+ len -= toWrite;
+ if (bytes.remaining() == 0) {
+ flush(false);
+ }
+ }
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException {
+ this.write(b, 0, b.length);
+ }
+}
Deleted: trunk/core/src/driver/org/jnode/driver/console/ConsoleInputStream.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/ConsoleInputStream.java 2008-09-11 18:40:09 UTC (rev 4555)
+++ trunk/core/src/driver/org/jnode/driver/console/ConsoleInputStream.java 2008-09-13 08:02:20 UTC (rev 4556)
@@ -1,87 +0,0 @@
-/*
- * $Id$
- *
- * 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.io.IOException;
-import java.io.InputStream;
-import org.jnode.driver.input.KeyboardEvent;
-import org.jnode.driver.input.KeyboardListener;
-import org.jnode.util.Queue;
-
-/**
- * @author epr
- */
-public class ConsoleInputStream extends InputStream implements KeyboardListener {
-
- private final Queue<KeyboardEvent> queue = new Queue<KeyboardEvent>();
- private boolean echo = false;
-
- public ConsoleInputStream(Console console) {
- console.addKeyboardListener(this);
- }
-
- /**
- * @return Available bytes
- * @throws IOException
- * @see java.io.InputStream#available()
- */
- public int available() throws IOException {
- return queue.size();
- }
-
- /**
- * @return int
- * @throws IOException
- * @see java.io.InputStream#read()
- */
- public int read() throws IOException {
- while (true) {
- KeyboardEvent event = (KeyboardEvent) queue.get();
- if (!event.isConsumed()) {
- event.consume();
- char ch = event.getKeyChar();
- if (ch != 0) {
- if (echo) {
- System.out.print(ch);
- }
- return ch;
- }
- }
- }
- }
-
- /**
- * @param event
- * @see org.jnode.driver.input.KeyboardListener#keyPressed(org.jnode.driver.input.KeyboardEvent)
- */
- public void keyPressed(KeyboardEvent event) {
- //log.debug("got event(" + event + ")");
- queue.add(event);
- }
-
- /**
- * @param event
- * @see org.jnode.driver.input.KeyboardListener#keyReleased(org.jnode.driver.input.KeyboardEvent)
- */
- public void keyReleased(KeyboardEvent event) {
- }
-}
Modified: trunk/core/src/driver/org/jnode/driver/console/TextConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/TextConsole.java 2008-09-11 18:40:09 UTC (rev 4555)
+++ trunk/core/src/driver/org/jnode/driver/console/TextConsole.java 2008-09-13 08:02:20 UTC (rev 4556)
@@ -21,8 +21,8 @@
package org.jnode.driver.console;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
/**
* @author Ewout Prangsma (ep...@us...)
@@ -155,25 +155,27 @@
public void setTabSize(int tabSize);
/**
- * Gets the input stream of this console.
+ * Gets the Reader that delivers input characters from this console. These
+ * characters are the result of processing keyboard events, performing line
+ * editing and completion.
*
* @return
*/
- public InputStream getIn();
+ public Reader getIn();
/**
- * Gets the error stream of this console.
+ * Gets the Writer that receives 'error' output for this console.
*
* @return
*/
- public OutputStream getErr();
+ public Writer getErr();
/**
- * Gets the output stream of this console.
+ * Gets the Writer that receives 'normal' output for this console.
*
* @return
*/
- public OutputStream getOut();
+ public Writer getOut();
/**
* Is the cursor visible.
@@ -196,7 +198,7 @@
public InputCompleter getCompleter();
/**
- * Ges the console's input completer
+ * Set the console's input completer
*
* @param The new completer or <code>null</code>.
*/
Deleted: trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleOutputStream.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleOutputStream.java 2008-09-11 18:40:09 UTC (rev 4555)
+++ trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleOutputStream.java 2008-09-13 08:02:20 UTC (rev 4556)
@@ -1,94 +0,0 @@
-/*
- * $Id$
- *
- * 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.spi;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import org.jnode.driver.console.TextConsole;
-
-/**
- * @author epr
- * @author Levente S\u00e1ntha (ls...@us...)
- */
-public class ConsoleOutputStream extends OutputStream {
-
- private static final int BUFFER_SIZE = 160;
- private final char[] buffer = new char[BUFFER_SIZE];
- private TextConsole console;
- private int fgColor;
-
-
- /**
- * Create a new instance
- *
- * @param console
- * @param fgColor
- */
- public ConsoleOutputStream(TextConsole console, int fgColor) {
- this.console = console;
- this.fgColor = fgColor;
- }
-
- /**
- * @param b
- * @throws IOException
- * @see java.io.OutputStream#write(int)
- */
- public void write(int b) throws IOException {
- console.putChar((char) b, fgColor);
- }
-
- public void write(byte[] b, int off, int len)
- throws IOException, NullPointerException, IndexOutOfBoundsException {
- if (off < 0 || len < 0 || off + len > b.length)
- throw new ArrayIndexOutOfBoundsException();
-
- int bi = 0;
- for (int i = 0; i < len; ++i) {
- if (bi >= BUFFER_SIZE) {
- console.putChar(buffer, 0, BUFFER_SIZE, fgColor);
- bi = 0;
- }
- buffer[bi++] = (char) b[off + i];
- }
-
- console.putChar(buffer, 0, bi, fgColor);
- }
-
-
- /**
- * @return int
- */
- public int getFgColor() {
- return fgColor;
- }
-
- /**
- * Sets the fgColor.
- *
- * @param fgColor The fgColor to set
- */
- public void setFgColor(int fgColor) {
- this.fgColor = fgColor;
- }
-
-}
Deleted: trunk/core/src/driver/org/jnode/driver/console/spi/ConsolePrintStream.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/spi/ConsolePrintStream.java 2008-09-11 18:40:09 UTC (rev 4555)
+++ trunk/core/src/driver/org/jnode/driver/console/spi/ConsolePrintStream.java 2008-09-13 08:02:20 UTC (rev 4556)
@@ -1,17 +0,0 @@
-package org.jnode.driver.conso...
[truncated message content] |
|
From: <cr...@us...> - 2008-09-21 04:44:52
|
Revision: 4567
http://jnode.svn.sourceforge.net/jnode/?rev=4567&view=rev
Author: crawley
Date: 2008-09-21 04:44:44 +0000 (Sun, 21 Sep 2008)
Log Message:
-----------
Implementing 'isTTY' functionality.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/util/ReaderInputStream.java
trunk/core/src/core/org/jnode/util/WriterOutputStream.java
trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleWriter.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java
trunk/shell/src/shell/org/jnode/shell/io/CommandIOMarker.java
trunk/shell/src/shell/org/jnode/shell/io/CommandInput.java
trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java
trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java
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/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
Added Paths:
-----------
trunk/core/src/core/org/jnode/util/ConsoleStream.java
trunk/core/src/core/org/jnode/util/IOUtils.java
trunk/core/src/core/org/jnode/util/ProxyStream.java
trunk/core/src/core/org/jnode/util/ProxyStreamException.java
Removed Paths:
-------------
trunk/shell/src/shell/org/jnode/shell/proclet/ProxyStream.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProxyStreamException.java
Added: trunk/core/src/core/org/jnode/util/ConsoleStream.java
===================================================================
--- trunk/core/src/core/org/jnode/util/ConsoleStream.java (rev 0)
+++ trunk/core/src/core/org/jnode/util/ConsoleStream.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -0,0 +1,10 @@
+package org.jnode.util;
+
+/**
+ * This is a marker interface that is implemented by console readers and writers.
+ *
+ * @author crawley@jnode,org
+ */
+public interface ConsoleStream {
+
+}
Added: trunk/core/src/core/org/jnode/util/IOUtils.java
===================================================================
--- trunk/core/src/core/org/jnode/util/IOUtils.java (rev 0)
+++ trunk/core/src/core/org/jnode/util/IOUtils.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -0,0 +1,145 @@
+/*
+ * $Id: CommandShell.java 4556 2008-09-13 08:02:20Z crawley $
+ *
+ * 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.util;
+
+import java.io.Closeable;
+import java.io.FilterInputStream;
+import java.io.FilterOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.lang.reflect.Field;
+import java.security.PrivilegedAction;
+
+import org.apache.log4j.Logger;
+import org.jnode.driver.console.spi.ConsoleWriter;
+import org.jnode.driver.console.textscreen.KeyboardReader;
+
+/**
+ * Common utility code for higher-level operations on IO streams. Notwithstanding the
+ * nominal access for the class and its methods, user (command) code should avoid using
+ * this class directly. You should program against the
+ * {@link org.jnode.shell.io.CommandIO} API instead.
+ *
+ * @author cr...@jn...
+ */
+public class IOUtils {
+
+ private IOUtils() {
+ // Prevent instantiation
+ }
+
+ public static boolean isTTY(Closeable stream) {
+ if (stream instanceof ConsoleStream) {
+ return true;
+ } else if (stream instanceof ProxyStream<?>) {
+ try {
+ return isTTY(((ProxyStream<?>) stream).getRealStream());
+ } catch (ProxyStreamException ex) {
+ return false;
+ }
+ } else if (stream instanceof OutputStreamWriter) {
+ return isTTY(findOutputStream((OutputStreamWriter) stream));
+ } else if (stream instanceof InputStreamReader) {
+ return isTTY(findInputStream((InputStreamReader) stream));
+ } else if (stream instanceof ReaderInputStream) {
+ return isTTY(((ReaderInputStream) stream).getReader());
+ } else if (stream instanceof WriterOutputStream) {
+ return isTTY(((WriterOutputStream) stream).getWriter());
+ } else if (stream instanceof FilterInputStream) {
+ return isTTY(findInputStream((FilterInputStream) stream));
+ } else if (stream instanceof FilterOutputStream) {
+ return isTTY(findOutputStream((FilterOutputStream) stream));
+ } else {
+ return false;
+ }
+ }
+
+ private static InputStream findInputStream(final FilterInputStream inputStream) {
+ return new PrivilegedAction<InputStream>() {
+ public InputStream run() {
+ try {
+ Class<FilterInputStream> cls = FilterInputStream.class;
+ Field field = cls.getDeclaredField("in");
+ Object in = field.get(inputStream);
+ return (InputStream) in;
+ } catch (Exception ex) {
+ Logger.getLogger(IOUtils.class).error("Cannot extract the 'in' field", ex);
+ return null;
+ }
+ }}.run();
+ }
+
+ private static OutputStream findOutputStream(final FilterOutputStream outputStream) {
+ return new PrivilegedAction<OutputStream>() {
+ public OutputStream run() {
+ try {
+ Class<FilterOutputStream> cls = FilterOutputStream.class;
+ Field field = cls.getDeclaredField("out");
+ Object out = field.get(outputStream);
+ return (OutputStream) out;
+ } catch (Exception ex) {
+ Logger.getLogger(IOUtils.class).error("Cannot extract the 'out' field", ex);
+ return null;
+ }
+ }}.run();
+ }
+
+
+ private static OutputStream findOutputStream(final OutputStreamWriter writer) {
+ // This implementation is based on the knowledge that an OutputStreamWriter
+ // uses the underlying OutputStream as its 'lock' object.
+ return new PrivilegedAction<OutputStream>() {
+ public OutputStream run() {
+ try {
+ Class<Writer> cls = Writer.class;
+ Field field = cls.getDeclaredField("lock");
+ Object lock = field.get(writer);
+ return (OutputStream) lock;
+ } catch (Exception ex) {
+ Logger.getLogger(IOUtils.class).error("Cannot extract the 'lock' field", ex);
+ return null;
+ }
+ }}.run();
+ }
+
+ private static InputStream findInputStream(final InputStreamReader reader) {
+ // This implementation is based on the knowledge that an InputStreamReader
+ // uses the underlying InputStream as its 'lock' object.
+ return new PrivilegedAction<InputStream>() {
+ public InputStream run() {
+ try {
+ Class<Reader> cls = Reader.class;
+ Field field = cls.getDeclaredField("lock");
+ Object lock = field.get(reader);
+ return (InputStream) lock;
+ } catch (Exception ex) {
+ Logger.getLogger(IOUtils.class).error("Cannot extract the 'lock' field", ex);
+ return null;
+ }
+ }}.run();
+ }
+
+}
Added: trunk/core/src/core/org/jnode/util/ProxyStream.java
===================================================================
--- trunk/core/src/core/org/jnode/util/ProxyStream.java (rev 0)
+++ trunk/core/src/core/org/jnode/util/ProxyStream.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -0,0 +1,61 @@
+/*
+ * $Id: ThreadCommandInvoker.java 3374 2007-08-02 18:15:27Z lsantha $
+ *
+ * JNode.org
+ * Copyright (C) 2007-2008 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.util;
+
+import java.io.Closeable;
+
+/**
+ * Proxy streams have an underlying stream and offer methods for getting that
+ * stream.
+ *
+ * @author cr...@jn...
+ */
+public interface ProxyStream<T extends Closeable> extends Closeable {
+
+ /**
+ * Get the underlying (non-proxy) stream for this proxy. If there are
+ * multiple layers of proxying, these are unwound.
+ *
+ * @return a real (non-proxied) stream.
+ */
+ public T getRealStream() throws ProxyStreamException;
+
+ /**
+ * Get the stream that this proxy stream wraps. The result may also be a
+ * proxy stream.
+ *
+ * @return the wrapped stream for this proxy.
+ */
+ public T getProxiedStream() throws ProxyStreamException;
+
+ /**
+ * Determine if this proxy refers to the same underlying stream as another
+ * stream object.
+ *
+ * @param other
+ * @return <code>true</code> if this object and <code>other</code>
+ * resolve to the same underlying stream, otherwise false. Note: the
+ * 'otherwise' covers cases where <code>other</code> is
+ * <code>null</code>.
+ */
+ public boolean sameStream(T other) throws ProxyStreamException;
+}
Added: trunk/core/src/core/org/jnode/util/ProxyStreamException.java
===================================================================
--- trunk/core/src/core/org/jnode/util/ProxyStreamException.java (rev 0)
+++ trunk/core/src/core/org/jnode/util/ProxyStreamException.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -0,0 +1,44 @@
+/*
+ * $Id: ThreadCommandInvoker.java 3374 2007-08-02 18:15:27Z lsantha $
+ *
+ * JNode.org
+ * Copyright (C) 2007-2008 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.util;
+
+import java.io.IOException;
+
+/**
+ * This exception indicates an error in a proxy stream mechanism
+ *
+ * @author cr...@jn...
+ */
+public class ProxyStreamException extends IOException {
+
+ private static final long serialVersionUID = 1L;
+
+ public ProxyStreamException(String message) {
+ super(message);
+ }
+
+ public ProxyStreamException(String message, Throwable ex) {
+ super(message);
+ this.initCause(ex);
+ }
+
+}
Modified: trunk/core/src/core/org/jnode/util/ReaderInputStream.java
===================================================================
--- trunk/core/src/core/org/jnode/util/ReaderInputStream.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/core/src/core/org/jnode/util/ReaderInputStream.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.io.Writer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
@@ -144,4 +145,8 @@
bytes.flip();
return count;
}
+
+ public Reader getReader() {
+ return reader;
+ }
}
Modified: trunk/core/src/core/org/jnode/util/WriterOutputStream.java
===================================================================
--- trunk/core/src/core/org/jnode/util/WriterOutputStream.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/core/src/core/org/jnode/util/WriterOutputStream.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -121,4 +121,8 @@
public void write(byte[] b) throws IOException {
this.write(b, 0, b.length);
}
+
+ Writer getWriter() {
+ return writer;
+ }
}
Modified: trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleWriter.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleWriter.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleWriter.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -24,13 +24,14 @@
import java.io.IOException;
import java.io.Writer;
import org.jnode.driver.console.TextConsole;
+import org.jnode.util.ConsoleStream;
import org.jnode.vm.Unsafe;
/**
* @author epr
* @author Levente S\u00e1ntha (ls...@us...)
*/
-public class ConsoleWriter extends Writer {
+public class ConsoleWriter extends Writer implements ConsoleStream {
private TextConsole console;
private int fgColor;
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -11,6 +11,7 @@
import org.jnode.driver.input.KeyboardEvent;
import org.jnode.system.event.FocusEvent;
import org.jnode.system.event.FocusListener;
+import org.jnode.util.ConsoleStream;
/**
@@ -22,7 +23,7 @@
* <li>listens to keyboard focus events.
* </ul>
* <p/>
- * Future enhancements include:
+ * Possible future enhancements include:
* <ul>
* <li>a "raw" mode in which characters and other keyboard events are delivered without line editing,
* <li>a "no echo" mode in which line editing occurs without echoing of input characters,
@@ -40,8 +41,8 @@
*
* @author cr...@jn...
*/
-public class KeyboardReader extends Reader
- implements FocusListener {
+public class KeyboardReader extends Reader
+ implements FocusListener, ConsoleStream {
public static final byte CTRL_L = 12;
public static final byte CTRL_D = 4;
Modified: trunk/shell/src/shell/org/jnode/shell/io/CommandIOMarker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/CommandIOMarker.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/io/CommandIOMarker.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -89,6 +89,4 @@
public Writer getWriter() throws CommandIOException {
throw new CommandIOException("I/O not supported on CommandIOMarker");
}
-
-
}
Modified: trunk/shell/src/shell/org/jnode/shell/io/CommandInput.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/CommandInput.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/io/CommandInput.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -30,6 +30,7 @@
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import org.jnode.util.IOUtils;
import org.jnode.util.ReaderInputStream;
/**
@@ -77,8 +78,12 @@
@Override
public boolean isTTY() {
- // TODO Auto-generated method stub
- return false;
+ Object obj = getSystemObject();
+ if (obj instanceof Reader) {
+ return IOUtils.isTTY((Reader) obj);
+ } else {
+ return IOUtils.isTTY((InputStream) obj);
+ }
}
public void close() throws IOException {
@@ -109,6 +114,4 @@
public Writer getWriter() throws CommandIOException {
throw new CommandIOException("Output not supported");
}
-
-
}
Modified: trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -31,6 +31,7 @@
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import org.jnode.util.IOUtils;
import org.jnode.util.ReaderInputStream;
import org.jnode.util.WriterOutputStream;
@@ -58,10 +59,7 @@
this.reader = reader;
this.writer = writer;
}
-
- /* (non-Javadoc)
- * @see org.jnode.shell.io.CommandIOIF#getOutputStream()
- */
+
public synchronized OutputStream getOutputStream() {
if (outputStream == null) {
outputStream = new WriterOutputStream(writer, getEncoding());
@@ -69,9 +67,6 @@
return outputStream;
}
- /* (non-Javadoc)
- * @see org.jnode.shell.io.CommandIOIF#getPrintStream()
- */
public PrintStream getPrintStream() {
if (printStream == null) {
if (outputStream instanceof PrintStream) {
@@ -82,10 +77,7 @@
}
return printStream;
}
-
- /* (non-Javadoc)
- * @see org.jnode.shell.io.CommandIOIF#getWriter()
- */
+
public synchronized Writer getWriter() throws CommandIOException {
if (writer == null) {
try {
@@ -97,9 +89,6 @@
return writer;
}
- /* (non-Javadoc)
- * @see org.jnode.shell.io.CommandIOIF#getPrintWriter()
- */
public PrintWriter getPrintWriter() {
if (printWriter == null) {
if (writer instanceof PrintWriter) {
@@ -110,20 +99,14 @@
}
return printWriter;
}
-
- /* (non-Javadoc)
- * @see org.jnode.shell.io.CommandIOIF#getInputStream()
- */
+
public synchronized InputStream getInputStream() {
if (inputStream == null) {
inputStream = new ReaderInputStream(reader, getEncoding());
}
return inputStream;
}
-
- /* (non-Javadoc)
- * @see org.jnode.shell.io.CommandIOIF#getReader()
- */
+
public Reader getReader() throws CommandIOException {
if (reader == null) {
try {
@@ -134,25 +117,21 @@
}
return reader;
}
-
- /* (non-Javadoc)
- * @see org.jnode.shell.io.CommandIOIF#getDirection()
- */
+
public final int getDirection() {
return DIRECTION_INOUT;
}
- /* (non-Javadoc)
- * @see org.jnode.shell.io.CommandIOIF#isTTY()
- */
@Override
public boolean isTTY() {
- return false;
+ Object obj = getSystemObject();
+ if (obj instanceof Writer) {
+ return IOUtils.isTTY((Writer) obj);
+ } else {
+ return IOUtils.isTTY((OutputStream) obj);
+ }
}
- /* (non-Javadoc)
- * @see org.jnode.shell.io.CommandIOIF#close()
- */
@Override
public void close() throws IOException {
flush();
Modified: trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -30,6 +30,7 @@
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import org.jnode.util.IOUtils;
import org.jnode.util.WriterOutputStream;
/**
@@ -99,7 +100,12 @@
@Override
public boolean isTTY() {
- return false;
+ Object obj = getSystemObject();
+ if (obj instanceof Writer) {
+ return IOUtils.isTTY((Writer) obj);
+ } else {
+ return IOUtils.isTTY((OutputStream) obj);
+ }
}
public void close() throws IOException {
Modified: trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -53,6 +53,8 @@
import java.util.Formatter;
import java.util.Locale;
+import org.jnode.util.ProxyStream;
+
/**
* This class provides some infrastructure for PrintStream proxies.
*
Modified: trunk/shell/src/shell/org/jnode/shell/proclet/ProcletContext.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/ProcletContext.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/ProcletContext.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -30,6 +30,8 @@
import org.jnode.shell.CommandThread;
import org.jnode.shell.CommandThreadImpl;
+import org.jnode.util.ProxyStream;
+import org.jnode.util.ProxyStreamException;
import org.jnode.vm.VmExit;
import org.jnode.vm.VmSystem;
Modified: trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -24,6 +24,7 @@
import java.io.InputStream;
import java.io.PrintStream;
+import org.jnode.util.ProxyStreamException;
import org.jnode.vm.IOContext;
import org.jnode.vm.VmSystem;
Modified: trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyInputStream.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyInputStream.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyInputStream.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -24,6 +24,8 @@
import java.io.IOException;
import java.io.InputStream;
+import org.jnode.util.ProxyStream;
+import org.jnode.util.ProxyStreamException;
import org.jnode.vm.VmSystem;
/**
Modified: trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyPrintStream.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyPrintStream.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyPrintStream.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -23,6 +23,8 @@
import java.io.PrintStream;
+import org.jnode.util.ProxyStream;
+import org.jnode.util.ProxyStreamException;
import org.jnode.vm.VmSystem;
/**
Modified: trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyStream.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyStream.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyStream.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -23,6 +23,8 @@
import java.io.Closeable;
+import org.jnode.util.ProxyStream;
+
interface ProcletProxyStream<T extends Closeable> extends ProxyStream<T> {
}
Deleted: trunk/shell/src/shell/org/jnode/shell/proclet/ProxyStream.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/ProxyStream.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/ProxyStream.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -1,61 +0,0 @@
-/*
- * $Id: ThreadCommandInvoker.java 3374 2007-08-02 18:15:27Z lsantha $
- *
- * JNode.org
- * Copyright (C) 2007-2008 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.proclet;
-
-import java.io.Closeable;
-
-/**
- * Proxy streams have an underlying stream and offer methods for getting that
- * stream.
- *
- * @author cr...@jn...
- */
-public interface ProxyStream<T extends Closeable> {
-
- /**
- * Get the underlying (non-proxy) stream for this proxy. If there are
- * multiple layers of proxying, these are unwound.
- *
- * @return a real (non-proxied) stream.
- */
- public T getRealStream() throws ProxyStreamException;
-
- /**
- * Get the stream that this proxy stream wraps. The result may also be a
- * proxy stream.
- *
- * @return the wrapped stream for this proxy.
- */
- public T getProxiedStream() throws ProxyStreamException;
-
- /**
- * Determine if this proxy refers to the same underlying stream as another
- * stream object.
- *
- * @param other
- * @return <code>true</code> if this object and <code>other</code>
- * resolve to the same underlying stream, otherwise false. Note: the
- * 'otherwise' covers cases where <code>other</code> is
- * <code>null</code>.
- */
- public boolean sameStream(T other) throws ProxyStreamException;
-}
Deleted: trunk/shell/src/shell/org/jnode/shell/proclet/ProxyStreamException.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/ProxyStreamException.java 2008-09-20 19:37:34 UTC (rev 4566)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/ProxyStreamException.java 2008-09-21 04:44:44 UTC (rev 4567)
@@ -1,44 +0,0 @@
-/*
- * $Id: ThreadCommandInvoker.java 3374 2007-08-02 18:15:27Z lsantha $
- *
- * JNode.org
- * Copyright (C) 2007-2008 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.proclet;
-
-import java.io.IOException;
-
-/**
- * This exception indicates an error in a proxy stream mechanism
- *
- * @author cr...@jn...
- */
-public class ProxyStreamException extends IOException {
-
- private static final long serialVersionUID = 1L;
-
- public ProxyStreamException(String message) {
- super(message);
- }
-
- public ProxyStreamException(String message, Throwable ex) {
- super(message);
- this.initCause(ex);
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-09-21 05:07:28
|
Revision: 4568
http://jnode.svn.sourceforge.net/jnode/?rev=4568&view=rev
Author: crawley
Date: 2008-09-21 05:07:23 +0000 (Sun, 21 Sep 2008)
Log Message:
-----------
Added a method to the CommandIO to get the base Closeable for the object.
For example, this can be used to get a KeyboardReader / ConsoleWriter.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/util/IOUtils.java
trunk/shell/src/shell/org/jnode/shell/io/BaseCommandIO.java
trunk/shell/src/shell/org/jnode/shell/io/CommandIO.java
trunk/shell/src/shell/org/jnode/shell/io/CommandIOMarker.java
trunk/shell/src/shell/org/jnode/shell/io/CommandInput.java
trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java
trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java
Modified: trunk/core/src/core/org/jnode/util/IOUtils.java
===================================================================
--- trunk/core/src/core/org/jnode/util/IOUtils.java 2008-09-21 04:44:44 UTC (rev 4567)
+++ trunk/core/src/core/org/jnode/util/IOUtils.java 2008-09-21 05:07:23 UTC (rev 4568)
@@ -77,6 +77,32 @@
}
}
+ public static Closeable findBaseStream(Closeable stream) {
+ if (stream instanceof ConsoleStream) {
+ return stream;
+ } else if (stream instanceof ProxyStream<?>) {
+ try {
+ return findBaseStream(((ProxyStream<?>) stream).getRealStream());
+ } catch (ProxyStreamException ex) {
+ return null;
+ }
+ } else if (stream instanceof OutputStreamWriter) {
+ return findBaseStream(findOutputStream((OutputStreamWriter) stream));
+ } else if (stream instanceof InputStreamReader) {
+ return findBaseStream(findInputStream((InputStreamReader) stream));
+ } else if (stream instanceof ReaderInputStream) {
+ return findBaseStream(((ReaderInputStream) stream).getReader());
+ } else if (stream instanceof WriterOutputStream) {
+ return findBaseStream(((WriterOutputStream) stream).getWriter());
+ } else if (stream instanceof FilterInputStream) {
+ return findBaseStream(findInputStream((FilterInputStream) stream));
+ } else if (stream instanceof FilterOutputStream) {
+ return findBaseStream(findOutputStream((FilterOutputStream) stream));
+ } else {
+ return stream;
+ }
+ }
+
private static InputStream findInputStream(final FilterInputStream inputStream) {
return new PrivilegedAction<InputStream>() {
public InputStream run() {
Modified: trunk/shell/src/shell/org/jnode/shell/io/BaseCommandIO.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/BaseCommandIO.java 2008-09-21 04:44:44 UTC (rev 4567)
+++ trunk/shell/src/shell/org/jnode/shell/io/BaseCommandIO.java 2008-09-21 05:07:23 UTC (rev 4568)
@@ -20,15 +20,18 @@
*/
package org.jnode.shell.io;
+import java.io.Closeable;
import java.io.IOException;
import java.nio.charset.Charset;
+import org.jnode.util.IOUtils;
+
abstract class BaseCommandIO implements CommandIO {
private String assignedEncoding;
- private final Object systemObject;
+ private final Closeable systemObject;
- BaseCommandIO(Object systemObject) {
+ BaseCommandIO(Closeable systemObject) {
this.systemObject = systemObject;
}
@@ -46,11 +49,22 @@
return Charset.defaultCharset().name();
}
- public final Object getSystemObject() {
+ public final Closeable getSystemObject() {
return systemObject;
}
+
+ @Override
+ public Closeable findBaseStream() {
+ return IOUtils.findBaseStream(systemObject);
+ }
- public abstract boolean isTTY();
+ public final boolean isTTY() {
+ if (systemObject == null) {
+ return false;
+ } else {
+ return IOUtils.isTTY(systemObject);
+ }
+ }
public abstract void close() throws IOException;
Modified: trunk/shell/src/shell/org/jnode/shell/io/CommandIO.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/CommandIO.java 2008-09-21 04:44:44 UTC (rev 4567)
+++ trunk/shell/src/shell/org/jnode/shell/io/CommandIO.java 2008-09-21 05:07:23 UTC (rev 4568)
@@ -20,6 +20,7 @@
*/
package org.jnode.shell.io;
+import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -103,6 +104,16 @@
public boolean isTTY();
/**
+ * Obtain the 'base' stream object for this CommandIO. This will be
+ * as close as we can get to the real device Reader, Writer, InputStream
+ * or OutputStream.
+ *
+ * @return the base stream, or <code>null</code> if there is a problem
+ * resolving the stream.
+ */
+ public Closeable findBaseStream();
+
+ /**
* Close this CommandIO's associated byte and / or character streams,
* including any that were returned via the get... methods.
*
Modified: trunk/shell/src/shell/org/jnode/shell/io/CommandIOMarker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/CommandIOMarker.java 2008-09-21 04:44:44 UTC (rev 4567)
+++ trunk/shell/src/shell/org/jnode/shell/io/CommandIOMarker.java 2008-09-21 05:07:23 UTC (rev 4568)
@@ -50,11 +50,6 @@
public int getDirection() {
return DIRECTION_UNSPECIFIED;
}
-
- @Override
- public boolean isTTY() {
- return false;
- }
public void close() {
// do nothing.
Modified: trunk/shell/src/shell/org/jnode/shell/io/CommandInput.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/CommandInput.java 2008-09-21 04:44:44 UTC (rev 4567)
+++ trunk/shell/src/shell/org/jnode/shell/io/CommandInput.java 2008-09-21 05:07:23 UTC (rev 4568)
@@ -30,7 +30,6 @@
import java.io.UnsupportedEncodingException;
import java.io.Writer;
-import org.jnode.util.IOUtils;
import org.jnode.util.ReaderInputStream;
/**
@@ -76,16 +75,6 @@
return DIRECTION_IN;
}
- @Override
- public boolean isTTY() {
- Object obj = getSystemObject();
- if (obj instanceof Reader) {
- return IOUtils.isTTY((Reader) obj);
- } else {
- return IOUtils.isTTY((InputStream) obj);
- }
- }
-
public void close() throws IOException {
if (inputStream != null) {
inputStream.close();
Modified: trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java 2008-09-21 04:44:44 UTC (rev 4567)
+++ trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java 2008-09-21 05:07:23 UTC (rev 4568)
@@ -31,7 +31,6 @@
import java.io.UnsupportedEncodingException;
import java.io.Writer;
-import org.jnode.util.IOUtils;
import org.jnode.util.ReaderInputStream;
import org.jnode.util.WriterOutputStream;
@@ -121,18 +120,8 @@
public final int getDirection() {
return DIRECTION_INOUT;
}
-
+
@Override
- public boolean isTTY() {
- Object obj = getSystemObject();
- if (obj instanceof Writer) {
- return IOUtils.isTTY((Writer) obj);
- } else {
- return IOUtils.isTTY((OutputStream) obj);
- }
- }
-
- @Override
public void close() throws IOException {
flush();
Modified: trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java 2008-09-21 04:44:44 UTC (rev 4567)
+++ trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java 2008-09-21 05:07:23 UTC (rev 4568)
@@ -30,7 +30,6 @@
import java.io.UnsupportedEncodingException;
import java.io.Writer;
-import org.jnode.util.IOUtils;
import org.jnode.util.WriterOutputStream;
/**
@@ -98,16 +97,6 @@
return DIRECTION_OUT;
}
- @Override
- public boolean isTTY() {
- Object obj = getSystemObject();
- if (obj instanceof Writer) {
- return IOUtils.isTTY((Writer) obj);
- } else {
- return IOUtils.isTTY((OutputStream) obj);
- }
- }
-
public void close() throws IOException {
flush();
if (printWriter != null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-09-21 07:29:39
|
Revision: 4572
http://jnode.svn.sourceforge.net/jnode/?rev=4572&view=rev
Author: crawley
Date: 2008-09-21 07:29:35 +0000 (Sun, 21 Sep 2008)
Log Message:
-----------
Checkstyle changes
Modified Paths:
--------------
trunk/core/src/core/org/jnode/log4j/config/JNodeSystemAppender.java
trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java
trunk/core/src/core/org/jnode/util/IOUtils.java
trunk/core/src/core/org/jnode/util/ReaderInputStream.java
trunk/core/src/core/org/jnode/vm/Vm.java
trunk/core/src/core/org/jnode/vm/scheduler/VmThreadQueueEntry.java
trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86StackManager.java
trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/VirtualStack.java
trunk/core/src/core/org/jnode/vm/x86/compiler/l1b/VirtualStack.java
trunk/core/src/driver/org/jnode/driver/console/ActiveTextConsole.java
trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleWriter.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsoleManager.java
trunk/distr/src/apps/org/jnode/apps/telnetd/RemoteConsoleManager.java
trunk/distr/src/apps/org/jnode/games/tetris/package-info.java
trunk/distr/src/emu/org/jnode/emu/Emu.java
trunk/net/src/net/org/jnode/net/command/WgetCommand.java
Modified: trunk/core/src/core/org/jnode/log4j/config/JNodeSystemAppender.java
===================================================================
--- trunk/core/src/core/org/jnode/log4j/config/JNodeSystemAppender.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/core/org/jnode/log4j/config/JNodeSystemAppender.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -25,11 +25,8 @@
import java.io.PrintStream;
import java.io.Writer;
-import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Layout;
import org.apache.log4j.WriterAppender;
-import org.jnode.driver.console.TextConsole;
-import org.jnode.util.WriterOutputStream;
/**
* Custom Log4j appender class for appending to the current System.out or System.err.
Modified: trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java
===================================================================
--- trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -22,19 +22,15 @@
package org.jnode.log4j.config;
import java.awt.event.KeyEvent;
-import java.io.IOException;
import java.io.PrintStream;
-import java.io.Writer;
import java.util.Enumeration;
import javax.naming.NameNotFoundException;
import org.apache.log4j.Appender;
-import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
-import org.apache.log4j.WriterAppender;
import org.jnode.driver.console.ActiveTextConsole;
import org.jnode.driver.console.ConsoleManager;
import org.jnode.driver.console.TextConsole;
Modified: trunk/core/src/core/org/jnode/util/IOUtils.java
===================================================================
--- trunk/core/src/core/org/jnode/util/IOUtils.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/core/org/jnode/util/IOUtils.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -27,15 +27,12 @@
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
-import java.io.PrintStream;
import java.io.Reader;
import java.io.Writer;
import java.lang.reflect.Field;
import java.security.PrivilegedAction;
import org.apache.log4j.Logger;
-import org.jnode.driver.console.spi.ConsoleWriter;
-import org.jnode.driver.console.textscreen.KeyboardReader;
/**
* Common utility code for higher-level operations on IO streams. Notwithstanding the
@@ -104,7 +101,7 @@
}
private static InputStream findInputStream(final FilterInputStream inputStream) {
- return new PrivilegedAction<InputStream>() {
+ PrivilegedAction<InputStream> pa = new PrivilegedAction<InputStream>() {
public InputStream run() {
try {
Class<FilterInputStream> cls = FilterInputStream.class;
@@ -115,11 +112,13 @@
Logger.getLogger(IOUtils.class).error("Cannot extract the 'in' field", ex);
return null;
}
- }}.run();
+ }
+ };
+ return pa.run();
}
private static OutputStream findOutputStream(final FilterOutputStream outputStream) {
- return new PrivilegedAction<OutputStream>() {
+ PrivilegedAction<OutputStream> pa = new PrivilegedAction<OutputStream>() {
public OutputStream run() {
try {
Class<FilterOutputStream> cls = FilterOutputStream.class;
@@ -130,14 +129,16 @@
Logger.getLogger(IOUtils.class).error("Cannot extract the 'out' field", ex);
return null;
}
- }}.run();
+ }
+ };
+ return pa.run();
}
private static OutputStream findOutputStream(final OutputStreamWriter writer) {
// This implementation is based on the knowledge that an OutputStreamWriter
// uses the underlying OutputStream as its 'lock' object.
- return new PrivilegedAction<OutputStream>() {
+ PrivilegedAction<OutputStream> pa = new PrivilegedAction<OutputStream>() {
public OutputStream run() {
try {
Class<Writer> cls = Writer.class;
@@ -148,13 +149,15 @@
Logger.getLogger(IOUtils.class).error("Cannot extract the 'lock' field", ex);
return null;
}
- }}.run();
+ }
+ };
+ return pa.run();
}
private static InputStream findInputStream(final InputStreamReader reader) {
// This implementation is based on the knowledge that an InputStreamReader
// uses the underlying InputStream as its 'lock' object.
- return new PrivilegedAction<InputStream>() {
+ PrivilegedAction<InputStream> pa = new PrivilegedAction<InputStream>() {
public InputStream run() {
try {
Class<Reader> cls = Reader.class;
@@ -165,7 +168,9 @@
Logger.getLogger(IOUtils.class).error("Cannot extract the 'lock' field", ex);
return null;
}
- }}.run();
+ }
+ };
+ return pa.run();
}
}
Modified: trunk/core/src/core/org/jnode/util/ReaderInputStream.java
===================================================================
--- trunk/core/src/core/org/jnode/util/ReaderInputStream.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/core/org/jnode/util/ReaderInputStream.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
-import java.io.Writer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
Modified: trunk/core/src/core/org/jnode/vm/Vm.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/Vm.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/core/org/jnode/vm/Vm.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -51,7 +51,6 @@
import org.jnode.vm.memmgr.VmHeapManager;
import org.jnode.vm.scheduler.VmProcessor;
import org.jnode.vm.scheduler.VmScheduler;
-import org.vmmagic.pragma.NoInlinePragma;
/**
* @author Ewout Prangsma (ep...@us...)
Modified: trunk/core/src/core/org/jnode/vm/scheduler/VmThreadQueueEntry.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/scheduler/VmThreadQueueEntry.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/core/org/jnode/vm/scheduler/VmThreadQueueEntry.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -25,7 +25,6 @@
import org.jnode.vm.VmSystemObject;
import org.jnode.vm.annotation.KernelSpace;
import org.jnode.vm.annotation.Uninterruptible;
-import org.vmmagic.pragma.UninterruptiblePragma;
/**
* Queue entry for VmThread's.
Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86StackManager.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86StackManager.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86StackManager.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -22,7 +22,6 @@
package org.jnode.vm.x86.compiler;
import org.jnode.assembler.x86.X86Register;
-import org.jnode.vm.JvmType;
/**
* @author Ewout Prangsma (ep...@us...)
Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/VirtualStack.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/VirtualStack.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/VirtualStack.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -23,7 +23,6 @@
import org.jnode.assembler.x86.X86Assembler;
import org.jnode.assembler.x86.X86Register;
-import org.jnode.assembler.x86.X86Register.GPR64;
import org.jnode.vm.JvmType;
import org.jnode.vm.Vm;
import org.jnode.vm.bytecode.TypeStack;
Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1b/VirtualStack.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/x86/compiler/l1b/VirtualStack.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1b/VirtualStack.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -23,7 +23,6 @@
import org.jnode.assembler.x86.X86Assembler;
import org.jnode.assembler.x86.X86Register;
-import org.jnode.assembler.x86.X86Register.GPR64;
import org.jnode.vm.JvmType;
import org.jnode.vm.Vm;
import org.jnode.vm.bytecode.TypeStack;
@@ -37,11 +36,11 @@
// and ensure consistency and correctness
final class VirtualStack {
- // explicitely check that elements on the operant stack
+ // explicitly check that elements on the operand stack
// are popped in the appropriate order
static final boolean checkOperandStack = true;
- // explicitely check that elements on the FPU stack
+ // explicitly check that elements on the FPU stack
// are popped in the appropriate order
static final boolean checkFpuStack = true;
Modified: trunk/core/src/driver/org/jnode/driver/console/ActiveTextConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/ActiveTextConsole.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/driver/org/jnode/driver/console/ActiveTextConsole.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -1,10 +1,8 @@
package org.jnode.driver.console;
-import java.io.FilterWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
-import java.nio.CharBuffer;
/**
* This virtual console class operates on the console that has the current focus.
Modified: trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleWriter.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleWriter.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/driver/org/jnode/driver/console/spi/ConsoleWriter.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -23,9 +23,9 @@
import java.io.IOException;
import java.io.Writer;
+
import org.jnode.driver.console.TextConsole;
import org.jnode.util.ConsoleStream;
-import org.jnode.vm.Unsafe;
/**
* @author epr
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -3,7 +3,6 @@
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.io.Reader;
-import java.io.PrintStream;
import java.io.Writer;
import org.jnode.driver.console.InputCompleter;
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsoleManager.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsoleManager.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsoleManager.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -33,7 +33,6 @@
import org.jnode.driver.textscreen.TextScreenManager;
import org.jnode.naming.InitialNaming;
import org.jnode.naming.NameSpaceListener;
-import org.jnode.vm.Unsafe;
/**
* @author Ewout Prangsma (ep...@us...)
Modified: trunk/distr/src/apps/org/jnode/apps/telnetd/RemoteConsoleManager.java
===================================================================
--- trunk/distr/src/apps/org/jnode/apps/telnetd/RemoteConsoleManager.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/distr/src/apps/org/jnode/apps/telnetd/RemoteConsoleManager.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -1,6 +1,5 @@
package org.jnode.apps.telnetd;
-import java.io.InputStream;
import java.io.Reader;
import net.wimpi.telnetd.io.TerminalIO;
Modified: trunk/distr/src/apps/org/jnode/games/tetris/package-info.java
===================================================================
--- trunk/distr/src/apps/org/jnode/games/tetris/package-info.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/distr/src/apps/org/jnode/games/tetris/package-info.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -1,4 +1,4 @@
/**
* Simple Tetris game for JNode.
*/
-package org.jnode.games.tetris;
\ No newline at end of file
+package org.jnode.games.tetris;
Modified: trunk/distr/src/emu/org/jnode/emu/Emu.java
===================================================================
--- trunk/distr/src/emu/org/jnode/emu/Emu.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/distr/src/emu/org/jnode/emu/Emu.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -7,13 +7,13 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+
import javax.naming.NameAlreadyBoundException;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
import org.jnode.naming.AbstractNameSpace;
import org.jnode.naming.InitialNaming;
-import org.jnode.naming.NameSpace;
import org.jnode.nanoxml.XMLElement;
import org.jnode.shell.ShellManager;
import org.jnode.shell.alias.AliasManager;
Modified: trunk/net/src/net/org/jnode/net/command/WgetCommand.java
===================================================================
--- trunk/net/src/net/org/jnode/net/command/WgetCommand.java 2008-09-21 06:02:17 UTC (rev 4571)
+++ trunk/net/src/net/org/jnode/net/command/WgetCommand.java 2008-09-21 07:29:35 UTC (rev 4572)
@@ -42,7 +42,7 @@
private PrintStream out;
private PrintStream err;
- public WgetCommand(){
+ public WgetCommand() {
super("Fetch the contents of one or more URLs.");
registerArguments(ARG_SOURCE, ARG_DEBUG);
}
@@ -121,10 +121,10 @@
}
is.close();
} finally {
- if (is != null){
+ if (is != null) {
is.close();
}
- if (bos != null){
+ if (bos != null) {
bos.close();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-09-27 07:30:55
|
Revision: 4583
http://jnode.svn.sourceforge.net/jnode/?rev=4583&view=rev
Author: lsantha
Date: 2008-09-27 07:30:38 +0000 (Sat, 27 Sep 2008)
Log Message:
-----------
Removed redundant type casts.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/nio/VMDirectByteBuffer.java
trunk/core/src/core/org/jnode/system/x86/DMA.java
trunk/core/src/core/org/jnode/vm/VmSystem.java
trunk/core/src/core/org/jnode/vm/x86/PIC8259A.java
trunk/core/src/driver/org/jnode/driver/DeviceUtils.java
trunk/core/src/driver/org/jnode/driver/bus/firewire/FireWireDriver.java
trunk/core/src/driver/org/jnode/driver/bus/pci/PCIDriver.java
trunk/core/src/driver/org/jnode/driver/bus/pcmcia/CardBusDriver.java
trunk/core/src/driver/org/jnode/driver/bus/usb/AbstractHostControllerDriver.java
trunk/core/src/driver/org/jnode/driver/bus/usb/uhci/UHCICore.java
trunk/core/src/driver/org/jnode/driver/chipset/i440BX/i82371AB_ACPI_SMBusControler.java
trunk/core/src/driver/org/jnode/driver/serial/SerialPortDriver.java
trunk/core/src/driver/org/jnode/driver/system/acpi/AcpiDriver.java
trunk/core/src/driver/org/jnode/driver/system/cmos/def/CMOS.java
trunk/core/src/driver/org/jnode/driver/system/firmware/bios/BiosDriver.java
trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java
trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java
trunk/gui/src/awt/org/jnode/awt/util/BitmapGraphics.java
trunk/gui/src/driver/org/jnode/driver/ps2/PS2Bus.java
trunk/gui/src/driver/org/jnode/driver/sound/speaker/SpeakerUtils.java
trunk/gui/src/driver/org/jnode/driver/sound/speaker/pc/PCSpeakerDriver.java
trunk/gui/src/driver/org/jnode/driver/video/AbstractFrameBufferDriver.java
trunk/gui/src/driver/org/jnode/driver/video/ati/radeon/RadeonCore.java
trunk/gui/src/driver/org/jnode/driver/video/nvidia/NVidiaCore.java
trunk/gui/src/driver/org/jnode/driver/video/vesa/VESACore.java
trunk/gui/src/driver/org/jnode/driver/video/vga/StandardVGAIO.java
trunk/gui/src/driver/org/jnode/driver/video/vmware/VMWareCore.java
trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xCore.java
trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xCore.java
trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Core.java
trunk/net/src/driver/org/jnode/driver/net/lance/LanceCore.java
trunk/net/src/driver/org/jnode/driver/net/ne2000/Ne2000Core.java
trunk/net/src/driver/org/jnode/driver/net/prism2/Prism2Core.java
trunk/net/src/driver/org/jnode/driver/net/rtl8139/RTL8139Core.java
trunk/net/src/net/org/jnode/net/command/DhcpCommand.java
trunk/net/src/net/org/jnode/net/command/RouteCommand.java
trunk/net/src/net/org/jnode/net/ipv4/config/impl/Route.java
trunk/net/src/test/org/jnode/test/net/ARPTest.java
trunk/net/src/test/org/jnode/test/net/NetTest.java
trunk/shell/src/shell/org/jnode/shell/CommandShell.java
trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneShellPlugin.java
trunk/shell/src/shell/org/jnode/shell/command/plugin/PluginCommand.java
trunk/shell/src/shell/org/jnode/shell/help/argument/DeviceArgument.java
trunk/shell/src/shell/org/jnode/shell/help/argument/PluginArgument.java
trunk/shell/src/shell/org/jnode/shell/syntax/PluginArgument.java
Modified: trunk/core/src/classpath/vm/java/nio/VMDirectByteBuffer.java
===================================================================
--- trunk/core/src/classpath/vm/java/nio/VMDirectByteBuffer.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/classpath/vm/java/nio/VMDirectByteBuffer.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -103,8 +103,7 @@
public MemoryRawData(int size) {
try {
- final ResourceManager rm = (ResourceManager) InitialNaming
- .lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
final ResourceOwner owner = new SimpleResourceOwner("java.nio");
this.resource = rm.claimMemoryResource(owner, null, size,
ResourceManager.MEMMODE_NORMAL);
Modified: trunk/core/src/core/org/jnode/system/x86/DMA.java
===================================================================
--- trunk/core/src/core/org/jnode/system/x86/DMA.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/core/org/jnode/system/x86/DMA.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -110,7 +110,7 @@
public DMA() throws DMAException {
final ResourceManager rm;
try {
- rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ rm = InitialNaming.lookup(ResourceManager.NAME);
} catch (NameNotFoundException ex) {
throw new DMAException("Cannot find ResourceManager", ex);
}
Modified: trunk/core/src/core/org/jnode/vm/VmSystem.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmSystem.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/core/org/jnode/vm/VmSystem.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -1013,8 +1013,7 @@
exitCode = (reset ? 1 : 0);
inShutdown = true;
try {
- final PluginManager pm = (PluginManager) InitialNaming
- .lookup(PluginManager.NAME);
+ final PluginManager pm = InitialNaming.lookup(PluginManager.NAME);
pm.stopPlugins();
} catch (NameNotFoundException ex) {
System.err.println("Cannot find ServiceManager");
Modified: trunk/core/src/core/org/jnode/vm/x86/PIC8259A.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/x86/PIC8259A.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/core/org/jnode/vm/x86/PIC8259A.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -40,7 +40,7 @@
final SimpleResourceOwner owner = new SimpleResourceOwner("PIC8259A");
try {
- final ResourceManager rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
io8259_A = rm.claimIOResource(owner, 0x20, 1); // 0xA0
io8259_B = rm.claimIOResource(owner, 0xA0, 1);
} catch (NameNotFoundException ex) {
Modified: trunk/core/src/driver/org/jnode/driver/DeviceUtils.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/DeviceUtils.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/DeviceUtils.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -47,7 +47,7 @@
public static DeviceManager getDeviceManager()
throws NameNotFoundException {
if (dm == null) {
- dm = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME);
+ dm = InitialNaming.lookup(DeviceManager.NAME);
}
return dm;
}
Modified: trunk/core/src/driver/org/jnode/driver/bus/firewire/FireWireDriver.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/bus/firewire/FireWireDriver.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/bus/firewire/FireWireDriver.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -50,7 +50,7 @@
final Device device = getDevice();
final DeviceManager dm;
try {
- dm = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME);
+ dm = InitialNaming.lookup(DeviceManager.NAME);
dm.rename(device, getDevicePrefix(), true);
} catch (DeviceAlreadyRegisteredException ex) {
log.error("Cannot rename device", ex);
Modified: trunk/core/src/driver/org/jnode/driver/bus/pci/PCIDriver.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/bus/pci/PCIDriver.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/bus/pci/PCIDriver.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -89,8 +89,7 @@
public void startDevice() throws DriverException {
try {
final Device pciBusDevice = getDevice();
- final ResourceManager rm = (ResourceManager) InitialNaming
- .lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
// Claim the resources
pciConfigIO = claimPorts(rm, pciBusDevice);
// Register the API's
@@ -122,7 +121,7 @@
// Stop & unregister all PCI devices
DeviceManager devMan;
try {
- devMan = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME);
+ devMan = InitialNaming.lookup(DeviceManager.NAME);
} catch (NameNotFoundException ex) {
throw new DriverException("Cannot find device manager", ex);
}
Modified: trunk/core/src/driver/org/jnode/driver/bus/pcmcia/CardBusDriver.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/bus/pcmcia/CardBusDriver.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/bus/pcmcia/CardBusDriver.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -52,7 +52,7 @@
final Device device = getDevice();
final DeviceManager dm;
try {
- dm = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME);
+ dm = InitialNaming.lookup(DeviceManager.NAME);
dm.rename(device, getDevicePrefix(), true);
} catch (DeviceAlreadyRegisteredException ex) {
log.error("Cannot rename device", ex);
Modified: trunk/core/src/driver/org/jnode/driver/bus/usb/AbstractHostControllerDriver.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/bus/usb/AbstractHostControllerDriver.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/bus/usb/AbstractHostControllerDriver.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -53,7 +53,7 @@
final Device device = getDevice();
final DeviceManager dm;
try {
- dm = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME);
+ dm = InitialNaming.lookup(DeviceManager.NAME);
dm.rename(device, getDevicePrefix(), true);
} catch (DeviceAlreadyRegisteredException ex) {
log.error("Cannot rename device", ex);
Modified: trunk/core/src/driver/org/jnode/driver/bus/usb/uhci/UHCICore.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/bus/usb/uhci/UHCICore.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/bus/usb/uhci/UHCICore.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -93,7 +93,7 @@
final PCIDeviceConfig cfg = device.getConfig();
final PCIBaseAddress baseAddr = getBaseAddress(cfg);
try {
- this.rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ this.rm = InitialNaming.lookup(ResourceManager.NAME);
final int ioBase = baseAddr.getIOBase();
final int ioSize = baseAddr.getSize();
log.info("Found UHCI at 0x" + NumberUtils.hex(ioBase));
Modified: trunk/core/src/driver/org/jnode/driver/chipset/i440BX/i82371AB_ACPI_SMBusControler.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/chipset/i440BX/i82371AB_ACPI_SMBusControler.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/chipset/i440BX/i82371AB_ACPI_SMBusControler.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -116,7 +116,7 @@
device.readConfigByte(0xd2);
try {
- final ResourceManager rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
try {
ioRes = claimPorts(rm, device, hostStatusIORegister, 14);
} catch (ResourceNotFreeException ex1) {
Modified: trunk/core/src/driver/org/jnode/driver/serial/SerialPortDriver.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/serial/SerialPortDriver.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/serial/SerialPortDriver.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -59,8 +59,7 @@
protected void startDevice() throws DriverException {
try {
- final ResourceManager rm = (ResourceManager) InitialNaming
- .lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
port = claimPorts(rm, getDevice(), basePort, 8);
configure(BAUD9600);
getDevice().registerAPI(SerialPortAPI.class, this);
Modified: trunk/core/src/driver/org/jnode/driver/system/acpi/AcpiDriver.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/system/acpi/AcpiDriver.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/system/acpi/AcpiDriver.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -92,9 +92,9 @@
final AcpiDevice dev = (AcpiDevice) getDevice();
try {
final ResourceManager rm;
- rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ rm = InitialNaming.lookup(ResourceManager.NAME);
mmapAcpiRegion();
- AcpiRSDPInfo acpiInfo = ((AcpiDevice) dev).getRsdpInfo();
+ AcpiRSDPInfo acpiInfo = dev.getRsdpInfo();
loadRootTable(rm, acpiInfo);
} catch (NameNotFoundException ex) {
throw new DriverException("Could not find ResourceManager", ex);
Modified: trunk/core/src/driver/org/jnode/driver/system/cmos/def/CMOS.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/system/cmos/def/CMOS.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/system/cmos/def/CMOS.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -48,7 +48,7 @@
public CMOS(ResourceOwner owner)
throws ResourceNotFreeException {
try {
- final ResourceManager rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
this.cmosIO = rm.claimIOResource(owner, CMOS_FIRST_PORT, CMOS_LAST_PORT - CMOS_FIRST_PORT + 1);
} catch (NameNotFoundException ex) {
throw new ResourceNotFreeException("Cannot find ResourceManager", ex);
Modified: trunk/core/src/driver/org/jnode/driver/system/firmware/bios/BiosDriver.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/system/firmware/bios/BiosDriver.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/system/firmware/bios/BiosDriver.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -69,7 +69,7 @@
// Find the ACPI info
try {
final ResourceManager rm;
- rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ rm = InitialNaming.lookup(ResourceManager.NAME);
info = findAcpiRSDTPTR(rm);
} catch (NameNotFoundException ex) {
throw new DriverException("Cannot find the resource manager");
Modified: trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -57,8 +57,7 @@
super(80, 25);
Address ptr = Address.fromIntZeroExtend(0xb8000);
try {
- final ResourceManager rm = (ResourceManager) InitialNaming
- .lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
final ResourceOwner owner = new SimpleResourceOwner("Screen");
memory = rm.claimMemoryResource(owner, ptr, getWidth()
* getHeight() * 2, ResourceManager.MEMMODE_NORMAL);
Modified: trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java
===================================================================
--- trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -264,11 +264,9 @@
// Claim the available heap region as resource.
try {
- final ResourceManager rm = InitialNaming
- .lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
final Address start = Memory.AVAILABLE_START();
- final Extent size = Memory.AVAILABLE_END().toWord().sub(
- start.toWord()).toExtent();
+ final Extent size = Memory.AVAILABLE_END().toWord().sub(start.toWord()).toExtent();
heapResource = rm.claimMemoryResource(ResourceOwner.SYSTEM, start,
size, ResourceManager.MEMMODE_NORMAL);
} catch (NameNotFoundException ex) {
Modified: trunk/gui/src/awt/org/jnode/awt/util/BitmapGraphics.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/util/BitmapGraphics.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/gui/src/awt/org/jnode/awt/util/BitmapGraphics.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -238,7 +238,7 @@
int width, int height, int bytesPerLine, int transparency) {
final ResourceManager rm;
try {
- rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ rm = InitialNaming.lookup(ResourceManager.NAME);
} catch (NamingException ex) {
throw new RuntimeException("Cannot find ResourceManager", ex);
}
Modified: trunk/gui/src/driver/org/jnode/driver/ps2/PS2Bus.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/ps2/PS2Bus.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/gui/src/driver/org/jnode/driver/ps2/PS2Bus.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -72,7 +72,7 @@
try {
final ResourceManager rm;
try {
- rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ rm = InitialNaming.lookup(ResourceManager.NAME);
} catch (NameNotFoundException ex) {
throw new DriverException("Cannot find ResourceManager: ", ex);
}
Modified: trunk/gui/src/driver/org/jnode/driver/sound/speaker/SpeakerUtils.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/sound/speaker/SpeakerUtils.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/gui/src/driver/org/jnode/driver/sound/speaker/SpeakerUtils.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -61,9 +61,9 @@
public static void beep() {
if (stdBeep == null) {
try {
- DeviceManager dm = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME);
+ DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
Device dev = dm.getDevice("speaker0");
- SpeakerAPI s = (SpeakerAPI) dev.getAPI(SpeakerAPI.class);
+ SpeakerAPI s = dev.getAPI(SpeakerAPI.class);
s.beep();
} catch (ApiNotFoundException anfex) {
log.error("Unable to beep: ", anfex);
@@ -79,9 +79,9 @@
/** Plays a series of notes through the default speaker * */
public static void play(Note[] n) {
try {
- DeviceManager dm = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME);
+ DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
Device dev = dm.getDevice("speaker0");
- SpeakerAPI s = (SpeakerAPI) dev.getAPI(SpeakerAPI.class);
+ SpeakerAPI s = dev.getAPI(SpeakerAPI.class);
s.playNote(n);
} catch (ApiNotFoundException anfex) {
log.error("Unable to beep: ", anfex);
Modified: trunk/gui/src/driver/org/jnode/driver/sound/speaker/pc/PCSpeakerDriver.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/sound/speaker/pc/PCSpeakerDriver.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/gui/src/driver/org/jnode/driver/sound/speaker/pc/PCSpeakerDriver.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -72,7 +72,7 @@
public void startDevice() throws DriverException {
try {
final Device dev = getDevice();
- final ResourceManager rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
speakIO = claimPorts(rm, dev, SPEAKER_PORT, 1);
pitIO = claimPorts(rm, dev, CHANNEL2_PORT, 2);
getDevice().registerAPI(SpeakerAPI.class, this);
Modified: trunk/gui/src/driver/org/jnode/driver/video/AbstractFrameBufferDriver.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/AbstractFrameBufferDriver.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/gui/src/driver/org/jnode/driver/video/AbstractFrameBufferDriver.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -52,7 +52,7 @@
protected void startDevice() throws DriverException {
final Device device = getDevice();
try {
- final DeviceManager dm = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME);
+ final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
dm.rename(device, getDevicePrefix() + "-" + device.getId(), false);
} catch (DeviceAlreadyRegisteredException ex) {
log.error("Cannot rename device", ex);
Modified: trunk/gui/src/driver/org/jnode/driver/video/ati/radeon/RadeonCore.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/ati/radeon/RadeonCore.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/gui/src/driver/org/jnode/driver/video/ati/radeon/RadeonCore.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -100,7 +100,7 @@
final PCIRomAddress romAddr = pciCfg.getRomAddress();
log.info("Found ATI " + model + ", chipset 0x" + NumberUtils.hex(pciCfg.getRevision()));
try {
- final ResourceManager rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
final int ioBase = (int) ioAddr.getMemoryBase();
final int ioSize = ioAddr.getSize();
final int fbBase = (int) fbAddr.getMemoryBase() /* & 0xFF800000 */;
Modified: trunk/gui/src/driver/org/jnode/driver/video/nvidia/NVidiaCore.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/nvidia/NVidiaCore.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/gui/src/driver/org/jnode/driver/video/nvidia/NVidiaCore.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -91,7 +91,7 @@
final PCIBaseAddress fbAddr = pciCfg.getBaseAddresses()[1];
log.info("Found NVidia " + model + ", chipset 0x" + NumberUtils.hex(pciCfg.getRevision()));
try {
- final ResourceManager rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
final int ioBase = (int) ioAddr.getMemoryBase() & 0xFF800000;
final int ioSize = ioAddr.getSize();
final int fbBase = (int) fbAddr.getMemoryBase() & 0xFF800000;
Modified: trunk/gui/src/driver/org/jnode/driver/video/vesa/VESACore.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/vesa/VESACore.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/gui/src/driver/org/jnode/driver/video/vesa/VESACore.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -93,7 +93,7 @@
Address address = Address.fromIntZeroExtend(modeInfoBlock.getRamBase());
try {
- final ResourceManager rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
this.capabilities = vbeInfoBlock.getCapabilities();
this.maxWidth = modeInfoBlock.getXResolution();
this.maxHeight = modeInfoBlock.getYResolution();
Modified: trunk/gui/src/driver/org/jnode/driver/video/vga/StandardVGAIO.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/vga/StandardVGAIO.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/gui/src/driver/org/jnode/driver/video/vga/StandardVGAIO.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -54,7 +54,7 @@
public StandardVGAIO(ResourceOwner owner, MemoryResource mem) throws ResourceNotFreeException,
DriverException {
try {
- ResourceManager rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
vgaIO = claimPorts(rm, owner, VGA_FIRST_PORT, VGA_LAST_PORT - VGA_FIRST_PORT + 1);
this.mem = mem;
current_mode = getColorMode();
Modified: trunk/gui/src/driver/org/jnode/driver/video/vmware/VMWareCore.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/vmware/VMWareCore.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/gui/src/driver/org/jnode/driver/video/vmware/VMWareCore.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -118,7 +118,7 @@
" and 0x" + NumberUtils.hex(valuePort));
try {
- final ResourceManager rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
ports = claimPorts(rm, device, basePort, SVGA_NUM_PORTS * 4);
final int id = getVMWareID();
if (id == SVGA_ID_0 || id == SVGA_ID_INVALID) {
Modified: trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xCore.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xCore.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/net/src/driver/org/jnode/driver/net/_3c90x/_3c90xCore.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -114,7 +114,7 @@
final int iolength = getIOLength(device, flags);
final ResourceManager rm;
try {
- rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ rm = InitialNaming.lookup(ResourceManager.NAME);
} catch (NameNotFoundException ex) {
throw new DriverException("Cannot find ResourceManager");
}
Modified: trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xCore.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xCore.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/net/src/driver/org/jnode/driver/net/bcm570x/BCM570xCore.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -116,7 +116,7 @@
final ResourceManager rm;
try {
- rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ rm = InitialNaming.lookup(ResourceManager.NAME);
} catch (NameNotFoundException ex) {
throw new DriverException("Cannot find ResourceManager");
}
Modified: trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Core.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Core.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Core.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -134,7 +134,7 @@
log.debug("Found EEPRO100 IOBase: 0x" + NumberUtils.hex(iobase) + ", length: " + iolength);
try {
- rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ rm = InitialNaming.lookup(ResourceManager.NAME);
} catch (NameNotFoundException ex) {
throw new DriverException("Cannot find ResourceManager");
}
Modified: trunk/net/src/driver/org/jnode/driver/net/lance/LanceCore.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/lance/LanceCore.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/net/src/driver/org/jnode/driver/net/lance/LanceCore.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -135,7 +135,7 @@
log.debug("Found Lance IOBase: 0x" + NumberUtils.hex(iobase) + ", length: " + iolength);
ResourceManager rm;
try {
- rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);
+ rm = InitialNaming.lookup(ResourceManager.NAME);
} catch (NameNotFoundException ex) {
throw new DriverException("Cannot find ResourceManager");
}
Modified: trunk/net/src/driver/org/jnode/driver/net/ne2000/Ne2000Core.java
===================================================================
--- trunk/net/src/driver/org/jnode/driver/net/ne2000/Ne2000Core.java 2008-09-26 17:18:55 UTC (rev 4582)
+++ trunk/net/src/driver/org/jnode/driver/net/ne2000/Ne2000Core.java 2008-09-27 07:30:38 UTC (rev 4583)
@@ -127,7 +127,7 @@
final int iolength = getIOLength(d...
[truncated message content] |
|
From: <ls...@us...> - 2008-09-27 07:47:19
|
Revision: 4585
http://jnode.svn.sourceforge.net/jnode/?rev=4585&view=rev
Author: lsantha
Date: 2008-09-27 07:47:11 +0000 (Sat, 27 Sep 2008)
Log Message:
-----------
Removed redundant type casts.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/debugger/Debugger.java
trunk/core/src/core/org/jnode/debugger/DebuggerPlugin.java
trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java
trunk/fs/src/test/org/jnode/test/fs/LowLevelIoTest.java
trunk/fs/src/test/org/jnode/test/support/TestUtils.java
trunk/gui/src/test/org/jnode/test/gui/DDC1Test.java
trunk/gui/src/test/org/jnode/test/gui/FBTest.java
trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java
trunk/net/src/net/org/jnode/net/command/WLanCtlCommand.java
trunk/net/src/net/org/jnode/net/ipv4/IPv4Route.java
trunk/net/src/net/org/jnode/net/ipv4/bootp/BOOTPClient.java
trunk/net/src/net/org/jnode/net/ipv4/config/impl/Ifconfig.java
trunk/net/src/net/org/jnode/net/ipv4/config/impl/NetStaticDeviceConfig.java
trunk/net/src/net/org/jnode/net/ipv4/config/impl/Route.java
trunk/net/src/net/org/jnode/net/ipv4/layer/IPv4Sender.java
trunk/net/src/net/org/jnode/net/service/DefaultNetworkLayerManager.java
trunk/net/src/net/org/jnode/net/service/NetAPIImpl.java
trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java
trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java
Modified: trunk/core/src/core/org/jnode/debugger/Debugger.java
===================================================================
--- trunk/core/src/core/org/jnode/debugger/Debugger.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/core/src/core/org/jnode/debugger/Debugger.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -150,8 +150,7 @@
final Collection<Device> devs = DeviceUtils
.getDevicesByAPI(KeyboardAPI.class);
for (Device dev : devs) {
- final KeyboardAPI api = (KeyboardAPI) dev
- .getAPI(KeyboardAPI.class);
+ final KeyboardAPI api = dev.getAPI(KeyboardAPI.class);
api.setPreferredListener(l);
}
} catch (ApiNotFoundException ex) {
Modified: trunk/core/src/core/org/jnode/debugger/DebuggerPlugin.java
===================================================================
--- trunk/core/src/core/org/jnode/debugger/DebuggerPlugin.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/core/src/core/org/jnode/debugger/DebuggerPlugin.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -100,8 +100,7 @@
private void addListeners(Device device) {
if (device.implementsAPI(SystemTriggerAPI.class)) {
try {
- final SystemTriggerAPI api = (SystemTriggerAPI) device
- .getAPI(SystemTriggerAPI.class);
+ final SystemTriggerAPI api = device.getAPI(SystemTriggerAPI.class);
api.addSystemTriggerListener(debugger);
} catch (ApiNotFoundException ex) {
// Ignore
@@ -109,8 +108,7 @@
}
if (device.implementsAPI(KeyboardAPI.class)) {
try {
- final KeyboardAPI api = (KeyboardAPI) device
- .getAPI(KeyboardAPI.class);
+ final KeyboardAPI api = device.getAPI(KeyboardAPI.class);
api.addKeyboardListener(debugger);
} catch (ApiNotFoundException ex) {
// Ignore
@@ -121,8 +119,7 @@
private void removeListeners(Device device) {
if (device.implementsAPI(SystemTriggerAPI.class)) {
try {
- final SystemTriggerAPI api = (SystemTriggerAPI) device
- .getAPI(SystemTriggerAPI.class);
+ final SystemTriggerAPI api = device.getAPI(SystemTriggerAPI.class);
api.removeSystemTriggerListener(debugger);
} catch (ApiNotFoundException ex) {
// Ignore
@@ -130,8 +127,7 @@
}
if (device.implementsAPI(KeyboardAPI.class)) {
try {
- final KeyboardAPI api = (KeyboardAPI) device
- .getAPI(KeyboardAPI.class);
+ final KeyboardAPI api = device.getAPI(KeyboardAPI.class);
api.removeKeyboardListener(debugger);
} catch (ApiNotFoundException ex) {
// Ignore
Modified: trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -131,7 +131,7 @@
*/
protected final void addPointerDevice(Device pDev) {
try {
- final PointerAPI pApi = (PointerAPI) pDev.getAPI(PointerAPI.class);
+ final PointerAPI pApi = pDev.getAPI(PointerAPI.class);
pointerDevs.add(pDev);
pApi.addPointerListener(this);
} catch (ApiNotFoundException ex) {
@@ -159,8 +159,7 @@
final void removePointer(Device pDev) {
if (pointerDevs.remove(pDev)) {
try {
- final PointerAPI pApi = (PointerAPI) pDev
- .getAPI(PointerAPI.class);
+ final PointerAPI pApi = pDev.getAPI(PointerAPI.class);
pApi.removePointerListener(this);
} catch (ApiNotFoundException ex) {
BootLog.error("PointerAPI not found", ex);
Modified: trunk/fs/src/test/org/jnode/test/fs/LowLevelIoTest.java
===================================================================
--- trunk/fs/src/test/org/jnode/test/fs/LowLevelIoTest.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/fs/src/test/org/jnode/test/fs/LowLevelIoTest.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -40,8 +40,7 @@
dm = InitialNaming.lookup(DeviceManager.NAME);
IDEDevice current = (IDEDevice) dm.getDevice(args[0]);
- BlockDeviceAPI api =
- current.getAPI(BlockDeviceAPI.class);
+ BlockDeviceAPI api = current.getAPI(BlockDeviceAPI.class);
int size = (int) (Math.random() * 5 /*256*/) * 512;
int offset = (int) (Math.random() * 10000) * 512;
Modified: trunk/fs/src/test/org/jnode/test/support/TestUtils.java
===================================================================
--- trunk/fs/src/test/org/jnode/test/support/TestUtils.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/fs/src/test/org/jnode/test/support/TestUtils.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -193,8 +193,7 @@
public static File copyDeviceToFile(Device imageDevice, String destFile)
throws SecurityException, IOException, ApiNotFoundException {
File dest = new File(destFile);
- BlockDeviceAPI imgApi = imageDevice
- .getAPI(BlockDeviceAPI.class);
+ BlockDeviceAPI imgApi = imageDevice.getAPI(BlockDeviceAPI.class);
if (dest.exists())
dest.delete();
@@ -245,8 +244,7 @@
public static void copyInputStreamToDevice(InputStream imageStream,
Device workDevice) throws ApiNotFoundException,
NameNotFoundException, IOException, FileSystemException {
- BlockDeviceAPI wrkApi = workDevice
- .getAPI(BlockDeviceAPI.class);
+ BlockDeviceAPI wrkApi = workDevice.getAPI(BlockDeviceAPI.class);
int sectorSize = 512;
byte[] sector = new byte[sectorSize];
@@ -265,10 +263,8 @@
public static void copyDevice(Device imageDevice, Device workDevice)
throws ApiNotFoundException, IOException {
- BlockDeviceAPI imgApi = imageDevice
- .getAPI(BlockDeviceAPI.class);
- BlockDeviceAPI wrkApi = workDevice
- .getAPI(BlockDeviceAPI.class);
+ BlockDeviceAPI imgApi = imageDevice.getAPI(BlockDeviceAPI.class);
+ BlockDeviceAPI wrkApi = workDevice.getAPI(BlockDeviceAPI.class);
if (imgApi.getLength() != wrkApi.getLength())
throw new IllegalArgumentException("devices of different length");
Modified: trunk/gui/src/test/org/jnode/test/gui/DDC1Test.java
===================================================================
--- trunk/gui/src/test/org/jnode/test/gui/DDC1Test.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/gui/src/test/org/jnode/test/gui/DDC1Test.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -44,7 +44,7 @@
final Device dev = DeviceUtils.getDevice(devId);
System.out.println("Reading DDC1 data, please wait");
- final DisplayDataChannelAPI api = (DisplayDataChannelAPI) dev.getAPI(DisplayDataChannelAPI.class);
+ final DisplayDataChannelAPI api = dev.getAPI(DisplayDataChannelAPI.class);
final DDC1Reader reader = new DDC1Reader(api);
final EDID data = reader.read();
Modified: trunk/gui/src/test/org/jnode/test/gui/FBTest.java
===================================================================
--- trunk/gui/src/test/org/jnode/test/gui/FBTest.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/gui/src/test/org/jnode/test/gui/FBTest.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -127,7 +127,7 @@
}
log.info("Using device " + dev.getId());
- final FrameBufferAPI api = (FrameBufferAPI) dev.getAPI(FrameBufferAPI.class);
+ final FrameBufferAPI api = dev.getAPI(FrameBufferAPI.class);
final FrameBufferConfiguration conf = api.getConfigurations()[0];
g = api.open(conf);
Modified: trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java
===================================================================
--- trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -333,7 +333,7 @@
*/
private NetDeviceAPI getAPI(Device device) {
try {
- return (NetDeviceAPI) device.getAPI(NetDeviceAPI.class);
+ return device.getAPI(NetDeviceAPI.class);
} catch (ApiNotFoundException ex) {
throw new IllegalArgumentException("Not a network device " + device.getId());
}
Modified: trunk/net/src/net/org/jnode/net/command/WLanCtlCommand.java
===================================================================
--- trunk/net/src/net/org/jnode/net/command/WLanCtlCommand.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/net/src/net/org/jnode/net/command/WLanCtlCommand.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -64,7 +64,7 @@
throws ApiNotFoundException, NetworkException {
final Device dev = ARG_DEVICE.getValue();
final WirelessNetDeviceAPI api;
- api = (WirelessNetDeviceAPI) dev.getAPI(WirelessNetDeviceAPI.class);
+ api = dev.getAPI(WirelessNetDeviceAPI.class);
// Perform the selected operation
if (FLAG_SET_ESSID.isSet()) {
Modified: trunk/net/src/net/org/jnode/net/ipv4/IPv4Route.java
===================================================================
--- trunk/net/src/net/org/jnode/net/ipv4/IPv4Route.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/net/src/net/org/jnode/net/ipv4/IPv4Route.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -84,7 +84,7 @@
this.flags |= RTF_GATEWAY;
}
try {
- this.deviceAPI = (NetDeviceAPI) device.getAPI(NetDeviceAPI.class);
+ this.deviceAPI = device.getAPI(NetDeviceAPI.class);
} catch (ApiNotFoundException ex) {
throw new IllegalArgumentException("Device " + device.getId() +
" is not a network device");
Modified: trunk/net/src/net/org/jnode/net/ipv4/bootp/BOOTPClient.java
===================================================================
--- trunk/net/src/net/org/jnode/net/ipv4/bootp/BOOTPClient.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/net/src/net/org/jnode/net/ipv4/bootp/BOOTPClient.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -65,7 +65,7 @@
public Object run() throws IOException {
// Get the API.
try {
- api = (NetDeviceAPI) device.getAPI(NetDeviceAPI.class);
+ api = device.getAPI(NetDeviceAPI.class);
} catch (ApiNotFoundException ex) {
throw new NetworkException("Device is not a network device", ex);
}
Modified: trunk/net/src/net/org/jnode/net/ipv4/config/impl/Ifconfig.java
===================================================================
--- trunk/net/src/net/org/jnode/net/ipv4/config/impl/Ifconfig.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/net/src/net/org/jnode/net/ipv4/config/impl/Ifconfig.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -51,7 +51,7 @@
throws NetworkException {
final NetDeviceAPI api;
try {
- api = (NetDeviceAPI) device.getAPI(NetDeviceAPI.class);
+ api = device.getAPI(NetDeviceAPI.class);
} catch (ApiNotFoundException ex) {
throw new NetworkException("Device is not a network device", ex);
}
@@ -80,7 +80,7 @@
final Collection<Device> devices = DeviceUtils.getDevicesByAPI(NetDeviceAPI.class);
for (Device dev : devices) {
try {
- final NetDeviceAPI api = (NetDeviceAPI) dev.getAPI(NetDeviceAPI.class);
+ final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
final IPv4ProtocolAddressInfo addrInfo =
(IPv4ProtocolAddressInfo) api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
if (addrInfo != null) {
Modified: trunk/net/src/net/org/jnode/net/ipv4/config/impl/NetStaticDeviceConfig.java
===================================================================
--- trunk/net/src/net/org/jnode/net/ipv4/config/impl/NetStaticDeviceConfig.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/net/src/net/org/jnode/net/ipv4/config/impl/NetStaticDeviceConfig.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -67,7 +67,7 @@
public void doApply(Device device) throws NetworkException {
final NetDeviceAPI api;
try {
- api = (NetDeviceAPI) device.getAPI(NetDeviceAPI.class);
+ api = device.getAPI(NetDeviceAPI.class);
} catch (ApiNotFoundException ex) {
throw new NetworkException("Device is not a network device", ex);
}
Modified: trunk/net/src/net/org/jnode/net/ipv4/config/impl/Route.java
===================================================================
--- trunk/net/src/net/org/jnode/net/ipv4/config/impl/Route.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/net/src/net/org/jnode/net/ipv4/config/impl/Route.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -126,7 +126,7 @@
throws NetworkException {
for (Device dev : dm.getDevicesByAPI(NetDeviceAPI.class)) {
try {
- final NetDeviceAPI api = (NetDeviceAPI) dev.getAPI(NetDeviceAPI.class);
+ final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
final IPv4ProtocolAddressInfo addrInfo;
addrInfo = (IPv4ProtocolAddressInfo) api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
if (addrInfo != null) {
Modified: trunk/net/src/net/org/jnode/net/ipv4/layer/IPv4Sender.java
===================================================================
--- trunk/net/src/net/org/jnode/net/ipv4/layer/IPv4Sender.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/net/src/net/org/jnode/net/ipv4/layer/IPv4Sender.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -127,7 +127,7 @@
// The device has been given, use it
dev = skbuf.getDevice();
try {
- api = (NetDeviceAPI) dev.getAPI(NetDeviceAPI.class);
+ api = dev.getAPI(NetDeviceAPI.class);
} catch (ApiNotFoundException ex) {
throw new NetworkException("Device is not a network device", ex);
}
Modified: trunk/net/src/net/org/jnode/net/service/DefaultNetworkLayerManager.java
===================================================================
--- trunk/net/src/net/org/jnode/net/service/DefaultNetworkLayerManager.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/net/src/net/org/jnode/net/service/DefaultNetworkLayerManager.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -143,7 +143,7 @@
}
final NetDeviceAPI deviceAPI;
try {
- deviceAPI = (NetDeviceAPI) dev.getAPI(NetDeviceAPI.class);
+ deviceAPI = dev.getAPI(NetDeviceAPI.class);
} catch (ApiNotFoundException ex) {
throw new NetworkException("Device in SocketBuffer is not a network device");
}
Modified: trunk/net/src/net/org/jnode/net/service/NetAPIImpl.java
===================================================================
--- trunk/net/src/net/org/jnode/net/service/NetAPIImpl.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/net/src/net/org/jnode/net/service/NetAPIImpl.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -59,8 +59,7 @@
final SecurityManager sm = System.getSecurityManager();
try {
final NetDeviceImpl netDeviceImpl = (NetDeviceImpl) netDevice;
- final NetDeviceAPI api = (NetDeviceAPI) netDeviceImpl.getDevice()
- .getAPI(NetDeviceAPI.class);
+ final NetDeviceAPI api = netDeviceImpl.getDevice().getAPI(NetDeviceAPI.class);
final ProtocolAddressInfo info = api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
for (ProtocolAddress ipaddr : info.addresses()) {
Modified: trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/shell/src/shell/org/jnode/shell/command/driver/DeviceCommand.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -174,7 +174,7 @@
out.println();
final PrintWriter pw = new PrintWriter(out);
try {
- final DeviceInfoAPI infoApi = (DeviceInfoAPI) dev.getAPI(DeviceInfoAPI.class);
+ final DeviceInfoAPI infoApi = dev.getAPI(DeviceInfoAPI.class);
if (infoApi != dev) {
infoApi.showInfo(pw);
}
Modified: trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java 2008-09-27 07:31:35 UTC (rev 4584)
+++ trunk/shell/src/shell/org/jnode/shell/command/driver/system/acpi/AcpiCommand.java 2008-09-27 07:47:11 UTC (rev 4585)
@@ -68,7 +68,7 @@
exit(1);
} else {
for (Device dev : acpiDevs) {
- final AcpiAPI api = (AcpiAPI) dev.getAPI(AcpiAPI.class);
+ final AcpiAPI api = dev.getAPI(AcpiAPI.class);
if (FLAG_DUMP.isSet()) {
api.dump(new PrintWriter(out));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-09-28 14:49:35
|
Revision: 4587
http://jnode.svn.sourceforge.net/jnode/?rev=4587&view=rev
Author: crawley
Date: 2008-09-28 14:49:21 +0000 (Sun, 28 Sep 2008)
Log Message:
-----------
First cut checkin of an isolate command invoker
Modified Paths:
--------------
trunk/shell/descriptors/org.jnode.shell.xml
trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java
trunk/shell/src/shell/org/jnode/shell/CommandRunner.java
trunk/shell/src/shell/org/jnode/shell/CommandShell.java
trunk/shell/src/shell/org/jnode/shell/CommandThreadImpl.java
trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java
trunk/shell/src/test/org/jnode/test/shell/CompletionTest.java
trunk/shell/src/test/org/jnode/test/shell/DefaultSyntaxCompletionTest.java
Added Paths:
-----------
trunk/core/src/core/org/jnode/vm/isolate/link/ObjectLinkMessage.java
trunk/shell/src/shell/org/jnode/shell/isolate/
trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandInvoker.java
trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandLauncher.java
trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandThreadImpl.java
trunk/shell/src/shell/org/jnode/shell/isolate/IsolateSocket.java
trunk/shell/src/shell/org/jnode/shell/isolate/IsolateSocketImpl.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProcletCommandInvoker.java
Removed Paths:
-------------
trunk/shell/src/shell/org/jnode/shell/ProcletCommandInvoker.java
Added: trunk/core/src/core/org/jnode/vm/isolate/link/ObjectLinkMessage.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/link/ObjectLinkMessage.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/isolate/link/ObjectLinkMessage.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -0,0 +1,24 @@
+package org.jnode.vm.isolate.link;
+
+public class ObjectLinkMessage extends LinkMessageImpl {
+
+ private final Object obj;
+
+ private ObjectLinkMessage(Object cr) {
+ this.obj = cr;
+ }
+
+ public static ObjectLinkMessage newMessage (Object obj) {
+ return new ObjectLinkMessage(obj);
+ }
+
+ @Override
+ public Object extract() {
+ return obj;
+ }
+
+ @Override
+ LinkMessageImpl CloneMessage() {
+ return new ObjectLinkMessage(obj);
+ }
+}
Modified: trunk/shell/descriptors/org.jnode.shell.xml
===================================================================
--- trunk/shell/descriptors/org.jnode.shell.xml 2008-09-27 17:05:24 UTC (rev 4586)
+++ trunk/shell/descriptors/org.jnode.shell.xml 2008-09-28 14:49:21 UTC (rev 4587)
@@ -23,6 +23,7 @@
<export name="org.jnode.shell.help.argument.*"/>
<export name="org.jnode.shell.help.def.*"/>
<export name="org.jnode.shell.io.*"/>
+ <export name="org.jnode.shell.isolate.*"/>
<export name="org.jnode.shell.proclet.*"/>
<export name="org.jnode.shell.syntax.*"/>
</library>
Modified: trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java 2008-09-27 17:05:24 UTC (rev 4586)
+++ trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -148,7 +148,7 @@
cr.run();
} else {
try {
- threadProcess = createThread(cmdLine, cr);
+ threadProcess = createThread(cr);
} catch (Exception ex) {
throw new ShellInvocationException(
"Exception while creating command thread", ex);
@@ -178,14 +178,15 @@
throw new ShellFailureException("unexpected internal command");
}
try {
- return createThread(cmdLine, cr);
+ return createThread(cr);
} catch (Exception ex) {
throw new ShellInvocationException(
"Exception while creating command thread", ex);
}
}
- abstract CommandThread createThread(CommandLine cmdLine, CommandRunner cr);
+ protected abstract CommandThread createThread(CommandRunner cr)
+ throws ShellInvocationException;
public void keyPressed(KeyboardEvent ke) {
// disabling Ctrl-C since currently we have no safe method for killing a
Modified: trunk/shell/src/shell/org/jnode/shell/CommandRunner.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandRunner.java 2008-09-27 17:05:24 UTC (rev 4586)
+++ trunk/shell/src/shell/org/jnode/shell/CommandRunner.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -42,11 +42,11 @@
* @author cr...@jn...
*
*/
-class CommandRunner implements Runnable {
+public class CommandRunner implements Runnable {
private final CommandShell shell;
private final CommandInvoker invoker;
- final CommandIO[] ios;
- final Class<?> cx;
+ private final CommandIO[] ios;
+ final Class<?> targetClass;
final Method method;
final Object[] args;
final CommandInfo cmdInfo;
@@ -55,11 +55,11 @@
private int rc;
public CommandRunner(CommandShell shell, CommandInvoker invoker,
- CommandInfo cmdInfo, Class<?> cx, Method method, Object[] args,
+ CommandInfo cmdInfo, Class<?> targetClass, Method method, Object[] args,
CommandIO[] ios) {
this.shell = shell;
this.invoker = invoker;
- this.cx = cx;
+ this.targetClass = targetClass;
this.method = method;
this.cmdInfo = cmdInfo;
this.commandLine = null;
@@ -71,7 +71,7 @@
CommandInfo cmdInfo, CommandLine commandLine, CommandIO[] ios) {
this.shell = shell;
this.invoker = invoker;
- this.cx = null;
+ this.targetClass = null;
this.method = null;
this.args = null;
this.cmdInfo = cmdInfo;
@@ -85,16 +85,16 @@
try {
if (method != null) {
try {
- // This saves the Command instance that has the commandline state
+ // This saves the Command instance that has the command line state
// associated in a thread-local so that the Abstract.execute(String[])
// method can get hold of it. This is the magic that allows a command
// that implements 'main' as "new MyCommand().execute(args)" to get the
- // parsed commandline arguments, etc.
+ // parsed command line arguments, etc.
AbstractCommand.saveCurrentCommand(cmdInfo.getCommandInstance());
// Call the command's entry point method reflectively
Object obj = Modifier.isStatic(method.getModifiers()) ? null
- : cx.newInstance();
+ : targetClass.newInstance();
AccessController.doPrivileged(new InvokeAction(method, obj,
args));
} finally {
@@ -109,7 +109,7 @@
// bounce us to the older execute(CommandLine, InputStream, PrintStream,
// PrintStream) method.
Command cmd = cmdInfo.createCommandInstance();
- cmd.initialize(commandLine, ios);
+ cmd.initialize(commandLine, getIos());
cmd.execute();
}
ok = true;
@@ -124,7 +124,7 @@
IOException savedEx = null;
// Make sure that we try to flush all IOs, even if some of the flushes
// result in IOExceptions.
- for (CommandIO io : ios) {
+ for (CommandIO io : getIos()) {
try {
io.flush();
} catch (IOException ex) {
@@ -182,4 +182,28 @@
}
}
+ public Method getMethod() {
+ return method;
+ }
+
+ public Class<?> getTargetClass() {
+ return targetClass;
+ }
+
+ public Object[] getArgs() {
+ return args;
+ }
+
+ public CommandIO[] getIos() {
+ return ios;
+ }
+
+ public CommandLine getCommandLine() {
+ return commandLine;
+ }
+
+ public String getCommandName() {
+ return commandLine != null ? commandLine.getCommandName() : null;
+ }
+
}
Modified: trunk/shell/src/shell/org/jnode/shell/CommandShell.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2008-09-27 17:05:24 UTC (rev 4586)
+++ trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -62,6 +62,8 @@
import org.jnode.shell.io.FanoutWriter;
import org.jnode.shell.io.NullInputStream;
import org.jnode.shell.io.NullOutputStream;
+import org.jnode.shell.isolate.IsolateCommandInvoker;
+import org.jnode.shell.proclet.ProcletCommandInvoker;
import org.jnode.shell.syntax.ArgumentBundle;
import org.jnode.shell.syntax.CommandSyntaxException;
import org.jnode.shell.syntax.SyntaxManager;
@@ -269,6 +271,7 @@
ShellUtils.registerCommandInvoker(DefaultCommandInvoker.FACTORY);
ShellUtils.registerCommandInvoker(ThreadCommandInvoker.FACTORY);
ShellUtils.registerCommandInvoker(ProcletCommandInvoker.FACTORY);
+ ShellUtils.registerCommandInvoker(IsolateCommandInvoker.FACTORY);
ShellUtils.registerCommandInterpreter(DefaultInterpreter.FACTORY);
ShellUtils
.registerCommandInterpreter(RedirectingInterpreter.FACTORY);
@@ -282,7 +285,7 @@
// Now become interactive
ownThread = Thread.currentThread();
- // Run commands from the JNode commandline first
+ // Run commands from the JNode command line first
final String cmdLine = System.getProperty(CMDLINE_PROPERTY_NAME, "");
final StringTokenizer tok = new StringTokenizer(cmdLine);
Modified: trunk/shell/src/shell/org/jnode/shell/CommandThreadImpl.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandThreadImpl.java 2008-09-27 17:05:24 UTC (rev 4586)
+++ trunk/shell/src/shell/org/jnode/shell/CommandThreadImpl.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -33,7 +33,7 @@
/**
* @param group the parent group for the thread
- * @param runner the runnable that implements the command
+ * @param runner the runnable that will run the command
* @param name a thread name
* @param size the threads stack size
*/
@@ -45,16 +45,17 @@
/**
* @param group the parent group for the thread
- * @param runner the runnable that implements the command
+ * @param runner the Runnable that will run the command
+ * @param name the thread name
*/
- public CommandThreadImpl(ThreadGroup group, Runnable runner) {
- super(group, runner);
+ public CommandThreadImpl(ThreadGroup group, Runnable runner, String name) {
+ super(group, runner, name);
this.runner = runner;
}
/**
- * @param runner the runnable that implements the command
- * @param name a thread name
+ * @param runner the Runnable that will run the command
+ * @param name the thread name
*/
public CommandThreadImpl(Runnable runner, String name) {
super(runner, name);
Deleted: trunk/shell/src/shell/org/jnode/shell/ProcletCommandInvoker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/ProcletCommandInvoker.java 2008-09-27 17:05:24 UTC (rev 4586)
+++ trunk/shell/src/shell/org/jnode/shell/ProcletCommandInvoker.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -1,74 +0,0 @@
-/*
- * $Id: ThreadCommandInvoker.java 3374 2007-08-02 18:15:27Z lsantha $
- *
- * JNode.org
- * Copyright (C) 2003-2007 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 org.jnode.shell.io.CommandIO;
-import org.jnode.shell.proclet.ProcletContext;
-import org.jnode.shell.proclet.ProcletIOContext;
-import org.jnode.vm.VmSystem;
-
-/**
- * This command invoker runs commands in their own proclet, giving each one its
- * own stdin,out,err etcetera.
- *
- * @author cr...@jn...
- */
-public class ProcletCommandInvoker extends AsyncCommandInvoker {
-
- public static final Factory FACTORY = new Factory() {
- public CommandInvoker create(CommandShell shell) {
- return new ProcletCommandInvoker(shell);
- }
-
- public String getName() {
- return "proclet";
- }
- };
-
- private static boolean initialized;
-
- public ProcletCommandInvoker(CommandShell commandShell) {
- super(commandShell);
- init();
- }
-
- public String getName() {
- return "proclet";
- }
-
- CommandThreadImpl createThread(CommandLine cmdLine, CommandRunner cr) {
- CommandIO[] ios = cmdLine.getStreams();
- return ProcletContext.createProclet(cr, null, null,
- new Object[] {
- ios[0].getInputStream(),
- ios[1].getPrintStream(),
- ios[2].getPrintStream()},
- cmdLine.getCommandName());
- }
-
- private static synchronized void init() {
- if (!initialized) {
- VmSystem.switchToExternalIOContext(new ProcletIOContext());
- initialized = true;
- }
- }
-}
Modified: trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java 2008-09-27 17:05:24 UTC (rev 4586)
+++ trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -58,7 +58,7 @@
return "thread";
}
- CommandThreadImpl createThread(CommandLine cmdLine, CommandRunner cr) {
- return new CommandThreadImpl(cr, cmdLine.getCommandName());
+ protected CommandThreadImpl createThread(CommandRunner cr) {
+ return new CommandThreadImpl(cr, cr.getCommandName());
}
}
Added: trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandInvoker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandInvoker.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandInvoker.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -0,0 +1,68 @@
+/*
+ * $Id: ThreadCommandInvoker.java 3374 2007-08-02 18:15:27Z lsantha $
+ *
+ * JNode.org
+ * Copyright (C) 2003-2007 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.isolate;
+
+import java.io.IOException;
+
+import org.jnode.shell.AsyncCommandInvoker;
+import org.jnode.shell.CommandInvoker;
+import org.jnode.shell.CommandRunner;
+import org.jnode.shell.CommandShell;
+import org.jnode.shell.CommandThread;
+import org.jnode.shell.ShellInvocationException;
+
+/**
+ * This command invoker runs commands in their own isolates.
+ *
+ * @author cr...@jn...
+ */
+public class IsolateCommandInvoker extends AsyncCommandInvoker {
+
+ public static final Factory FACTORY = new Factory() {
+ public CommandInvoker create(CommandShell shell) {
+ return new IsolateCommandInvoker(shell);
+ }
+
+ public String getName() {
+ return "isolate";
+ }
+ };
+
+ public IsolateCommandInvoker(CommandShell commandShell) {
+ super(commandShell);
+ }
+
+ @Override
+ public String getName() {
+ return "isolate";
+ }
+
+ @Override
+ protected CommandThread createThread(CommandRunner cr)
+ throws ShellInvocationException {
+ try {
+ return new IsolateCommandThreadImpl(cr);
+ } catch (IOException ex) {
+ throw new ShellInvocationException(ex);
+ }
+ }
+}
Added: trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandLauncher.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandLauncher.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandLauncher.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -0,0 +1,26 @@
+package org.jnode.shell.isolate;
+
+import javax.isolate.Isolate;
+import javax.isolate.Link;
+
+import org.jnode.shell.CommandRunner;
+import org.jnode.vm.isolate.link.ObjectLinkMessage;
+
+public class IsolateCommandLauncher {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ Link cl = Isolate.getLinks()[0];
+ CommandRunner cr;
+ try {
+ ObjectLinkMessage message = (ObjectLinkMessage) cl.receive();
+ cr = (CommandRunner) message.extract();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return;
+ }
+ cr.run();
+ }
+}
Added: trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandThreadImpl.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandThreadImpl.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandThreadImpl.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -0,0 +1,128 @@
+package org.jnode.shell.isolate;
+
+import java.io.Closeable;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.net.Socket;
+import java.util.Properties;
+
+import javax.isolate.Isolate;
+import javax.isolate.Link;
+import javax.isolate.StreamBindings;
+
+import org.jnode.shell.CommandRunner;
+import org.jnode.shell.CommandThread;
+import org.jnode.shell.ShellInvocationException;
+import org.jnode.shell.ThreadExitListener;
+import org.jnode.shell.io.CommandIO;
+import org.jnode.util.ReaderInputStream;
+import org.jnode.util.WriterOutputStream;
+import org.jnode.vm.isolate.link.ObjectLinkMessage;
+
+/**
+ * This class implements the CommandThread API for commands run in their
+ * own private isolates.
+ *
+ * @author cr...@jn...
+ */
+public class IsolateCommandThreadImpl implements CommandThread {
+
+ private final Isolate isolate;
+ private final CommandRunner cr;
+
+ public IsolateCommandThreadImpl(CommandRunner cr) throws IOException {
+ this.cr = cr;
+ CommandIO[] ios = cr.getIos();
+ Properties properties = System.getProperties();
+ StreamBindings streamBindings = createStreamBindings(ios);
+ isolate = new Isolate(streamBindings, properties,
+ "org.jnode.shell.isolate.IsolateCommandLauncher", new String[0]);
+ }
+
+ private StreamBindings createStreamBindings(CommandIO[] ios) throws IOException {
+ // FIXME if there are more than 3 CommandIOs, they should be passed
+ // to the isolate via a link message.
+ if (ios.length > 3) {
+ throw new RuntimeException("> 3 CommandIOs not implemented yet");
+ }
+ StreamBindings streamBindings = new StreamBindings();
+ Closeable in = ios[0].findBaseStream();
+ if (in instanceof FileInputStream) {
+ streamBindings.setIn((FileInputStream) in);
+ } else {
+ streamBindings.setIn(createSocketForInput(in));
+ }
+ Closeable out = ios[1].findBaseStream();
+ if (out instanceof FileOutputStream) {
+ streamBindings.setOut((FileOutputStream) out);
+ } else {
+ streamBindings.setOut(createSocketForOutput(out));
+ }
+ Closeable err = ios[2].findBaseStream();
+ if (err instanceof FileOutputStream) {
+ streamBindings.setErr((FileOutputStream) err);
+ } else {
+ streamBindings.setErr(createSocketForOutput(err));
+ }
+ return streamBindings;
+ }
+
+ private Socket createSocketForInput(Closeable closeable) throws IOException {
+ InputStream in;
+ if (closeable instanceof Reader) {
+ in = new ReaderInputStream((Reader) closeable);
+ } else {
+ in = (InputStream) closeable;
+ }
+ return new IsolateSocket(in);
+ }
+
+ private Socket createSocketForOutput(Closeable closeable) throws IOException {
+ OutputStream out;
+ if (closeable instanceof Writer) {
+ out = new WriterOutputStream((Writer) closeable);
+ } else {
+ out = (OutputStream) closeable;
+ }
+ return new IsolateSocket(out);
+ }
+
+ @Override
+ public int getReturnCode() {
+ // TODO Auto-generated method stub
+ return -1;
+ }
+
+ @Override
+ public boolean isAlive() {
+ return isolate.hasStarted() && !isolate.hasExited();
+ }
+
+ @Override
+ public void start(ThreadExitListener listener) throws ShellInvocationException {
+ try {
+ Link cl = Link.newLink(Isolate.currentIsolate(), isolate);
+ isolate.start(cl);
+ ObjectLinkMessage msg = ObjectLinkMessage.newMessage(this.cr);
+ cl.send(msg);
+ } catch (Exception ex) {
+ throw new ShellInvocationException("Cannot start isolate", ex);
+ }
+ }
+
+ @Override
+ public void stop(ThreadDeath threadDeath) {
+ // FIXME - not sure what status argument should be ... but this is moot
+ // at the moment because VmIsolate.halt does nothing with it anyway.
+ isolate.halt(0 /* FIXME */);
+ }
+
+ public void waitFor() {
+ // TODO implement me
+ }
+}
Added: trunk/shell/src/shell/org/jnode/shell/isolate/IsolateSocket.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/isolate/IsolateSocket.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/isolate/IsolateSocket.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -0,0 +1,45 @@
+/*
+ * $Id: Shell.java 4556 2008-09-13 08:02:20Z crawley $
+ *
+ * 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.isolate;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.net.SocketException;
+
+/**
+ * This special purpose socket type is a light-weight wrapper for an
+ * input or output stream for use in local isolate communication. One
+ * of these sockets is created in the 'connected' state, and does not
+ * support the normal socket connection mechanisms.
+ *
+ * @author cr...@jn...
+ */
+public class IsolateSocket extends Socket {
+
+ public IsolateSocket(InputStream in) throws SocketException {
+ super(new IsolateSocketImpl(in));
+ }
+
+ public IsolateSocket(OutputStream out) throws SocketException {
+ super(new IsolateSocketImpl(out));
+ }
+}
Added: trunk/shell/src/shell/org/jnode/shell/isolate/IsolateSocketImpl.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/isolate/IsolateSocketImpl.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/isolate/IsolateSocketImpl.java 2008-09-28 14:49:21 UTC (rev 4587)
@@ -0,0 +1,159 @@
+/*
+ * $Id: Shell.java 4556 2008-09-13 08:02:20Z crawley $
+ *
+ * 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.isolate;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.net.SocketImpl;
+import java.net.UnknownHostException;
+
+/**
+ * The implementation class for IsolateSoccket.
+ *
+ * @author cr...@jn...
+ */
+public class IsolateSocketImpl extends SocketImpl {
+
+ private final InputStream in;
+ private final OutputStream out;
+ private boolean closed;
+ private final InetAddress dummyAddress;
+
+ private IsolateSocketImpl(InputStream in, OutputStream out) {
+ super();
+ this.in = in;
+ this.out = out;
+ InetAddress d;
+ try {
+ d = InetAddress.getByAddress(new byte[]{0, 0, 0, 0});
+ } catch (UnknownHostException ex) {
+ d = null;
+ }
+ this.dummyAddress = d;
+ }
+
+ public IsolateSocketImpl(InputStream in) {
+ this(in, null);
+ }
+
+ public IsolateSocketImpl(OutputStream out) {
+ this(null, out);
+ }
+
+ @Override
+ protected void accept(SocketImpl s) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected int available() throws IOException {
+ if (in == null) {
+ throw new SocketException("socket is closed");
+ }
+ return in.available();
+ }
+
+ @Override
+ protected InetAddress getInetAddress() {
+ // We have to return something non-null because the generic Socket code uses
+ // a non-null address to indicate that the socket is connected.
+ return dummyAddress;
+ }
+
+ @Override
+ protected void bind(InetAddress host, int port) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected synchronized void close() throws IOException {
+ if (!closed) {
+ if (in != null) {
+ in.close();
+ }
+ if (out != null) {
+ out.close();
+ }
+ closed = true;
+ }
+ }
+
+ @Override
+ protected void connect(String host, int port) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected void connect(InetAddress host, int port) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected void connect(SocketAddress address, int timeout) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected void create(boolean stream) throws IOException {
+ // Do nothing,
+ }
+
+ @Override
+ protected synchronized InputStream getInputStream() throws IOException {
+ if (closed || in == null) {
+ throw new SocketException("socket is closed");
+ }
+ return in;
+ }
+
+ @Override
+ protected synchronized OutputStream getOutputStream() throws IOException {
+ if (closed || out == null) {
+ throw new SocketException("socket is closed");
+ }
+ return out;
+ }
+
+ @Override
+ protected void listen(int backlog) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected void sendUrgentData(int data) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Obj...
[truncated message content] |