|
From: <chr...@us...> - 2009-04-15 21:03:54
|
Revision: 5289
http://jnode.svn.sourceforge.net/jnode/?rev=5289&view=rev
Author: chrisboertien
Date: 2009-04-15 21:03:43 +0000 (Wed, 15 Apr 2009)
Log Message:
-----------
Updates to ADW and FindCommand javadoc by Alexander Kerner
Added a walk(List<File) method to ADW and changed the behavior of ADW to not
rewrite pathnames into canonical form. If canonical form is wanted then the
caller should do this before, otherwise it is likely unexpected.
+ checkstyle fixes
Signed-off-by: chrisboertien <chr...@gm...>
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/command/AbstractDirectoryWalker.java
trunk/fs/src/fs/org/jnode/fs/command/FindCommand.java
trunk/shell/src/shell/org/jnode/shell/command/GrepCommand.java
trunk/shell/src/shell/org/jnode/shell/syntax/FileArgument.java
Modified: trunk/fs/src/fs/org/jnode/fs/command/AbstractDirectoryWalker.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/command/AbstractDirectoryWalker.java 2009-04-15 15:01:23 UTC (rev 5288)
+++ trunk/fs/src/fs/org/jnode/fs/command/AbstractDirectoryWalker.java 2009-04-15 21:03:43 UTC (rev 5289)
@@ -1,3 +1,23 @@
+/*
+ * $Id: CdCommand.java 4975 2009-02-02 08:30:52Z lsantha $
+ *
+ * Copyright (C) 2003-2009 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.fs.command;
import java.io.File;
@@ -6,7 +26,23 @@
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
+import java.util.List;
+/**
+ * <p>
+ * <code>AbstractDirectoryWalker</code> - walk through a directory hierarchy
+ * recursively
+ * </p>
+ * <code>AbstractDirectoryWalker</code> will start at a given starting depth
+ * relatively to the given directory and walk recursively through the directory
+ * hierarchy until stopping depth is reached. <br>
+ * On its way, it will call "handleFile()" and "handleDir()" for every file and
+ * directory, that is not filtered out by any of the filteres set for this
+ * DirectoryWalker.
+ *
+ * @author Alexander Kerner
+ *
+ */
public abstract class AbstractDirectoryWalker {
private class FileObject {
@@ -25,24 +61,36 @@
private volatile Long maxDepth = null;
private volatile Long minDepth = null;
+ /**
+ * Main method to walk through directory hierarchy.
+ *
+ * @param dirs Array of <code>File</code> to walk through.
+ * @throws IOException if any IO error occurs.
+ */
public synchronized void walk(final File... dirs) throws IOException {
- if (dirs == null) {
+ if (dirs == null || dirs.length == 0) {
throw new NullPointerException("Directory to walk from must not be null");
}
for (File dir : dirs) {
if (dir == null || !dir.isDirectory())
- throw new IOException("No such directroy " + dir);
- dir = dir.getCanonicalFile(); // to be able to handle relative paths
- // and . / ..
+ throw new IOException("No such directory " + dir);
+
+ /* See note in handleChilds()
+ dir = dir.getCanonicalPath();
+ */
handleStartingDir(dir);
stack.push(new FileObject(dir, 0L));
while (!cancelled && !stack.isEmpty()) {
- go1(stack.pop());
+ handle(stack.pop());
}
}
}
-
- private void go1(final FileObject file) throws IOException {
+
+ public synchronized void walk(final List<File> dirs) throws IOException {
+ walk(dirs.toArray(new File[0]));
+ }
+
+ private void handle(final FileObject file) throws IOException {
if ((minDepth != null && file.depth < minDepth) ||
(maxDepth != null && file.depth > maxDepth)) {
// out of boundaries
@@ -52,13 +100,14 @@
// filtered out
}
try {
- go2(file);
+ handleChilds(file);
} catch (SecurityException e) {
+ // Exception rises, when access to folder content was denied
handleRestrictedFile(file.file);
}
}
- private void go2(final FileObject file) throws IOException, SecurityException {
+ private void handleChilds(final FileObject file) throws IOException, SecurityException {
final Stack<File> stack = new Stack<File>();
final File[] content = file.file.listFiles();
if (content == null) {
@@ -67,11 +116,18 @@
// dir is empty
} else {
for (File f : content) {
+ /* I dont think is the right way to handle this. getCanonicalPath()
+ * does more than just trim symlinks, and symlinks aren't something
+ * we need to worry about. Even when we do we should have a lower
+ * level API to work with.
+ * - Chris
if (f.toString().equals(f.getCanonicalPath())) {
stack.push(f);
} else {
// dont follow symlinks
}
+ */
+ stack.push(f);
}
while (!stack.isEmpty()) {
this.stack.push(new FileObject(stack.pop(), file.depth + 1));
@@ -80,7 +136,7 @@
}
- private void handleFileOrDir(final FileObject file) {
+ private void handleFileOrDir(final FileObject file) throws IOException {
if (file.file.isDirectory())
handleDir(file.file);
else if (file.file.isFile())
@@ -98,32 +154,77 @@
return true;
}
- public void stoppWalking() {
+ /**
+ * Abort walking.
+ */
+ public void stopWalking() {
cancelled = true;
}
+ /**
+ *
+ * @param min starting depth at which actual action performing is started.
+ */
public void setMinDepth(Long min) {
minDepth = min;
}
+ /**
+ *
+ * @param max ending depth at which actual action performing is stopped.
+ */
public void setMaxDepth(Long max) {
maxDepth = max;
}
+ /**
+ *
+ * @param filter <code>FileFilter</code> to be added to this
+ * DirectoryWalkers FilterSet.
+ */
public synchronized void addFilter(FileFilter filter) {
filters.add(filter);
}
+ /**
+ * This method is called, when access to a file was denied.<br>
+ * Default implementation will rise a <code>IOException</code> instead of
+ * <code>SecurityException</code>. Maybe overridden by extending classes to
+ * do something else.
+ *
+ * @param file <code>File</code>-object, to which access was restricted.
+ * @throws IOException in default implementation.
+ */
protected void handleRestrictedFile(final File file) throws IOException {
throw new IOException("Permission denied for " + file);
}
- protected void handleStartingDir(final File file) {
- // do nothing
+ /**
+ * This method is called, when walking is about to start.<br>
+ * By default, it does nothing. Maybe overridden by extending classes to do
+ * something else.
+ *
+ * @param file <code>File</code>-object, that represents starting dir.
+ * @throws IOException if IO error occurs.
+ */
+ protected void handleStartingDir(final File file) throws IOException {
+ // do nothing by default
}
- public abstract void handleDir(final File file);
+ /**
+ *
+ * @param file <code>File</code>-object, that represents current directory. <br>
+ * Override this, to do some actions on this directory.
+ * @throws IOException if IO error occurs.
+ */
+ public abstract void handleDir(final File file) throws IOException;
- public abstract void handleFile(final File file);
+ /**
+ *
+ * @param file <code>File</code>-object, that represents current file. <br>
+ * Override this, to do some actions on this file.
+ * @throws IOException if IO error occurs.
+ */
+ public abstract void handleFile(final File file) throws IOException;
}
Modified: trunk/fs/src/fs/org/jnode/fs/command/FindCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/command/FindCommand.java 2009-04-15 15:01:23 UTC (rev 5288)
+++ trunk/fs/src/fs/org/jnode/fs/command/FindCommand.java 2009-04-15 21:03:43 UTC (rev 5289)
@@ -1,3 +1,23 @@
+/*
+ * $Id: CdCommand.java 4975 2009-02-02 08:30:52Z lsantha $
+ *
+ * Copyright (C) 2003-2009 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.fs.command;
import java.io.File;
@@ -13,6 +33,13 @@
import org.jnode.shell.syntax.LongArgument;
import org.jnode.shell.syntax.StringArgument;
+/**
+ * <code>FindCommand</code> - search for files in a directory hierarchy
+ *
+ * @author Alexander Kerner
+ * @see AbstractDirectoryWalker
+ *
+ */
public class FindCommand extends AbstractCommand {
private class Walker extends AbstractDirectoryWalker {
@@ -31,21 +58,27 @@
public void handleFile(File f) {
out.println(f);
}
-
}
- private final StringArgument nameArg = new StringArgument("name", Argument.OPTIONAL,
- "filter results to show only files that match given pattern");
- private final StringArgument inameArg = new StringArgument("iname", Argument.OPTIONAL,
- "same like 'name', but case insensitive");
- private final LongArgument maxdepthArg = new LongArgument("maxdepth", Argument.OPTIONAL,
- "descent at most to given level of directories");
- private final LongArgument mindepthArg = new LongArgument("mindepth", Argument.OPTIONAL,
- "ignore files and directories at levels less than given level");
- private final StringArgument typeArg = new StringArgument("type", Argument.OPTIONAL,
- "filter results to show only files of given type. valid types are 'd' for directory and 'f' for file");
- private final FileArgument dirArg = new FileArgument("directory", Argument.OPTIONAL | Argument.MULTIPLE,
- "directory to start searching from");
+ private final StringArgument nameArg =
+ new StringArgument("name", Argument.OPTIONAL,
+ "filter results to show only files that match given pattern");
+ private final StringArgument inameArg =
+ new StringArgument("iname", Argument.OPTIONAL, "same like 'name', but case insensitive");
+ private final LongArgument maxdepthArg =
+ new LongArgument("maxdepth", Argument.OPTIONAL,
+ "descent at most to given level of directories");
+ private final LongArgument mindepthArg =
+ new LongArgument("mindepth", Argument.OPTIONAL,
+ "ignore files and directories at levels less than given level");
+ private final StringArgument typeArg =
+ new StringArgument(
+ "type",
+ Argument.OPTIONAL,
+ "filter results to show only files of given type. valid types are 'd' for directory and 'f' for file");
+ private final FileArgument dirArg =
+ new FileArgument("directory", Argument.OPTIONAL | Argument.MULTIPLE,
+ "directory to start searching from");
private PrintWriter out = null;
private PrintWriter err = null;
@@ -55,7 +88,6 @@
}
public static void main(String[] args) throws IOException {
-
new FindCommand().execute();
}
Modified: trunk/shell/src/shell/org/jnode/shell/command/GrepCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/GrepCommand.java 2009-04-15 15:01:23 UTC (rev 5288)
+++ trunk/shell/src/shell/org/jnode/shell/command/GrepCommand.java 2009-04-15 21:03:43 UTC (rev 5289)
@@ -39,18 +39,14 @@
import java.util.Deque;
import java.util.List;
-import org.jnode.shell.CommandLine.Token;
import org.jnode.shell.AbstractCommand;
import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.FileArgument;
import org.jnode.shell.syntax.FlagArgument;
import org.jnode.shell.syntax.IntegerArgument;
import org.jnode.shell.syntax.StringArgument;
-import org.jnode.shell.syntax.CommandSyntaxException;
/**
- * FIXME SHELL : shell expands globbers within quotes.
- *
* TODO check performance of prefixing, probably needs some buffering.
* TODO implement outputting context lines (requires buffering output lines)
* TODO implement Fixed/Basic/Ext matchers
Modified: trunk/shell/src/shell/org/jnode/shell/syntax/FileArgument.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/syntax/FileArgument.java 2009-04-15 15:01:23 UTC (rev 5288)
+++ trunk/shell/src/shell/org/jnode/shell/syntax/FileArgument.java 2009-04-15 21:03:43 UTC (rev 5289)
@@ -190,7 +190,7 @@
return ALLOW_DODGY_NAMES;
} else if (name.equals("HYPHEN_IS_SPECIAL")) {
return HYPHEN_IS_SPECIAL;
- } else{
+ } else {
return super.nameToFlag(name);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2009-04-16 13:27:08
|
Revision: 5291
http://jnode.svn.sourceforge.net/jnode/?rev=5291&view=rev
Author: crawley
Date: 2009-04-16 13:27:02 +0000 (Thu, 16 Apr 2009)
Log Message:
-----------
Changes aimed at protecting the shell from applications that close
the console input, output or error streams.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java
trunk/shell/src/shell/org/jnode/shell/CommandShell.java
trunk/shell/src/shell/org/jnode/shell/io/Pipeline.java
trunk/shell/src/shell/org/jnode/shell/io/PipelineInputStream.java
trunk/shell/src/shell/org/jnode/shell/io/PipelineOutputStream.java
Added Paths:
-----------
trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleReader.java
trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java 2009-04-16 08:57:24 UTC (rev 5290)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardReader.java 2009-04-16 13:27:02 UTC (rev 5291)
@@ -93,7 +93,25 @@
private final KeyboardHandler keyboardHandler;
private final FocusListener focusListener;
+
+ /**
+ * This constructor is used by wrappers.
+ */
+ protected KeyboardReader() {
+ this.keyboardHandler = null;
+ this.focusListener = null;
+ this.currentLine = null;
+ this.out = null;
+ this.console = null;
+ }
+ /**
+ * Create KeyboardReader using the supplied handler as the source of
+ * keyboard events and the supplied TextConsole to echo typed characters.
+ *
+ * @param kbHandler
+ * @param console
+ */
public KeyboardReader(KeyboardHandler kbHandler, TextConsole console) {
this.keyboardHandler = kbHandler;
this.console = console;
Modified: trunk/shell/src/shell/org/jnode/shell/CommandShell.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2009-04-16 08:57:24 UTC (rev 5290)
+++ trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2009-04-16 13:27:02 UTC (rev 5291)
@@ -51,6 +51,7 @@
import org.jnode.driver.console.ConsoleManager;
import org.jnode.driver.console.InputHistory;
import org.jnode.driver.console.TextConsole;
+import org.jnode.driver.console.spi.ConsoleWriter;
import org.jnode.driver.console.textscreen.KeyboardReader;
import org.jnode.naming.InitialNaming;
import org.jnode.shell.alias.AliasManager;
@@ -62,6 +63,8 @@
import org.jnode.shell.io.FanoutWriter;
import org.jnode.shell.io.NullInputStream;
import org.jnode.shell.io.NullOutputStream;
+import org.jnode.shell.io.ShellConsoleReader;
+import org.jnode.shell.io.ShellConsoleWriter;
import org.jnode.shell.isolate.IsolateCommandInvoker;
import org.jnode.shell.proclet.ProcletCommandInvoker;
import org.jnode.shell.syntax.ArgumentBundle;
@@ -197,11 +200,14 @@
debugEnabled = true;
try {
console = cons;
- Reader in = console.getIn();
+ KeyboardReader in = (KeyboardReader) console.getIn();
+ ConsoleWriter out = (ConsoleWriter) console.getOut();
+ ConsoleWriter err = (ConsoleWriter) console.getErr();
if (in == null) {
throw new ShellException("console input stream is null");
}
- setupStreams(in, console.getOut(), console.getErr());
+ setupStreams(new ShellConsoleReader(in), new ShellConsoleWriter(out),
+ new ShellConsoleWriter(err));
SystemInputStream.getInstance().initialize(new ReaderInputStream(in));
cons.setCompleter(this);
Modified: trunk/shell/src/shell/org/jnode/shell/io/Pipeline.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/Pipeline.java 2009-04-16 08:57:24 UTC (rev 5290)
+++ trunk/shell/src/shell/org/jnode/shell/io/Pipeline.java 2009-04-16 13:27:02 UTC (rev 5291)
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.io;
import java.io.IOException;
Modified: trunk/shell/src/shell/org/jnode/shell/io/PipelineInputStream.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/PipelineInputStream.java 2009-04-16 08:57:24 UTC (rev 5290)
+++ trunk/shell/src/shell/org/jnode/shell/io/PipelineInputStream.java 2009-04-16 13:27:02 UTC (rev 5291)
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.io;
import java.io.IOException;
Modified: trunk/shell/src/shell/org/jnode/shell/io/PipelineOutputStream.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/PipelineOutputStream.java 2009-04-16 08:57:24 UTC (rev 5290)
+++ trunk/shell/src/shell/org/jnode/shell/io/PipelineOutputStream.java 2009-04-16 13:27:02 UTC (rev 5291)
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.io;
import java.io.IOException;
Added: trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleReader.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleReader.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleReader.java 2009-04-16 13:27:02 UTC (rev 5291)
@@ -0,0 +1,142 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.io;
+
+import java.io.IOException;
+import java.nio.CharBuffer;
+
+import org.jnode.driver.console.InputCompleter;
+import org.jnode.driver.console.TextConsole;
+import org.jnode.driver.console.textscreen.ConsoleKeyEventBindings;
+import org.jnode.driver.console.textscreen.KeyboardReader;
+import org.jnode.system.event.FocusEvent;
+
+/**
+ * This is a wrapper class that protects the shell's KeyboardReader from
+ * applications closing it.
+ *
+ * @author cr...@jn...
+ */
+public class ShellConsoleReader extends KeyboardReader {
+
+ private final KeyboardReader reader;
+
+ public ShellConsoleReader(KeyboardReader reader) {
+ super();
+ this.reader = reader;
+ }
+
+ @Override
+ public void close() throws IOException {
+ // Do nothing
+ }
+
+ @Override
+ public int read(char[] buf, int off, int len) throws IOException {
+ return reader.read(buf, off, len);
+ }
+
+ @Override
+ public void mark(int readAheadLimit) {
+ reader.mark(readAheadLimit);
+ }
+
+ @Override
+ public boolean markSupported() {
+ return reader.markSupported();
+ }
+
+ @Override
+ public int read() throws IOException {
+ return reader.read();
+ }
+
+ @Override
+ public int read(char[] cbuf) throws IOException {
+ return reader.read(cbuf);
+ }
+
+ @Override
+ public int read(CharBuffer target) throws IOException {
+ return reader.read(target);
+ }
+
+ @Override
+ public boolean ready() throws IOException {
+ return reader.ready();
+ }
+
+ @Override
+ public void reset() throws IOException {
+ reader.reset();
+ }
+
+ @Override
+ public long skip(long arg0) throws IOException {
+ return reader.skip(arg0);
+ }
+
+ @Override
+ public void clearSoftEOF() {
+ reader.clearSoftEOF();
+ }
+
+ @Override
+ public void focusGained(FocusEvent event) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void focusLost(FocusEvent event) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public InputCompleter getCompleter() {
+ return reader.getCompleter();
+ }
+
+ @Override
+ public ConsoleKeyEventBindings getKeyEventBindings() {
+ return reader.getKeyEventBindings();
+ }
+
+ @Override
+ public TextConsole getTextConsole() {
+ return reader.getTextConsole();
+ }
+
+ @Override
+ public boolean isSoftEOF() {
+ return reader.isSoftEOF();
+ }
+
+ @Override
+ public void setCompleter(InputCompleter completer) {
+ reader.setCompleter(completer);
+ }
+
+ @Override
+ public void setKeyEventBindings(ConsoleKeyEventBindings bindings) {
+ reader.setKeyEventBindings(bindings);
+ }
+
+}
Added: trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java 2009-04-16 13:27:02 UTC (rev 5291)
@@ -0,0 +1,111 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.io;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.jnode.driver.console.TextConsole;
+import org.jnode.driver.console.spi.ConsoleWriter;
+
+/**
+ * This is a wrapper class that protects the shell's ConsoleWriter from
+ * applications closing it.
+ *
+ * @author cr...@jn...
+ */
+public class ShellConsoleWriter extends ConsoleWriter {
+
+ private final ConsoleWriter writer;
+
+ public ShellConsoleWriter(ConsoleWriter writer) {
+ super(null, 0);
+ this.writer = writer;
+ }
+
+ @Override
+ public void close() throws IOException {
+ flush();
+ }
+
+ @Override
+ public void flush() throws IOException {
+ writer.flush();
+ }
+
+ @Override
+ public int getFgColor() {
+ return writer.getFgColor();
+ }
+
+ @Override
+ public TextConsole getTextConsole() {
+ return writer.getTextConsole();
+ }
+
+ @Override
+ public void setFgColor(int fgColor) {
+ writer.setFgColor(fgColor);
+ }
+
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException,
+ NullPointerException, IndexOutOfBoundsException {
+ writer.write(cbuf, off, len);
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ writer.write(b);
+ }
+
+ @Override
+ public Writer append(CharSequence csq) throws IOException {
+ return writer.append(csq);
+ }
+
+ @Override
+ public Writer append(char c) throws IOException {
+ return writer.append(c);
+ }
+
+ @Override
+ public Writer append(CharSequence csq, int start, int end)
+ throws IOException {
+ return writer.append(csq, start, end);
+ }
+
+ @Override
+ public void write(char[] cbuf) throws IOException {
+ writer.write(cbuf);
+ }
+
+ @Override
+ public void write(String str) throws IOException {
+ writer.write(str);
+ }
+
+ @Override
+ public void write(String str, int off, int len) throws IOException {
+ writer.write(str, off, len);
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2009-04-16 14:43:20
|
Revision: 5292
http://jnode.svn.sourceforge.net/jnode/?rev=5292&view=rev
Author: crawley
Date: 2009-04-16 14:42:56 +0000 (Thu, 16 Apr 2009)
Log Message:
-----------
Further changes to protect against (in this case) an application closing a
WriterOutputStream wrapper for the shell's console out/err Writers.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java
trunk/core/src/core/org/jnode/util/WriterOutputStream.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsolePlugin.java
trunk/shell/src/shell/org/jnode/shell/command/driver/console/ConsoleCommand.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/io/ShellConsoleReader.java
trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java
trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandThreadImpl.java
trunk/shell/src/test/org/jnode/test/shell/io/WriterOutputStreamTest.java
Modified: trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java
===================================================================
--- trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java 2009-04-16 13:27:02 UTC (rev 5291)
+++ trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java 2009-04-16 14:42:56 UTC (rev 5292)
@@ -79,7 +79,7 @@
final VirtualConsoleAppender debugApp =
new VirtualConsoleAppender(new PatternLayout(LAYOUT), console, false);
debugApp.setThreshold(Level.DEBUG);
- BootLog.setDebugOut(new PrintStream(new WriterOutputStream(console.getOut()), true));
+ BootLog.setDebugOut(new PrintStream(new WriterOutputStream(console.getOut(), false), true));
TextConsole atc = new ActiveTextConsole(conMgr);
final VirtualConsoleAppender infoApp = new VirtualConsoleAppender(
Modified: trunk/core/src/core/org/jnode/util/WriterOutputStream.java
===================================================================
--- trunk/core/src/core/org/jnode/util/WriterOutputStream.java 2009-04-16 13:27:02 UTC (rev 5291)
+++ trunk/core/src/core/org/jnode/util/WriterOutputStream.java 2009-04-16 14:42:56 UTC (rev 5292)
@@ -42,16 +42,31 @@
private Writer writer;
private CharsetDecoder decoder;
+ private final boolean reallyClose;
- public WriterOutputStream(Writer writer) {
- this(writer, Charset.defaultCharset().name());
+ /**
+ * Construct an OutputStream that encodes the data in the default character coding system.
+ * @param writer the Writer to be wrapped
+ * @param reallyClose if {@code true}, calling {@link #close()} will close
+ * the Writer; otherwise {@link #close()} means {@link #flush()}.
+ */
+ public WriterOutputStream(Writer writer, boolean reallyClose) {
+ this(writer, Charset.defaultCharset().name(), reallyClose);
}
- public WriterOutputStream(Writer writer, String encoding) {
+ /**
+ * Construct an OutputStream that encodes the data in the supplied character coding system.
+ * @param writer the Writer to be wrapped
+ * @param encoding the name of a character coding system.
+ * @param reallyClose if {@code true}, calling {@link #close()} will close
+ * the Writer; otherwise {@link #close()} means {@link #flush()}.
+ */
+ public WriterOutputStream(Writer writer, String encoding, boolean reallyClose) {
this.writer = writer;
this.decoder = Charset.forName(encoding).newDecoder();
- bytes.clear();
- chars.clear();
+ this.bytes.clear();
+ this.chars.clear();
+ this.reallyClose = reallyClose;
}
@Override
@@ -70,7 +85,7 @@
@Override
public void close() throws IOException {
- flush(true);
+ flush(reallyClose);
writer.close();
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2009-04-16 13:27:02 UTC (rev 5291)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2009-04-16 14:42:56 UTC (rev 5292)
@@ -110,8 +110,8 @@
this.scrHeight = screen.getHeight();
this.out = new ConsoleWriter(this, 0x07);
this.err = new ConsoleWriter(this, 0x04);
- this.savedOut = new PrintStream(new WriterOutputStream(this.out), true);
- this.savedErr = new PrintStream(new WriterOutputStream(this.err), true);
+ this.savedOut = new PrintStream(new WriterOutputStream(this.out, false), true);
+ this.savedErr = new PrintStream(new WriterOutputStream(this.err, false), true);
this.claimSystemOutErr = false;
this.myIsolate = VmIsolate.currentIsolate();
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsolePlugin.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsolePlugin.java 2009-04-16 13:27:02 UTC (rev 5291)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsolePlugin.java 2009-04-16 14:42:56 UTC (rev 5292)
@@ -62,8 +62,8 @@
(ConsoleManager.CreateOptions.TEXT |
ConsoleManager.CreateOptions.SCROLLABLE));
mgr.focus(first);
- System.setOut(new PrintStream(new WriterOutputStream(first.getOut()), true));
- System.setErr(new PrintStream(new WriterOutputStream(first.getErr()), true));
+ System.setOut(new PrintStream(new WriterOutputStream(first.getOut(), false), true));
+ System.setErr(new PrintStream(new WriterOutputStream(first.getErr(), false), true));
System.out.println(VmSystem.getBootLog());
} catch (ConsoleException ex) {
throw new PluginException(ex);
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 2009-04-16 13:27:02 UTC (rev 5291)
+++ trunk/shell/src/shell/org/jnode/shell/command/driver/console/ConsoleCommand.java 2009-04-16 14:42:56 UTC (rev 5292)
@@ -120,8 +120,8 @@
final PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
TextConsole console = createConsoleWithShell(conMgr, out);
System.setIn(new ReaderInputStream(console.getIn()));
- System.setOut(new PrintStream(new WriterOutputStream(console.getOut()), true));
- System.setErr(new PrintStream(new WriterOutputStream(console.getErr()), true));
+ System.setOut(new PrintStream(new WriterOutputStream(console.getOut(), false), true));
+ System.setErr(new PrintStream(new WriterOutputStream(console.getErr(), false), true));
} catch (Exception ex) {
// FIXME
System.out.println("Problem creating the isolated console");
Modified: trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java 2009-04-16 13:27:02 UTC (rev 5291)
+++ trunk/shell/src/shell/org/jnode/shell/io/CommandInputOutput.java 2009-04-16 14:42:56 UTC (rev 5292)
@@ -67,7 +67,8 @@
public synchronized OutputStream getOutputStream() {
if (outputStream == null) {
- outputStream = new WriterOutputStream(writer, getEncoding());
+ boolean isConsole = writer instanceof ShellConsoleWriter;
+ outputStream = new WriterOutputStream(writer, getEncoding(), !isConsole);
}
return outputStream;
}
Modified: trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java 2009-04-16 13:27:02 UTC (rev 5291)
+++ trunk/shell/src/shell/org/jnode/shell/io/CommandOutput.java 2009-04-16 14:42:56 UTC (rev 5292)
@@ -56,7 +56,8 @@
public synchronized OutputStream getOutputStream() {
if (outputStream == null) {
- outputStream = new WriterOutputStream(writer, getEncoding());
+ boolean isConsole = writer instanceof ShellConsoleWriter;
+ outputStream = new WriterOutputStream(writer, getEncoding(), !isConsole);
}
return outputStream;
}
Modified: trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleReader.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleReader.java 2009-04-16 13:27:02 UTC (rev 5291)
+++ trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleReader.java 2009-04-16 14:42:56 UTC (rev 5292)
@@ -44,6 +44,9 @@
this.reader = reader;
}
+ /**
+ * Calling close has no effect.
+ */
@Override
public void close() throws IOException {
// Do nothing
Modified: trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java 2009-04-16 13:27:02 UTC (rev 5291)
+++ trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java 2009-04-16 14:42:56 UTC (rev 5292)
@@ -41,6 +41,9 @@
this.writer = writer;
}
+ /**
+ * The close method flushes the underlying stream but does not close it.
+ */
@Override
public void close() throws IOException {
flush();
Modified: trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandThreadImpl.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandThreadImpl.java 2009-04-16 13:27:02 UTC (rev 5291)
+++ trunk/shell/src/shell/org/jnode/shell/isolate/IsolateCommandThreadImpl.java 2009-04-16 14:42:56 UTC (rev 5292)
@@ -43,6 +43,7 @@
import org.jnode.shell.ShellInvocationException;
import org.jnode.shell.ThreadExitListener;
import org.jnode.shell.io.CommandIO;
+import org.jnode.shell.io.ShellConsoleWriter;
import org.jnode.util.ReaderInputStream;
import org.jnode.util.WriterOutputStream;
import org.jnode.vm.isolate.ObjectLinkMessage;
@@ -110,7 +111,8 @@
private Socket createSocketForOutput(Closeable closeable) throws IOException {
OutputStream out;
if (closeable instanceof Writer) {
- out = new WriterOutputStream((Writer) closeable);
+ boolean isConsole = closeable instanceof ShellConsoleWriter;
+ out = new WriterOutputStream((Writer) closeable, !isConsole);
} else {
out = (OutputStream) closeable;
}
Modified: trunk/shell/src/test/org/jnode/test/shell/io/WriterOutputStreamTest.java
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/io/WriterOutputStreamTest.java 2009-04-16 13:27:02 UTC (rev 5291)
+++ trunk/shell/src/test/org/jnode/test/shell/io/WriterOutputStreamTest.java 2009-04-16 14:42:56 UTC (rev 5292)
@@ -32,7 +32,7 @@
public void testEmpty() throws Exception {
String LINE = "";
StringWriter sw = new StringWriter();
- WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8");
+ WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8", true);
byte[] buffer = LINE.getBytes();
wos.write(buffer);
wos.flush();
@@ -42,7 +42,7 @@
public void testLine() throws Exception {
String LINE = "The quick brown fox jumped over the lazy doc";
StringWriter sw = new StringWriter();
- WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8");
+ WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8", true);
byte[] buffer = LINE.getBytes();
wos.write(buffer);
wos.flush();
@@ -52,7 +52,7 @@
public void testByteAtATime() throws Exception {
String LINE = "The quick brown fox jumped over the lazy doc";
StringWriter sw = new StringWriter();
- WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8");
+ WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8", true);
byte[] buffer = LINE.getBytes();
for (byte b : buffer) {
wos.write(b);
@@ -64,7 +64,7 @@
public void testByteAtATimeWithFlushes() throws Exception {
String LINE = "The quick brown fox jumped over the lazy doc";
StringWriter sw = new StringWriter();
- WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8");
+ WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8", true);
byte[] buffer = LINE.getBytes();
for (int i = 0; i < buffer.length; i++) {
wos.write(buffer[i]);
@@ -81,7 +81,7 @@
}
byte[] buffer = new String(chars).getBytes();
StringWriter sw = new StringWriter();
- WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8");
+ WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8", true);
wos.write(buffer);
wos.flush();
StringBuffer sb = sw.getBuffer();
@@ -94,7 +94,7 @@
public void testBadUnicode() throws Exception {
byte[] BAD = new byte[] {(byte) 0x80};
StringWriter sw = new StringWriter();
- WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8");
+ WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8", true);
try {
wos.write(BAD);
wos.flush();
@@ -107,7 +107,7 @@
public void testBadUnicode2() throws Exception {
byte[] BAD = new byte[] {(byte) 'h', (byte) 'i', (byte) 0x80};
StringWriter sw = new StringWriter();
- WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8");
+ WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8", true);
try {
wos.write(BAD);
wos.flush();
@@ -121,7 +121,7 @@
public void testBadUnicode3() throws Exception {
byte[] BAD = new byte[] {(byte) 'h', (byte) 'i', (byte) 0xc2, (byte) 0x00};
StringWriter sw = new StringWriter();
- WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8");
+ WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8", true);
try {
wos.write(BAD);
wos.flush();
@@ -135,7 +135,7 @@
public void testBadUnicode4() throws Exception {
byte[] BAD = new byte[] {(byte) 'h', (byte) 'i', (byte) 0xc2};
StringWriter sw = new StringWriter();
- WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8");
+ WriterOutputStream wos = new WriterOutputStream(sw, "UTF-8", true);
wos.write(BAD);
wos.flush();
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-04-16 22:04:01
|
Revision: 5297
http://jnode.svn.sourceforge.net/jnode/?rev=5297&view=rev
Author: chrisboertien
Date: 2009-04-16 22:03:52 +0000 (Thu, 16 Apr 2009)
Log Message:
-----------
update ignore files
Signed-off-by: chrisboertien <chr...@gm...>
Modified Paths:
--------------
trunk/.cvsignore
trunk/.gitignore
Modified: trunk/.cvsignore
===================================================================
--- trunk/.cvsignore 2009-04-16 22:03:42 UTC (rev 5296)
+++ trunk/.cvsignore 2009-04-16 22:03:52 UTC (rev 5297)
@@ -12,3 +12,4 @@
local
bin
classlib.jar
+all/lib/classlib-src.jar
Modified: trunk/.gitignore
===================================================================
--- trunk/.gitignore 2009-04-16 22:03:42 UTC (rev 5296)
+++ trunk/.gitignore 2009-04-16 22:03:52 UTC (rev 5297)
@@ -7,3 +7,4 @@
jnode.properties
local/
classlib.jar
+all/lib/classlib-src.jar
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2009-04-17 13:51:06
|
Revision: 5300
http://jnode.svn.sourceforge.net/jnode/?rev=5300&view=rev
Author: crawley
Date: 2009-04-17 13:50:59 +0000 (Fri, 17 Apr 2009)
Log Message:
-----------
Update Eclipse buildpaths to attach source JAR for classlib6
Modified Paths:
--------------
trunk/builder/.classpath
trunk/core/.classpath
trunk/distr/.classpath
trunk/fs/.classpath
trunk/gui/.classpath
trunk/net/.classpath
trunk/shell/.classpath
trunk/textui/.classpath
Modified: trunk/builder/.classpath
===================================================================
--- trunk/builder/.classpath 2009-04-17 06:43:12 UTC (rev 5299)
+++ trunk/builder/.classpath 2009-04-17 13:50:59 UTC (rev 5300)
@@ -10,6 +10,6 @@
<classpathentry kind="lib" path="lib/xml-apis.jar"/>
<classpathentry kind="lib" path="lib/bcel-5.1.jar"/>
<classpathentry kind="lib" path="/shell/lib/nanoxml-2.2.3.jar"/>
- <classpathentry kind="lib" path="/all/lib/classlib.jar"/>
+ <classpathentry kind="lib" path="/all/lib/classlib.jar" sourcepath="/all/lib/classlib-src.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Modified: trunk/core/.classpath
===================================================================
--- trunk/core/.classpath 2009-04-17 06:43:12 UTC (rev 5299)
+++ trunk/core/.classpath 2009-04-17 13:50:59 UTC (rev 5300)
@@ -26,6 +26,6 @@
</accessrules>
</classpathentry>
<classpathentry kind="lib" path="lib/ant-contrib-1.0b3.jar"/>
- <classpathentry kind="lib" path="/all/lib/classlib.jar"/>
+ <classpathentry kind="lib" path="/all/lib/classlib.jar" sourcepath="/all/lib/classlib-src.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Modified: trunk/distr/.classpath
===================================================================
--- trunk/distr/.classpath 2009-04-17 06:43:12 UTC (rev 5299)
+++ trunk/distr/.classpath 2009-04-17 13:50:59 UTC (rev 5300)
@@ -21,6 +21,6 @@
<classpathentry kind="lib" path="lib/derbynet.jar"/>
<classpathentry kind="lib" path="/core/lib/log4j-1.2.8.jar"/>
<classpathentry kind="lib" path="/core/lib/junit-4.5.jar"/>
- <classpathentry kind="lib" path="/all/lib/classlib.jar"/>
+ <classpathentry kind="lib" path="/all/lib/classlib.jar" sourcepath="/all/lib/classlib-src.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Modified: trunk/fs/.classpath
===================================================================
--- trunk/fs/.classpath 2009-04-17 06:43:12 UTC (rev 5299)
+++ trunk/fs/.classpath 2009-04-17 13:50:59 UTC (rev 5300)
@@ -16,6 +16,6 @@
<classpathentry kind="lib" path="/core/lib/jmock-cglib-1.0.1.jar"/>
<classpathentry kind="lib" path="/core/lib/log4j-1.2.8.jar"/>
<classpathentry kind="lib" path="/core/lib/junit-4.5.jar"/>
- <classpathentry kind="lib" path="/all/lib/classlib.jar"/>
+ <classpathentry kind="lib" path="/all/lib/classlib.jar" sourcepath="/all/lib/classlib-src.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Modified: trunk/gui/.classpath
===================================================================
--- trunk/gui/.classpath 2009-04-17 06:43:12 UTC (rev 5299)
+++ trunk/gui/.classpath 2009-04-17 13:50:59 UTC (rev 5300)
@@ -9,6 +9,6 @@
<classpathentry kind="src" path="/core"/>
<classpathentry kind="src" path="/shell"/>
<classpathentry kind="lib" path="/core/lib/log4j-1.2.8.jar"/>
- <classpathentry kind="lib" path="/all/lib/classlib.jar"/>
+ <classpathentry kind="lib" path="/all/lib/classlib.jar" sourcepath="/all/lib/classlib-src.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Modified: trunk/net/.classpath
===================================================================
--- trunk/net/.classpath 2009-04-17 06:43:12 UTC (rev 5299)
+++ trunk/net/.classpath 2009-04-17 13:50:59 UTC (rev 5300)
@@ -11,6 +11,6 @@
<classpathentry kind="lib" path="/core/lib/commons-net-1.1.0.jar"/>
<classpathentry kind="lib" path="/core/lib/log4j-1.2.8.jar"/>
<classpathentry kind="lib" path="/core/lib/junit-4.5.jar"/>
- <classpathentry kind="lib" path="/all/lib/classlib.jar"/>
+ <classpathentry kind="lib" path="/all/lib/classlib.jar" sourcepath="/all/lib/classlib-src.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Modified: trunk/shell/.classpath
===================================================================
--- trunk/shell/.classpath 2009-04-17 06:43:12 UTC (rev 5299)
+++ trunk/shell/.classpath 2009-04-17 13:50:59 UTC (rev 5300)
@@ -11,6 +11,6 @@
<classpathentry kind="lib" path="/core/lib/log4j-1.2.8.jar"/>
<classpathentry kind="lib" path="lib/nanoxml-2.2.3.jar"/>
<classpathentry kind="lib" path="/core/lib/junit-4.5.jar"/>
- <classpathentry kind="lib" path="/all/lib/classlib.jar" sourcepath="/all/lib/classlib.jar"/>
+ <classpathentry kind="lib" path="/all/lib/classlib.jar" sourcepath="/all/lib/classlib-src.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Modified: trunk/textui/.classpath
===================================================================
--- trunk/textui/.classpath 2009-04-17 06:43:12 UTC (rev 5299)
+++ trunk/textui/.classpath 2009-04-17 13:50:59 UTC (rev 5300)
@@ -4,6 +4,6 @@
<classpathentry exported="true" kind="src" path="/core"/>
<classpathentry exported="true" kind="src" path="/shell"/>
<classpathentry kind="lib" path="/core/lib/log4j-1.2.8.jar"/>
- <classpathentry kind="lib" path="/all/lib/classlib.jar"/>
+ <classpathentry kind="lib" path="/all/lib/classlib.jar" sourcepath="/all/lib/classlib-src.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-04-18 15:03:36
|
Revision: 5306
http://jnode.svn.sourceforge.net/jnode/?rev=5306&view=rev
Author: chrisboertien
Date: 2009-04-18 15:03:26 +0000 (Sat, 18 Apr 2009)
Log Message:
-----------
checkstyle fixes
Signed-off-by: chrisboertien <chr...@gm...>
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
trunk/fs/src/fs/org/jnode/fs/command/archive/Zip.java
trunk/fs/src/fs/org/jnode/fs/command/archive/ZipCommand.java
trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2009-04-18 14:54:00 UTC (rev 5305)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2009-04-18 15:03:26 UTC (rev 5306)
@@ -149,17 +149,17 @@
*/
@Override
public void putChar(char v[], int offset, int length, int color) {
- // This method tries to paint runs of characters on the current screen
- // line with one call to screen.set(int, char[], int, int, int). The
- // 'mark' is the offset of the start of the current run. The 'limit'
- // is the offset at which we must end (or have ended) the current run.
+ // This method tries to paint runs of characters on the current screen
+ // line with one call to screen.set(int, char[], int, int, int). The
+ // 'mark' is the offset of the start of the current run. The 'limit'
+ // is the offset at which we must end (or have ended) the current run.
int mark = 0;
int limit = Math.min(length, scrWidth - curX) - 1;
for (int i = 0; i < length; i++) {
char c = v[i + offset];
if (c == '\n' || c == '\b' || c == '\t' || i == limit) {
- // The current run ends now. First, output all but 'c' directly to the
- // current screen line, adjusting curX and curY when we're done.
+ // The current run ends now. First, output all but 'c' directly to the
+ // current screen line, adjusting curX and curY when we're done.
final int ln = i - mark;
if (ln > 0) {
screen.set(screen.getOffset(curX, curY), v, offset + mark, ln, color);
Modified: trunk/fs/src/fs/org/jnode/fs/command/archive/Zip.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/command/archive/Zip.java 2009-04-18 14:54:00 UTC (rev 5305)
+++ trunk/fs/src/fs/org/jnode/fs/command/archive/Zip.java 2009-04-18 15:03:26 UTC (rev 5306)
@@ -22,7 +22,6 @@
import java.io.File;
import java.io.FileFilter;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.LineNumberReader;
@@ -30,7 +29,6 @@
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
-import java.util.regex.Pattern;
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipExtraField;
import org.apache.tools.zip.ZipFile;
Modified: trunk/fs/src/fs/org/jnode/fs/command/archive/ZipCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/command/archive/ZipCommand.java 2009-04-18 14:54:00 UTC (rev 5305)
+++ trunk/fs/src/fs/org/jnode/fs/command/archive/ZipCommand.java 2009-04-18 15:03:26 UTC (rev 5306)
@@ -20,8 +20,8 @@
package org.jnode.fs.command.archive;
-import java.text.DateFormat;
-import java.text.ParseException;
+//import java.text.DateFormat;
+//import java.text.ParseException;
import java.util.ArrayList;
import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.FlagArgument;
Modified: trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java 2009-04-18 14:54:00 UTC (rev 5305)
+++ trunk/shell/src/shell/org/jnode/shell/io/ShellConsoleWriter.java 2009-04-18 15:03:26 UTC (rev 5306)
@@ -91,8 +91,7 @@
}
@Override
- public Writer append(CharSequence csq, int start, int end)
- throws IOException {
+ public Writer append(CharSequence csq, int start, int end) throws IOException {
return writer.append(csq, start, end);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2009-04-19 14:06:38
|
Revision: 5310
http://jnode.svn.sourceforge.net/jnode/?rev=5310&view=rev
Author: crawley
Date: 2009-04-19 14:06:34 +0000 (Sun, 19 Apr 2009)
Log Message:
-----------
Implement the shell properties, and tools to set and display them. Changed
jnode.interpreter, jnode.invoker, jnode.debug and others into shell
properties (were system properties).
Modified Paths:
--------------
trunk/distr/descriptors/net.wimpi.telnetd.xml
trunk/shell/descriptors/org.jnode.shell.command.xml
trunk/shell/descriptors/org.jnode.shell.xml
trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.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/Shell.java
trunk/shell/src/shell/org/jnode/shell/ShellManager.java
trunk/shell/src/shell/org/jnode/shell/ShellUtils.java
trunk/shell/src/shell/org/jnode/shell/SimpleCommandInvoker.java
trunk/shell/src/shell/org/jnode/shell/command/EnvCommand.java
trunk/shell/src/shell/org/jnode/shell/command/SetCommand.java
trunk/shell/src/shell/org/jnode/shell/def/DefaultShellManager.java
trunk/shell/src/shell/org/jnode/shell/syntax/PropertyNameArgument.java
trunk/shell/src/test/org/jnode/test/shell/CompletionTest.java
trunk/shell/src/test/org/jnode/test/shell/DefaultSyntaxCompletionTest.java
Added Paths:
-----------
trunk/shell/src/shell/org/jnode/shell/syntax/ShellPropertyNameArgument.java
Modified: trunk/distr/descriptors/net.wimpi.telnetd.xml
===================================================================
--- trunk/distr/descriptors/net.wimpi.telnetd.xml 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/distr/descriptors/net.wimpi.telnetd.xml 2009-04-19 14:06:34 UTC (rev 5310)
@@ -28,19 +28,13 @@
<permission class="java.lang.RuntimePermission" name="modifyThreadGroup"/>
<permission class="java.lang.RuntimePermission" name="exitVM"/>
- <!-- do we need them all like in org.jnode.shell ? only "jnode.prompt" has been checked -->
- <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
+ <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
<permission class="java.lang.RuntimePermission" name="modifyThreadGroup"/>
<permission class="java.lang.RuntimePermission" name="modifyThread"/>
<permission class="java.lang.RuntimePermission" name="setIO"/>
<permission class="java.net.SocketPermission" name="*" actions="resolve,listen,connect"/>
<permission class="java.net.SocketPermission" name="*:0-" actions="connect,resolve,listen"/>
<permission class="java.util.PropertyPermission" name="jnode.cmdline" actions="read"/>
- <permission class="java.util.PropertyPermission" name="jnode.debug" actions="read"/>
- <permission class="java.util.PropertyPermission" name="jnode.history" actions="read"/>
- <permission class="java.util.PropertyPermission" name="jnode.invoker" actions="read"/>
- <permission class="java.util.PropertyPermission" name="jnode.interpreter" actions="read"/>
- <permission class="java.util.PropertyPermission" name="jnode.prompt" actions="read,write"/>
<permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
<permission class="java.util.PropertyPermission" name="user.dir" actions="read"/>
</extension>
Modified: trunk/shell/descriptors/org.jnode.shell.command.xml
===================================================================
--- trunk/shell/descriptors/org.jnode.shell.command.xml 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/shell/descriptors/org.jnode.shell.command.xml 2009-04-19 14:06:34 UTC (rev 5310)
@@ -150,6 +150,8 @@
<empty description="Print the system properties"/>
<option argLabel="env" shortName="e" longName="env"
description="Print the system environment variables"/>
+ <option argLabel="shell" shortName="s" longName="shell"
+ description="Print the current shell properties"/>
</syntax>
<syntax alias="exit" description="Exit the current shell"/>
<syntax alias="gc">
@@ -358,11 +360,21 @@
<argument argLabel="file"/>
</syntax>
<syntax alias="set">
- <sequence description="Set a system property or environment variable">
+ <sequence description="Set a shell property">
+ <option argLabel="shell" shortName="s" longName="shell"/>
+ <argument argLabel="skey"/>
+ <argument argLabel="value"/>
+ </sequence>
+ <sequence>
+ <argument description="Remove a shell property" argLabel="skey"/>
+ <option argLabel="shell" shortName="s" longName="shell"/>
+ </sequence>
+ <sequence description="Set a system property">
<argument argLabel="key"/>
<argument argLabel="value"/>
</sequence>
<argument description="Remove a system property" argLabel="key"/>
+
</syntax>
<syntax alias="sleep" description="Sleep for a given number of seconds">
<argument argLabel="seconds"/>
@@ -378,7 +390,7 @@
<option argLabel="file" longName="load" shortName="l"/>
<argument argLabel="alias"/>
</sequence>
- <sequence description="Set a system property">
+ <sequence description="Remove the syntax for a given alias">
<option argLabel="remove" longName="remove" shortName="r"/>
<argument argLabel="alias"/>
</sequence>
Modified: trunk/shell/descriptors/org.jnode.shell.xml
===================================================================
--- trunk/shell/descriptors/org.jnode.shell.xml 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/shell/descriptors/org.jnode.shell.xml 2009-04-19 14:06:34 UTC (rev 5310)
@@ -42,11 +42,6 @@
<permission class="java.net.SocketPermission" name="*" actions="resolve,listen,connect"/>
<permission class="java.net.SocketPermission" name="*:0-" actions="connect,resolve,listen"/>
<permission class="java.util.PropertyPermission" name="jnode.cmdline" actions="read"/>
- <permission class="java.util.PropertyPermission" name="jnode.debug" actions="read"/>
- <permission class="java.util.PropertyPermission" name="jnode.history" actions="read"/>
- <permission class="java.util.PropertyPermission" name="jnode.invoker" actions="read"/>
- <permission class="java.util.PropertyPermission" name="jnode.interpreter" actions="read"/>
- <permission class="java.util.PropertyPermission" name="jnode.prompt" actions="read,write"/>
<permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
<permission class="java.util.PropertyPermission" name="user.dir" actions="read"/>
<permission class="java.lang.reflect.ReflectPermission" name="suppressAccessChecks"/>
Modified: trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java 2009-04-19 14:06:34 UTC (rev 5310)
@@ -65,8 +65,6 @@
static final String EXECUTE_METHOD = "execute";
boolean blocking;
-
- boolean debugEnabled;
Thread blockingThread;
CommandThread threadProcess = null;
@@ -266,11 +264,6 @@
@Override
public boolean isDebugEnabled() {
- return this.debugEnabled;
+ return commandShell.isDebugEnabled();
}
-
- @Override
- public void setDebugEnabled(boolean debugEnabled) {
- this.debugEnabled = debugEnabled;
- }
}
Modified: trunk/shell/src/shell/org/jnode/shell/CommandShell.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2009-04-19 14:06:34 UTC (rev 5310)
@@ -37,10 +37,12 @@
import java.security.PrivilegedAction;
import java.text.DateFormat;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
+import java.util.TreeMap;
import javax.naming.NameNotFoundException;
@@ -93,7 +95,7 @@
public static final String CMDLINE_PROPERTY_NAME = "jnode.cmdline";
public static final String DEBUG_PROPERTY_NAME = "jnode.debug";
- public static final String DEBUG_DEFAULT = "false";
+ public static final String DEBUG_DEFAULT = "true";
public static final String HISTORY_PROPERTY_NAME = "jnode.history";
public static final String HISTORY_DEFAULT = "true";
@@ -162,10 +164,10 @@
private String lastInputLine = "";
private SimpleCommandInvoker invoker;
- private String invokerName;
private CommandInterpreter interpreter;
- private String interpreterName;
+
+ private HashMap<String, String> propertyMap;
private CompletionInfo completion;
@@ -214,7 +216,7 @@
console.addConsoleListener(this);
aliasMgr = ShellUtils.getAliasManager().createAliasManager();
syntaxMgr = ShellUtils.getSyntaxManager().createSyntaxManager();
- System.setProperty(PROMPT_PROPERTY_NAME, DEFAULT_PROMPT);
+ propertyMap = initShellProperties();
} catch (NameNotFoundException ex) {
throw new ShellException("Cannot find required resource", ex);
} catch (Exception ex) {
@@ -235,7 +237,7 @@
new OutputStreamWriter(System.err));
aliasMgr = ShellUtils.getAliasManager().createAliasManager();
syntaxMgr = ShellUtils.getSyntaxManager().createSyntaxManager();
- System.setProperty(PROMPT_PROPERTY_NAME, DEFAULT_PROMPT);
+ propertyMap = initShellProperties();
} catch (NameNotFoundException ex) {
throw new ShellException("Cannot find required resource", ex);
} catch (Exception ex) {
@@ -243,6 +245,16 @@
}
}
+ private HashMap<String, String> initShellProperties() {
+ HashMap<String, String> map = new HashMap<String, String>();
+ map.put(PROMPT_PROPERTY_NAME, DEFAULT_PROMPT);
+ map.put(DEBUG_PROPERTY_NAME, DEBUG_DEFAULT);
+ map.put(HISTORY_PROPERTY_NAME, HISTORY_DEFAULT);
+ map.put(INVOKER_PROPERTY_NAME, INITIAL_INVOKER);
+ map.put(INTERPRETER_PROPERTY_NAME, INITIAL_INTERPRETER);
+ return map;
+ }
+
private void setupStreams(Reader in, Writer out, Writer err) {
this.cout = new CommandOutput(out);
this.cerr = new CommandOutput(err);
@@ -279,8 +291,11 @@
// Here, we are running in the CommandShell (main) Thread
// so, we can register ourself as the current shell
// (it will also be the current shell for all children Thread)
-
- configureShell();
+ try {
+ configureShell();
+ } catch (ShellException ex) {
+ throw new ShellFailureException("Shell setup failure", ex);
+ }
// Run commands from the JNode command line first
final String cmdLine = System.getProperty(CMDLINE_PROPERTY_NAME, "");
@@ -344,7 +359,6 @@
while (!isExited()) {
String input = null;
try {
- refreshFromProperties();
clearEof();
outPW.print(prompt());
readingCommand = true;
@@ -448,7 +462,7 @@
stackTrace(ex);
}
- public void configureShell() {
+ public void configureShell() throws ShellException {
try {
ShellUtils.getShellManager().registerShell(this);
@@ -457,84 +471,98 @@
ShellUtils.registerCommandInvoker(ProcletCommandInvoker.FACTORY);
ShellUtils.registerCommandInvoker(IsolateCommandInvoker.FACTORY);
ShellUtils.registerCommandInterpreter(DefaultInterpreter.FACTORY);
- ShellUtils
- .registerCommandInterpreter(RedirectingInterpreter.FACTORY);
- } catch (NameNotFoundException e1) {
- e1.printStackTrace();
+ ShellUtils.registerCommandInterpreter(RedirectingInterpreter.FACTORY);
+ } catch (NameNotFoundException ex) {
+ throw new ShellFailureException(
+ "Bailing out: fatal error during CommandShell configuration", ex);
}
- // Configure the shell based on System properties.
- setupFromProperties();
+ try {
+ setupFromProperties();
+ } catch (ShellException ex) {
+ errPW.println("Problem shell configuration");
+ errPW.println(ex.getMessage());
+ stackTrace(ex);
+ errPW.println("Retrying shell configuration with fallback invoker/interpreter settings");
+ propertyMap.put(INVOKER_PROPERTY_NAME, FALLBACK_INVOKER);
+ propertyMap.put(INTERPRETER_PROPERTY_NAME, FALLBACK_INTERPRETER);
+ try {
+ setupFromProperties();
+ } catch (ShellException ex2) {
+ throw new ShellFailureException(
+ "Bailing out: fatal error during CommandShell configuration", ex2);
+ }
+ }
// Now become interactive
ownThread = Thread.currentThread();
}
+
+ @Override
+ public String getProperty(String propName) {
+ return propertyMap.get(propName);
+ }
- private void setupFromProperties() {
- debugEnabled = Boolean.parseBoolean(System.getProperty(
- DEBUG_PROPERTY_NAME, DEBUG_DEFAULT));
- historyEnabled = Boolean.parseBoolean(System.getProperty(
- HISTORY_PROPERTY_NAME, HISTORY_DEFAULT));
- try {
- setCommandInvoker(System.getProperty(INVOKER_PROPERTY_NAME,
- INITIAL_INVOKER));
- } catch (Exception ex) {
- errPW.println(ex.getMessage());
- stackTrace(ex);
- // Use the fallback invoker
- setCommandInvoker(FALLBACK_INVOKER);
+ @Override
+ public void removeProperty(String key) throws ShellException {
+ if (key.equals(INTERPRETER_PROPERTY_NAME) || key.equals(INVOKER_PROPERTY_NAME) ||
+ key.equals(DEBUG_PROPERTY_NAME) || key.equals(PROMPT_PROPERTY_NAME) ||
+ key.equals(HISTORY_PROPERTY_NAME)) {
+ throw new ShellException("Property '" + key + "' cannot be removed");
}
- try {
- setCommandInterpreter(System.getProperty(INTERPRETER_PROPERTY_NAME,
- INITIAL_INTERPRETER));
- } catch (Exception ex) {
- errPW.println(ex.getMessage());
- stackTrace(ex);
- // Use the fallback interpreter
- setCommandInterpreter(FALLBACK_INTERPRETER);
- }
- invoker.setDebugEnabled(debugEnabled);
+ propertyMap.remove(key);
}
- private void refreshFromProperties() {
- debugEnabled = Boolean.parseBoolean(System.getProperty(
- DEBUG_PROPERTY_NAME, DEBUG_DEFAULT));
- historyEnabled = Boolean.parseBoolean(System.getProperty(
- HISTORY_PROPERTY_NAME, HISTORY_DEFAULT));
+ @Override
+ public void setProperty(String propName, String value) throws ShellException {
+ String oldValue = propertyMap.get(propName);
+ propertyMap.put(propName, value);
try {
- setCommandInterpreter(System.getProperty(INTERPRETER_PROPERTY_NAME, ""));
- } catch (Exception ex) {
- errPW.println(ex.getMessage());
- stackTrace(ex);
+ setupFromProperties();
+ } catch (ShellException ex) {
+ // Try to undo the change
+ propertyMap.put(propName, oldValue);
+ try {
+ setupFromProperties();
+ } catch (ShellException ex2) {
+ // This may be our only chance to diagnose the original exception ....
+ errPW.println(ex.getMessage());
+ stackTrace(ex);
+ throw new ShellFailureException("Failed to revert shell properties", ex2);
+ }
+ throw ex;
}
- try {
- setCommandInvoker(System.getProperty(INVOKER_PROPERTY_NAME, ""));
- } catch (Exception ex) {
- errPW.println(ex.getMessage());
- stackTrace(ex);
- }
- invoker.setDebugEnabled(debugEnabled);
}
- public synchronized void setCommandInvoker(String name) throws IllegalArgumentException {
- if (!name.equals(this.invokerName)) {
- this.invoker = ShellUtils.createInvoker(name, this);
- if (this.invokerName != null) {
+ @Override
+ public TreeMap<String, String> getProperties() {
+ return new TreeMap<String, String>(propertyMap);
+ }
+
+ private void setupFromProperties() throws ShellException {
+ setCommandInvoker(propertyMap.get(INVOKER_PROPERTY_NAME));
+ setCommandInterpreter(propertyMap.get(INTERPRETER_PROPERTY_NAME));
+ debugEnabled = Boolean.parseBoolean(propertyMap.get(DEBUG_PROPERTY_NAME));
+ historyEnabled = Boolean.parseBoolean(propertyMap.get(HISTORY_PROPERTY_NAME));
+ }
+
+ private synchronized void setCommandInvoker(String name) throws ShellException {
+ if (invoker == null || !name.equals(invoker.getName())) {
+ boolean alreadySet = invoker != null;
+ invoker = ShellUtils.createInvoker(name, this);
+ if (alreadySet) {
outPW.println("Switched to " + name + " invoker");
}
- this.invokerName = name;
- System.setProperty(INVOKER_PROPERTY_NAME, name);
}
}
- public synchronized void setCommandInterpreter(String name) throws IllegalArgumentException {
- if (!name.equals(this.interpreterName)) {
- this.interpreter = ShellUtils.createInterpreter(name);
- if (this.interpreterName != null) {
+ private synchronized void setCommandInterpreter(String name) throws ShellException {
+ if (interpreter == null || !name.equals(interpreter.getName())) {
+ boolean alreadySet = interpreter != null;
+ interpreter = ShellUtils.createInterpreter(name);
+ if (alreadySet) {
outPW.println("Switched to " + name + " interpreter");
}
- this.interpreterName = name;
- System.setProperty(INTERPRETER_PROPERTY_NAME, name);
}
}
@@ -637,7 +665,8 @@
Thread.currentThread().getContextClassLoader();
return new CommandInfo(cl.loadClass(cmd), false);
} catch (ClassNotFoundException ex2) {
- throw new ShellException("Cannot find an alias or load a command class for '" + cmd + "'", ex);
+ throw new ShellException(
+ "Cannot find an alias or load a command class for '" + cmd + "'", ex);
}
}
}
@@ -687,8 +716,7 @@
* Gets the expanded prompt
*/
protected String prompt() {
- String prompt = System
- .getProperty(PROMPT_PROPERTY_NAME, DEFAULT_PROMPT);
+ String prompt = getProperty(PROMPT_PROPERTY_NAME);
final StringBuffer result = new StringBuffer();
boolean commandMode = false;
try {
@@ -876,10 +904,6 @@
}
}
- public SimpleCommandInvoker getDefaultCommandInvoker() {
- return ShellUtils.createInvoker("default", this);
- }
-
public int runCommandFile(File file, String alias, String[] args) throws ShellException {
// FIXME extend to allow arguments to be passed to the script.
boolean enabled = setHistoryEnabled(false);
Modified: trunk/shell/src/shell/org/jnode/shell/DefaultCommandInvoker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/DefaultCommandInvoker.java 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/shell/src/shell/org/jnode/shell/DefaultCommandInvoker.java 2009-04-19 14:06:34 UTC (rev 5310)
@@ -53,7 +53,6 @@
private final PrintWriter err;
private final CommandShell shell;
- private boolean debugEnabled;
private static final Class<?>[] MAIN_ARG_TYPES = new Class[] {String[].class};
@@ -165,12 +164,6 @@
@Override
public boolean isDebugEnabled() {
- return this.debugEnabled;
+ return shell.isDebugEnabled();
}
-
- @Override
- public void setDebugEnabled(boolean debugEnabled) {
- this.debugEnabled = debugEnabled;
- }
-
}
Modified: trunk/shell/src/shell/org/jnode/shell/Shell.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/Shell.java 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/shell/src/shell/org/jnode/shell/Shell.java 2009-04-19 14:06:34 UTC (rev 5310)
@@ -22,6 +22,7 @@
import java.io.File;
import java.io.Writer;
+import java.util.TreeMap;
import org.jnode.driver.console.Console;
import org.jnode.driver.console.InputCompleter;
@@ -99,5 +100,47 @@
* @return the escaped word.
*/
public String escapeWord(String word);
+
+ /**
+ * Set a shell property. Some properties have special meaning to a Shell
+ * and may cause its behavior to change.
+ *
+ * @param propName the name of the property
+ * @param value the property value
+ * @throws ShellException This may be thrown if the name / value pair is
+ * not acceptable.
+ */
+ public void setProperty(String propName, String value) throws ShellException;
+
+ /**
+ * Get the current value of a shell property.
+ *
+ * @param propName the property name.
+ * @return the property value or {@code null}
+ */
+ public String getProperty(String propName);
+
+ /**
+ * Remove a shell property. Special properties typically may not be removed,
+ *
+ * @param propName the name of the property
+ * @throws ShellException This may be thrown if the property cannot be removed.
+ */
+ public void removeProperty(String key) throws ShellException;
+
+ /**
+ * Get the shell properties for this shell instance. The result is a copy
+ * of the shell properties object; i.e. changes to the result Map object
+ * have no effect on the shell.
+ * <p>
+ * Note that shell properties are
+ * not the same as UNIX-style shell variables. An interpreter that supports
+ * shell variables may mirror some of them in the properties, but it is not
+ * required to. The recommended place for publishing (exported) shell variables
+ * is the "environment variables"; e.g. in {@link System#getenv()}.
+ *
+ * @return a copy of the shell properties.
+ */
+ public TreeMap<String, String> getProperties();
}
Modified: trunk/shell/src/shell/org/jnode/shell/ShellManager.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/ShellManager.java 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/shell/src/shell/org/jnode/shell/ShellManager.java 2009-04-19 14:06:34 UTC (rev 5310)
@@ -57,9 +57,9 @@
public void unregisterInterpreterFactory(CommandInterpreter.Factory factory);
public SimpleCommandInvoker createInvoker(String name, CommandShell shell)
- throws IllegalArgumentException;
+ throws ShellException;
public CommandInterpreter createInterpreter(String name)
- throws IllegalArgumentException;
+ throws ShellException;
}
Modified: trunk/shell/src/shell/org/jnode/shell/ShellUtils.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/ShellUtils.java 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/shell/src/shell/org/jnode/shell/ShellUtils.java 2009-04-19 14:06:34 UTC (rev 5310)
@@ -103,7 +103,7 @@
}
public static SimpleCommandInvoker createInvoker(String name, CommandShell shell)
- throws IllegalArgumentException {
+ throws ShellException {
try {
return getShellManager().createInvoker(name, shell);
} catch (NameNotFoundException ex) {
@@ -112,7 +112,7 @@
}
public static CommandInterpreter createInterpreter(String name)
- throws IllegalArgumentException, ShellFailureException {
+ throws ShellException {
try {
return getShellManager().createInterpreter(name);
} catch (NameNotFoundException ex) {
Modified: trunk/shell/src/shell/org/jnode/shell/SimpleCommandInvoker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/SimpleCommandInvoker.java 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/shell/src/shell/org/jnode/shell/SimpleCommandInvoker.java 2009-04-19 14:06:34 UTC (rev 5310)
@@ -75,6 +75,4 @@
String getName();
boolean isDebugEnabled();
-
- void setDebugEnabled(boolean enabled);
}
Modified: trunk/shell/src/shell/org/jnode/shell/command/EnvCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/EnvCommand.java 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/shell/src/shell/org/jnode/shell/command/EnvCommand.java 2009-04-19 14:06:34 UTC (rev 5310)
@@ -30,6 +30,7 @@
import java.util.TreeMap;
import org.jnode.shell.AbstractCommand;
+import org.jnode.shell.ShellUtils;
import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.FlagArgument;
@@ -39,13 +40,17 @@
public class EnvCommand extends AbstractCommand {
// FIXME ... this class and the corresponding alias are incorrectly named
- private final FlagArgument envArg = new FlagArgument(
- "env", Argument.OPTIONAL + Argument.SINGLE,
- "If set, print the System 'env' variables rather that the System properties.");
+ private final FlagArgument envArg = new FlagArgument(
+ "env", Argument.OPTIONAL + Argument.SINGLE,
+ "If set, print the System 'env' variables rather that the System properties.");
+ private final FlagArgument shellArg = new FlagArgument(
+ "shell", Argument.OPTIONAL + Argument.SINGLE,
+ "If set, print the current shell properties rather that the System properties.");
+
public EnvCommand() {
super("Print the System properties");
- registerArguments(envArg);
+ registerArguments(envArg, shellArg);
}
public static void main(String[] args) throws Exception {
@@ -56,18 +61,20 @@
* Execute this command
*/
public void execute() throws Exception {
- final TreeMap<Object, Object> sortedPs;
- if (envArg.isSet()) {
- Map<String, String> ps =
- (Map<String, String>) AccessController.doPrivileged(new GetEnvAction());
- sortedPs = new TreeMap<Object, Object>(ps);
+ final TreeMap<?, ?> sortedPs;
+ if (envArg.isSet()) {
+ Map<String, String> ps =
+ (Map<String, String>) AccessController.doPrivileged(new GetEnvAction());
+ sortedPs = new TreeMap<Object, Object>(ps);
+ } else if (shellArg.isSet()) {
+ sortedPs = ShellUtils.getCurrentShell().getProperties();
} else {
Properties ps = AccessController.doPrivileged(new GetPropertiesAction());
sortedPs = new TreeMap<Object, Object>(ps);
}
final PrintWriter out = getOutput().getPrintWriter();
- for (Map.Entry<Object, Object> entry : sortedPs.entrySet()) {
+ for (Map.Entry<?, ?> entry : sortedPs.entrySet()) {
final String key = entry.getKey().toString();
final String value = entry.getValue().toString();
out.println(key + '=' + value);
Modified: trunk/shell/src/shell/org/jnode/shell/command/SetCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/SetCommand.java 2009-04-18 18:19:06 UTC (rev 5309)
+++ trunk/shell/src/shell/org/jnode/shell/command/SetCommand.java 2009-04-19 14:06:34 UTC (rev 5310)
@@ -23,28 +23,41 @@
import java.io.PrintWriter;
import org.jnode.shell.AbstractCommand;
+import org.jnode.shell.ShellUtils;
import org.jnode.shell.syntax.Argument;
+import org.jnode.shell.syntax.FlagArgument;
import org.jnode.shell.syntax.PropertyNameArgument;
+import org.jnode.shell.syntax.ShellPropertyNameArgument;
import org.jnode.shell.syntax.StringArgument;
/**
- * Shell command to set property values.
+ * Shell command to set system or shell property values.
*
* @author Ewout Prangsma (ep...@us...)
* @author Martin Husted Hartvig (ha...@jn...)
* @author Levente S\u00e1ntha
+ * @author cr...@jn...
*/
public class SetCommand extends AbstractCommand {
- private PropertyNameArgument keyArg =
- new PropertyNameArgument("key", Argument.MANDATORY, "The name of the property to be set (or cleared)");
- private StringArgument valueArg =
- new StringArgument("value", Argument.OPTIONAL, "The new property value");
+ private PropertyNameArgument keyArg = new PropertyNameArgument(
+ "key", Argument.OPTIONAL, "The name of the property to be set (or cleared)");
+ private ShellPropertyNameArgument skeyArg = new ShellPropertyNameArgument(
+ "skey", Argument.OPTIONAL, "The name of the shell property to be set (or cleared)");
+
+ private StringArgument valueArg = new StringArgument(
+ "value", Argument.OPTIONAL, "The new property value");
+
+ private final FlagArgument shellArg = new FlagArgument(
+ "shell", Argument.OPTIONAL + Argument.SINGLE,
+ "If set, print the current shell properties rather that the System properties.");
+
+
public SetCommand() {
super("Set or clear the value of a property");
- registerArguments(keyArg, valueArg);
+ registerArguments(keyArg, skeyArg, valueArg, shellArg);
}
public static void main(String[] args) throws Exception {
@@ -53,14 +66,26 @@
public void execute() thro...
[truncated message content] |
|
From: <fd...@us...> - 2009-04-19 19:42:08
|
Revision: 5317
http://jnode.svn.sourceforge.net/jnode/?rev=5317&view=rev
Author: fduminy
Date: 2009-04-19 19:42:05 +0000 (Sun, 19 Apr 2009)
Log Message:
-----------
fixed various bugs in JPartition/JPartitionTest
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/AbstractDeviceManager.java
trunk/distr/src/apps/org/jnode/apps/jpartition/JPartitionCommand.java
trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/ConsoleView.java
trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/components/Options.java
trunk/distr/src/test/org/jnode/apps/jpartition/JPartitionTest.java
trunk/distr/src/test/org/jnode/apps/jpartition/utils/device/DeviceUtils.java
trunk/fs/src/test/org/jnode/test/fs/driver/stubs/StubDeviceManager.java
Modified: trunk/core/src/driver/org/jnode/driver/AbstractDeviceManager.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/AbstractDeviceManager.java 2009-04-19 19:38:27 UTC (rev 5316)
+++ trunk/core/src/driver/org/jnode/driver/AbstractDeviceManager.java 2009-04-19 19:42:05 UTC (rev 5317)
@@ -87,8 +87,16 @@
* Create a new instance
*/
public AbstractDeviceManager() {
- cmdLine = (String) AccessController.doPrivileged(new GetPropertyAction(
- "jnode.cmdline", ""));
+ this((String) AccessController.doPrivileged(new GetPropertyAction(
+ "jnode.cmdline", "")));
+ }
+
+ /**
+ * Create a new instance
+ * @param commandLine command line or an empty string
+ */
+ protected AbstractDeviceManager(String commandLine) {
+ this.cmdLine = commandLine;
this.systemBus = new SystemBus();
}
@@ -143,7 +151,7 @@
* startup is delayed.
* <li>Connect the driver to the device, if a driver is found
* <li>Attempt to start the device. If this fails an exception is printed
- * in the log. You can test if the device was started succesfully, by read
+ * in the log. You can test if the device was started successfully, by read
* the <code>isStarted</code> status.
* </ul>
* Note that if the device already has a driver connected to it, the first
Modified: trunk/distr/src/apps/org/jnode/apps/jpartition/JPartitionCommand.java
===================================================================
--- trunk/distr/src/apps/org/jnode/apps/jpartition/JPartitionCommand.java 2009-04-19 19:38:27 UTC (rev 5316)
+++ trunk/distr/src/apps/org/jnode/apps/jpartition/JPartitionCommand.java 2009-04-19 19:42:05 UTC (rev 5317)
@@ -54,15 +54,22 @@
InputStream in = getInput().getInputStream();
PrintStream out = getOutput().getPrintStream();
PrintStream err = getError().getPrintStream();
+
+ boolean consoleView = FLAG_CONSOLE.isSet();
+ boolean swingView = FLAG_SWING.isSet();
+ doExecute(install, in, out, err, consoleView, swingView);
+ }
+
+ public void doExecute(boolean install, InputStream in, PrintStream out, PrintStream err, boolean consoleView, boolean swingView) throws Exception {
ViewFactory viewFactory =
- FLAG_CONSOLE.isSet() ? new ConsoleViewFactory(in, out, err)
- : FLAG_SWING.isSet() ? new SwingViewFactory() : null;
+ consoleView ? new ConsoleViewFactory(in, out, err)
+ : swingView ? new SwingViewFactory() : null;
if (viewFactory == null) {
err.println("No UI selected");
exit(1);
}
-
+
JPartition jpartition = new JPartition(viewFactory, install);
jpartition.launch();
- }
+ }
}
Modified: trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/ConsoleView.java
===================================================================
--- trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/ConsoleView.java 2009-04-19 19:38:27 UTC (rev 5316)
+++ trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/ConsoleView.java 2009-04-19 19:42:05 UTC (rev 5317)
@@ -104,10 +104,10 @@
List<Device> devices = UserFacade.getInstance().getDevices();
if ((devices != null) && !devices.isEmpty()) {
Options devicesOpt = new Options(context);
- int choice =
- (int) devicesOpt.show("Select a device", devices, DeviceLabelizer.INSTANCE);
+ Device choice =
+ devicesOpt.show("Select a device", devices, DeviceLabelizer.INSTANCE);
- String device = devices.get(choice - 1).getName();
+ String device = choice.getName();
UserFacade.getInstance().selectDevice(device);
println("device=" + device);
deviceSelected = true;
@@ -130,11 +130,9 @@
partitions = UserFacade.getInstance().getPartitions();
Options partitionsOpt = new Options(context);
- int choice =
- (int) partitionsOpt.show("Select a partition", partitions,
+ selectedPartition =
+ partitionsOpt.show("Select a partition", partitions,
PartitionLabelizer.INSTANCE);
-
- selectedPartition = partitions.get(choice - 1);
}
if (selectedPartition != null) {
@@ -154,31 +152,49 @@
return UserFacade.getInstance().createPartition(freePart.getStart(), size);
}
+ private enum Operation {
+ FORMAT_PARTITION("format partition") {
+ @Override
+ public void execute(ConsoleView view, Partition partition) throws Exception {
+ view.formatPartition(partition);
+ }
+ },
+ ADD_PARTITION("add partition") {
+ @Override
+ public void execute(ConsoleView view, Partition partition) throws Exception {
+ view.createPartition(partition);
+ }
+ },
+ REMOVE_PARTITION("remove partition") {
+ @Override
+ public void execute(ConsoleView view, Partition partition) throws Exception {
+ view.removePartition(partition);
+ }
+ };
+
+ private String label;
+
+ private Operation(String label) {
+ this.label = label;
+ }
+
+ @Override
+ public String toString() {
+ return label;
+ }
+
+ public abstract void execute(ConsoleView view, Partition partition) throws Exception;
+ }
private void modifyPartition(Partition partition) throws Exception {
+ Operation[] choices;
if (partition.isUsed()) {
- final String[] operations = new String[] {"format partition", "remove partition"};
-
- Options partitionsOpt = new Options(context);
- int choice = (int) partitionsOpt.show("Select an operation", operations);
- switch (choice) {
- case 0:
- formatPartition(partition);
- break;
- case 1:
- removePartition(partition);
- break;
- }
+ choices = new Operation[] {Operation.FORMAT_PARTITION, Operation.REMOVE_PARTITION};
} else {
- final String[] operations = new String[] {"add partition"};
-
- Options partitionsOpt = new Options(context);
- int choice = (int) partitionsOpt.show("Select an operation", operations);
- switch (choice) {
- case 0:
- createPartition(partition);
- break;
- }
+ choices = new Operation[] {Operation.ADD_PARTITION};
}
+ Options partitionsOpt = new Options(context);
+ Operation choice = partitionsOpt.show("Select an operation", choices);
+ choice.execute(this, partition);
}
private void removePartition(Partition partition) throws Exception {
@@ -193,8 +209,7 @@
private void formatPartition(Partition partition) throws Exception {
String[] formatters = UserFacade.getInstance().getFormatters();
Options partitionsOpt = new Options(context);
- int choice = (int) partitionsOpt.show("Select a filesystem", formatters);
- String formatter = formatters[choice];
+ String formatter = partitionsOpt.show("Select a filesystem", formatters);
UserFacade.getInstance().selectFormatter(formatter);
Modified: trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/components/Options.java
===================================================================
--- trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/components/Options.java 2009-04-19 19:38:27 UTC (rev 5316)
+++ trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/components/Options.java 2009-04-19 19:42:05 UTC (rev 5317)
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
import org.jnode.apps.jpartition.Context;
@@ -31,20 +32,20 @@
super(context);
}
- public <T> long show(String question, T[] options) throws IOException {
+ public <T> T show(String question, T[] options) throws IOException {
return show(question, Arrays.asList(options), null);
}
- public <T> long show(String question, T[] options, Labelizer<T> labelizer) throws IOException {
+ public <T> T show(String question, T[] options, Labelizer<T> labelizer) throws IOException {
return show(question, Arrays.asList(options));
}
@SuppressWarnings("unchecked")
- public <T> long show(String question, Collection<T> options) throws IOException {
- return show(question, Arrays.asList(options), null);
+ public <T> T show(String question, List<T> options) throws IOException {
+ return show(question, options, null);
}
- public <T> long show(String question, Collection<T> options, Labelizer<T> labelizer)
+ public <T> T show(String question, List<T> options, Labelizer<T> labelizer)
throws IOException {
checkNonNull("question", question);
checkNonEmpty("options", options);
@@ -60,6 +61,7 @@
}
NumberField choice = new NumberField(context);
- return choice.show("Choice : ", null, 1, options.size());
+ int index = choice.show("Choice : ", null, 1, options.size()).intValue() - 1;
+ return options.get(index);
}
}
Modified: trunk/distr/src/test/org/jnode/apps/jpartition/JPartitionTest.java
===================================================================
--- trunk/distr/src/test/org/jnode/apps/jpartition/JPartitionTest.java 2009-04-19 19:38:27 UTC (rev 5316)
+++ trunk/distr/src/test/org/jnode/apps/jpartition/JPartitionTest.java 2009-04-19 19:42:05 UTC (rev 5317)
@@ -33,6 +33,7 @@
import org.jnode.apps.jpartition.swingview.FileDeviceView;
import org.jnode.apps.jpartition.utils.device.AbstractIDEDevice;
import org.jnode.apps.jpartition.utils.device.DeviceUtils;
+import org.jnode.driver.bus.ide.IDEDevice;
import org.jnode.fs.jfat.command.JGrub;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -61,8 +62,10 @@
* @throws Throwable
*/
public static void main(String[] args) throws Throwable {
+
final ViewFactory vf = new ConsoleViewFactory(System.in, System.out, System.err);
final ErrorReporter errorReporter = vf.createErrorReporter();
+/*
final Thread t = new Thread() {
public void run() {
try {
@@ -73,12 +76,13 @@
}
};
t.start();
-
+*/
// DeviceUtils.createFakeDevice(new ErrorReporter());
- AbstractIDEDevice dev = DeviceUtils.createFileDevice();
+ IDEDevice dev = DeviceUtils.createFileDevice(errorReporter);
JGrub jgrub = new JGrub(new PrintWriter(new OutputStreamWriter(System.out)), dev);
- jgrub.install();
-
- JPartitionCommand.main(args);
+
+// jgrub.install();
+
+ new JPartitionCommand().doExecute(true, System.in, System.out, System.err, true, false);
}
}
Modified: trunk/distr/src/test/org/jnode/apps/jpartition/utils/device/DeviceUtils.java
===================================================================
--- trunk/distr/src/test/org/jnode/apps/jpartition/utils/device/DeviceUtils.java 2009-04-19 19:38:27 UTC (rev 5316)
+++ trunk/distr/src/test/org/jnode/apps/jpartition/utils/device/DeviceUtils.java 2009-04-19 19:42:05 UTC (rev 5317)
@@ -37,6 +37,7 @@
import org.jnode.driver.DeviceNotFoundException;
import org.jnode.driver.DriverException;
import org.jnode.driver.bus.ide.IDEDevice;
+import org.jnode.emu.naming.BasicNameSpace;
import org.jnode.emu.plugin.model.DummyConfigurationElement;
import org.jnode.emu.plugin.model.DummyExtension;
import org.jnode.emu.plugin.model.DummyExtensionPoint;
@@ -44,6 +45,8 @@
import org.jnode.fs.service.FileSystemService;
import org.jnode.fs.service.def.FileSystemPlugin;
import org.jnode.naming.InitialNaming;
+import org.jnode.naming.NameSpace;
+import org.jnode.test.fs.driver.stubs.StubDeviceManager;
import org.jnode.test.fs.filesystem.config.FSType;
import org.jnode.util.OsUtils;
@@ -55,18 +58,13 @@
private static boolean coreInitialized = false;
public static final void initJNodeCore() {
- if (!OsUtils.isJNode() && !coreInitialized) {
+ if (!coreInitialized && !OsUtils.isJNode()) {
try {
-// // ShellEmu.main(new String[0]);
-// NameSpace namespace = new BasicNameSpace();
-// InitialNaming.setNameSpace(namespace);
-//
-// InitialNaming.bind(DeviceManager.NAME, StubDeviceManager.INSTANCE);
-//
-// PluginDescriptor desc = new DummyPluginDescriptor(true);
-// FileSystemService fss = new FileSystemPlugin(desc);
-// namespace.bind(FileSystemService.class, fss);
+ // ShellEmu.main(new String[0]);
+ NameSpace namespace = new BasicNameSpace();
+ InitialNaming.setNameSpace(namespace);
+ InitialNaming.bind(DeviceManager.NAME, StubDeviceManager.INSTANCE);
// Build a plugin descriptor that is sufficient for the FileSystemPlugin to
// configure file system types for testing.
@@ -93,6 +91,36 @@
}
coreInitialized = true;
}
+
+
+// if (!coreInitialized && !OsUtils.isJNode()) {
+// // We are not running in JNode, emulate a JNode environment.
+//
+// InitialNaming.setNameSpace(new BasicNameSpace());
+//
+// // Build a plugin descriptor that is sufficient for the FileSystemPlugin to
+// // configure file system types for testing.
+// DummyPluginDescriptor desc = new DummyPluginDescriptor(true);
+// DummyExtensionPoint ep = new DummyExtensionPoint("types", "org.jnode.fs.types", "types");
+// desc.addExtensionPoint(ep);
+// for (FSType fsType : FSType.values()) {
+// DummyExtension extension = new DummyExtension();
+// DummyConfigurationElement element = new DummyConfigurationElement();
+// element.addAttribute("class", fsType.getFsTypeClass().getName());
+// extension.addElement(element);
+// ep.addExtension(extension);
+// }
+//
+// FileSystemService fss = new FileSystemPlugin(desc);
+// try {
+// InitialNaming.bind(FileSystemService.class, fss);
+// } catch (NameAlreadyBoundException e) {
+// throw new RuntimeException(e);
+// } catch (NamingException e) {
+// throw new RuntimeException(e);
+// }
+// coreInitialized = true;
+// }
}
public static IDEDevice createFakeDevice(ErrorReporter errorReporter) {
@@ -129,6 +157,23 @@
return device;
}
+ public static IDEDevice createFileDevice(ErrorReporter errorReporter) {
+ IDEDevice device = null;
+
+ try {
+ AbstractIDEDevice fd = createFileDevice();
+ if (addDevice(fd)) {
+ device = fd;
+ } else {
+ errorReporter.reportError(log, DeviceUtils.class.getName(), "failed to add device");
+ }
+ } catch (Exception e) {
+ log.error(e);
+ }
+
+ return device;
+ }
+
private static AbstractIDEDevice createVMWareDevice() throws Exception {
File tmpFile = File.createTempFile("disk", "");
File directory = tmpFile.getParentFile();
@@ -141,7 +186,7 @@
return dev;
}
- public static AbstractIDEDevice createFileDevice() throws Exception {
+ private static AbstractIDEDevice createFileDevice() throws Exception {
File tmpFile = File.createTempFile("disk", "");
File directory = tmpFile.getParentFile();
String name = tmpFile.getName();
Modified: trunk/fs/src/test/org/jnode/test/fs/driver/stubs/StubDeviceManager.java
===================================================================
--- trunk/fs/src/test/org/jnode/test/fs/driver/stubs/StubDeviceManager.java 2009-04-19 19:38:27 UTC (rev 5316)
+++ trunk/fs/src/test/org/jnode/test/fs/driver/stubs/StubDeviceManager.java 2009-04-19 19:42:05 UTC (rev 5317)
@@ -45,6 +45,7 @@
private List<DeviceToDriverMapper> mappers = new ArrayList<DeviceToDriverMapper>();
private StubDeviceManager() {
+ super("");
}
public void removeAll() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2009-04-20 15:21:13
|
Revision: 5325
http://jnode.svn.sourceforge.net/jnode/?rev=5325&view=rev
Author: crawley
Date: 2009-04-20 15:21:03 +0000 (Mon, 20 Apr 2009)
Log Message:
-----------
Once more ... with feeling.
Modified Paths:
--------------
trunk/distr/src/emu/org/jnode/emu/ShellEmu.java
trunk/shell/src/shell/org/jnode/shell/CommandShell.java
trunk/shell/src/test/org/jnode/test/shell/harness/TestRunnerBase.java
Modified: trunk/distr/src/emu/org/jnode/emu/ShellEmu.java
===================================================================
--- trunk/distr/src/emu/org/jnode/emu/ShellEmu.java 2009-04-20 14:53:47 UTC (rev 5324)
+++ trunk/distr/src/emu/org/jnode/emu/ShellEmu.java 2009-04-20 15:21:03 UTC (rev 5325)
@@ -24,11 +24,13 @@
import org.jnode.driver.console.ConsoleManager;
import org.jnode.driver.console.swing.SwingTextScreenConsoleManager;
+import org.jnode.driver.console.textscreen.TextScreenConsole;
import org.jnode.driver.console.textscreen.TextScreenConsoleManager;
import org.jnode.shell.CommandShell;
/**
* @author Levente S\u00e1ntha
+ * @author cr...@jn...
*/
public class ShellEmu extends Emu {
@@ -46,9 +48,9 @@
private void run() throws Exception {
TextScreenConsoleManager cm = new SwingTextScreenConsoleManager();
- new Thread(new CommandShell(cm.createConsole(
- "Console 1",
- (ConsoleManager.CreateOptions.TEXT |
- ConsoleManager.CreateOptions.SCROLLABLE)))).start();
+ TextScreenConsole console = cm.createConsole(
+ "Console 1",
+ (ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.SCROLLABLE));
+ new Thread(new CommandShell(console, true)).start();
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/CommandShell.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2009-04-20 14:53:47 UTC (rev 5324)
+++ trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2009-04-20 15:21:03 UTC (rev 5325)
@@ -104,6 +104,9 @@
public static final String DIRECTORY_PROPERTY_NAME = "user.dir";
public static final String INITIAL_INVOKER = "proclet";
+ // The Emu-mode invoker must be something that runs on the dev't platform;
+ // e.g. not 'isolate' or 'proclet'.
+ private static final String EMU_INVOKER = "thread";
public static final String INITIAL_INTERPRETER = "redirecting";
public static final String FALLBACK_INVOKER = "default";
public static final String FALLBACK_INTERPRETER = "default";
@@ -199,6 +202,10 @@
}
public CommandShell(TextConsole cons) throws ShellException {
+ this(cons, false);
+ }
+
+ public CommandShell(TextConsole cons, boolean emu) throws ShellException {
debugEnabled = true;
try {
console = cons;
@@ -216,7 +223,7 @@
console.addConsoleListener(this);
aliasMgr = ShellUtils.getAliasManager().createAliasManager();
syntaxMgr = ShellUtils.getSyntaxManager().createSyntaxManager();
- propertyMap = initShellProperties();
+ propertyMap = initShellProperties(emu);
} catch (NameNotFoundException ex) {
throw new ShellException("Cannot find required resource", ex);
} catch (Exception ex) {
@@ -225,11 +232,12 @@
}
/**
- * Create a CommandShell that doesn't use a TextConsole or the ConsoleManager.
+ * Create a CommandShell that doesn't use a TextConsole or the ConsoleManager
+ * for use in the TestHarness.
*
* @throws ShellException
*/
- public CommandShell() throws ShellException {
+ protected CommandShell() throws ShellException {
debugEnabled = true;
try {
setupStreams(new InputStreamReader(System.in),
@@ -237,7 +245,7 @@
new OutputStreamWriter(System.err));
aliasMgr = ShellUtils.getAliasManager().createAliasManager();
syntaxMgr = ShellUtils.getSyntaxManager().createSyntaxManager();
- propertyMap = initShellProperties();
+ propertyMap = initShellProperties(true);
} catch (NameNotFoundException ex) {
throw new ShellException("Cannot find required resource", ex);
} catch (Exception ex) {
@@ -245,12 +253,31 @@
}
}
- private HashMap<String, String> initShellProperties() {
+ /**
+ * This constructor builds a partial command shell for test purposes only.
+ *
+ * @param aliasMgr test framework supplies an alias manager
+ * @param syntaxMgr test framework supplies a syntax manager
+ */
+ protected CommandShell(AliasManager aliasMgr, SyntaxManager syntaxMgr) {
+ this.debugEnabled = true;
+ this.aliasMgr = aliasMgr;
+ this.syntaxMgr = syntaxMgr;
+ propertyMap = initShellProperties(true);
+ setupStreams(
+ new InputStreamReader(System.in),
+ new OutputStreamWriter(System.out),
+ new OutputStreamWriter(System.err));
+ this.readingCommand = true;
+ }
+
+
+ private HashMap<String, String> initShellProperties(boolean emu) {
HashMap<String, String> map = new HashMap<String, String>();
map.put(PROMPT_PROPERTY_NAME, DEFAULT_PROMPT);
map.put(DEBUG_PROPERTY_NAME, DEBUG_DEFAULT);
map.put(HISTORY_PROPERTY_NAME, HISTORY_DEFAULT);
- map.put(INVOKER_PROPERTY_NAME, INITIAL_INVOKER);
+ map.put(INVOKER_PROPERTY_NAME, emu ? EMU_INVOKER : INITIAL_INVOKER);
map.put(INTERPRETER_PROPERTY_NAME, INITIAL_INTERPRETER);
return map;
}
@@ -263,27 +290,8 @@
this.outPW = cout.getPrintWriter();
this.errPW = cerr.getPrintWriter();
}
-
/**
- * This constructor builds a partial command shell for test purposes only.
- *
- * @param aliasMgr test framework supplies an alias manager
- * @param syntaxMgr test framework supplies a syntax manager
- */
- protected CommandShell(AliasManager aliasMgr, SyntaxManager syntaxMgr) {
- this.debugEnabled = true;
- this.aliasMgr = aliasMgr;
- this.syntaxMgr = syntaxMgr;
- propertyMap = initShellProperties();
- setupStreams(
- new InputStreamReader(System.in),
- new OutputStreamWriter(System.out),
- new OutputStreamWriter(System.err));
- this.readingCommand = true;
- }
-
- /**
* Run this shell until exit.
*
* @see java.lang.Runnable#run()
@@ -499,11 +507,6 @@
ownThread = Thread.currentThread();
}
- public void configureEmuShell() throws ShellException {
- propertyMap.put(INVOKER_PROPERTY_NAME, "thread");
- configureShell();
- }
-
@Override
public String getProperty(String propName) {
return propertyMap.get(propName);
Modified: trunk/shell/src/test/org/jnode/test/shell/harness/TestRunnerBase.java
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/harness/TestRunnerBase.java 2009-04-20 14:53:47 UTC (rev 5324)
+++ trunk/shell/src/test/org/jnode/test/shell/harness/TestRunnerBase.java 2009-04-20 15:21:03 UTC (rev 5325)
@@ -92,7 +92,7 @@
public CommandShell getShell() throws ShellException {
CommandShell shell = new TestCommandShell(System.in, System.out, System.err);
- shell.configureEmuShell();
+ shell.configureShell();
return shell;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2009-04-22 19:10:12
|
Revision: 5336
http://jnode.svn.sourceforge.net/jnode/?rev=5336&view=rev
Author: lsantha
Date: 2009-04-22 19:10:02 +0000 (Wed, 22 Apr 2009)
Log Message:
-----------
Fixed regression in isolate startup.
Modified Paths:
--------------
trunk/all/conf/openjdk-annotations.properties
trunk/all/lib/classlib-src.jar.bz2
trunk/all/lib/classlib.pack.gz
trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
Modified: trunk/all/conf/openjdk-annotations.properties
===================================================================
--- trunk/all/conf/openjdk-annotations.properties 2009-04-22 18:45:00 UTC (rev 5335)
+++ trunk/all/conf/openjdk-annotations.properties 2009-04-22 19:10:02 UTC (rev 5336)
@@ -12,6 +12,7 @@
java/awt/Toolkit.class=SharedStatics
java/io/VMIOUtils.class=SharedStatics
java/lang/Thread.class=SharedStatics
+java/lang/Class.class=SharedStatics
java/lang/ThreadLocal.class=SharedStatics
java/lang/Throwable.class=MagicPermission
java/net/InetAddress.class=SharedStatics
@@ -35,3 +36,4 @@
sun/misc/SharedSecrets.class=SharedStatics
sun/misc/Unsafe.class=SharedStatics,MagicPermission
sun/misc/VM.class=SharedStatics
+sun/reflect/ReflectionFactory.class=SharedStatics
Modified: trunk/all/lib/classlib-src.jar.bz2
===================================================================
(Binary files differ)
Modified: trunk/all/lib/classlib.pack.gz
===================================================================
(Binary files differ)
Modified: trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2009-04-22 18:45:00 UTC (rev 5335)
+++ trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2009-04-22 19:10:02 UTC (rev 5336)
@@ -55,6 +55,7 @@
import org.jnode.vm.classmgr.VmIsolatedStatics;
import org.jnode.vm.classmgr.VmType;
import org.jnode.vm.scheduler.VmThread;
+import gnu.classpath.SystemProperties;
/**
* VM specific implementation of the Isolate class.
@@ -960,15 +961,10 @@
//executorThread = new Thread(new TaskExecutor(), "isolate-executor");
//executorThread.start();
- // Find main method
- final Method mainMethod = cls.getMethod("main",
- new Class[]{String[].class});
-// IsolatedStaticData.mainTypes);
-
//inherit properties
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
- Properties sys_porps = System.getProperties();
+ Properties sys_porps = SystemProperties.getProperties();
for (String prop : initProperties.stringPropertyNames()) {
sys_porps.setProperty(prop, initProperties.getProperty(prop));
}
@@ -976,6 +972,12 @@
}
});
+ // Find main method
+ final Method mainMethod = cls.getMethod("main",
+ new Class[]{String[].class});
+// IsolatedStaticData.mainTypes);
+
+
//create the appcontext for this isolate
// TODO - improve this
//appContext = Class.forName("sun.awt.SunToolkit").getMethod("createNewAppContext").invoke(null);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-04-24 06:11:45
|
Revision: 5342
http://jnode.svn.sourceforge.net/jnode/?rev=5342&view=rev
Author: chrisboertien
Date: 2009-04-24 06:11:36 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Awk implementation via Jawk
Added rm alias for DeleteCommand
Signed-off-by: chrisboertien <chr...@gm...>
Modified Paths:
--------------
trunk/all/build.xml
trunk/distr/build.xml
trunk/fs/descriptors/org.jnode.fs.command.xml
trunk/shell/descriptors/org.jnode.shell.xml
Added Paths:
-----------
trunk/distr/descriptors/org.jawk.xml
trunk/distr/lib/jawk-1.02.jar
trunk/distr/src/apps/org/jawk/
trunk/distr/src/apps/org/jawk/JawkCommand.java
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2009-04-23 20:29:23 UTC (rev 5341)
+++ trunk/all/build.xml 2009-04-24 06:11:36 UTC (rev 5342)
@@ -61,6 +61,7 @@
<property name="oncrpc.jar" value="${root.dir}/net/lib/oncrpc.jar"/>
<property name="telnetd.jar" value="${root.dir}/distr/lib/telnetd.jar" />
<property name="commons-logging.jar" value="${root.dir}/distr/lib/commons-logging.jar" />
+ <property name="jawk.jar" value="${root.dir}/distr/lib/jawk-1.02.jar"/>
<property name="jetty.jar" value="${root.dir}/distr/lib/jetty-6.1.5.jar" />
<property name="jetty-util.jar" value="${root.dir}/distr/lib/jetty-util-6.1.5.jar" />
<property name="jsp.jar" value="${root.dir}/distr/lib/jsp-2.1.jar" />
@@ -297,6 +298,7 @@
<libalias name="oncrpc.jar" alias="${oncrpc.jar}"/>
<libalias name="telnetd.jar" alias="${telnetd.jar}"/>
<libalias name="commons-logging.jar" alias="${commons-logging.jar}"/>
+ <libalias name="jawk.jar" alias="${jawk.jar}"/>
<libalias name="jetty.jar" alias="${jetty.jar}"/>
<libalias name="jetty-util.jar" alias="${jetty-util.jar}"/>
<libalias name="jsp.jar" alias="${jsp.jar}"/>
Modified: trunk/distr/build.xml
===================================================================
--- trunk/distr/build.xml 2009-04-23 20:29:23 UTC (rev 5341)
+++ trunk/distr/build.xml 2009-04-24 06:11:36 UTC (rev 5342)
@@ -20,6 +20,8 @@
<pathelement location="${jetty.jar}"/>
<pathelement location="${jetty-util.jar}"/>
+
+ <pathelement location="${jawk.jar}"/>
<path refid="cp"/>
</path>
Added: trunk/distr/descriptors/org.jawk.xml
===================================================================
--- trunk/distr/descriptors/org.jawk.xml (rev 0)
+++ trunk/distr/descriptors/org.jawk.xml 2009-04-24 06:11:36 UTC (rev 5342)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="org.jawk"
+ name="jawk"
+ version="1.02"
+ license-name="???"
+ provider-name="jawk.org"
+ provider-url="http://jawk.sourceforge.net">
+
+ <runtime>
+ <library name="jawk.jar">
+ <export name="*"/>
+ </library>
+ <library name="jnode-distr.jar">
+ <export name="org.jawk.*"/>
+ </library>
+ </runtime>
+
+ <requires>
+ <import plugin="org.jnode.shell"/>
+ <import plugin="org.jnode.shell.syntax"/>
+ </requires>
+
+ <extension point="org.jnode.shell.aliases">
+ <alias name="awk" class="org.jawk.JawkCommand"/>
+ </extension>
+
+ <extension point="org.jnode.shell.syntaxes">
+ <syntax alias="awk">
+ <sequence>
+ <optionSet>
+ <option argLabel="vars" shortName="v"/>
+ <option argLabel="field-sep" shortName="F"/>
+ <option argLabel="script" shortName="f"/>
+ <option argLabel="interm-out" shortName="c"/>
+ <option argLabel="interm-file" shortName="o"/>
+ <option argLabel="compile" shortName="z"/>
+ <option argLabel="compile-exec" shortName="Z"/>
+ <option argLabel="compile-dir" shortName="d"/>
+ <option argLabel="dump-interm" shortName="s"/>
+ <option argLabel="dump-ast" shortName="S"/>
+ <option argLabel="xfuncs" shortName="x"/>
+ <option argLabel="xtypes" shortName="y"/>
+ <option argLabel="sort-arrays" shortName="t"/>
+ <option argLabel="no-fmt-trap" shortName="r"/>
+ </optionSet>
+ <optional>
+ <argument argLabel="program"/>
+ </optional>
+ <repeat>
+ <alternatives>
+ <argument argLabel="files"/>
+ <argument argLabel="vars"/>
+ </alternatives>
+ </repeat>
+ </sequence>
+ </syntax>
+ </extension>
+
+ <extension point="org.jnode.security.permissions">
+ <permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
+ <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
+ <permission class="java.lang.RuntimePermission" name="modifyThread"/>
+ <permission class="java.lang.RuntimePermission" name="modifyThreadGroup"/>
+ <permission class="java.lang.RuntimePermission" name="createClassLoader"/>
+ <permission class="java.lang.RuntimePermission" name="getenv.*"/>
+ <permission class="java.lang.RuntimePermission" name="setContextClassLoader"/>
+ </extension>
+</plugin>
Added: trunk/distr/lib/jawk-1.02.jar
===================================================================
--- trunk/distr/lib/jawk-1.02.jar (rev 0)
+++ trunk/distr/lib/jawk-1.02.jar 2009-04-24 06:11:36 UTC (rev 5342)
@@ -0,0 +1,1665 @@
+PK |
|
From: <cr...@us...> - 2009-04-29 15:39:37
|
Revision: 5359
http://jnode.svn.sourceforge.net/jnode/?rev=5359&view=rev
Author: crawley
Date: 2009-04-29 15:39:29 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Procletize the System properties. This entails a classlib update ...
Modified Paths:
--------------
trunk/all/lib/classlib-src.jar.bz2
trunk/all/lib/classlib.pack.gz
trunk/core/src/core/org/jnode/vm/VmIOContext.java
trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java
Added Paths:
-----------
trunk/core/src/classpath/vm/gnu/classpath/NativeSystemProperties.java
Modified: trunk/all/lib/classlib-src.jar.bz2
===================================================================
(Binary files differ)
Modified: trunk/all/lib/classlib.pack.gz
===================================================================
(Binary files differ)
Added: trunk/core/src/classpath/vm/gnu/classpath/NativeSystemProperties.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/classpath/NativeSystemProperties.java (rev 0)
+++ trunk/core/src/classpath/vm/gnu/classpath/NativeSystemProperties.java 2009-04-29 15:39:29 UTC (rev 5359)
@@ -0,0 +1,25 @@
+package gnu.classpath;
+
+import java.util.Properties;
+
+import org.jnode.vm.VmSystem;
+
+/**
+ * @see gnu.classpath.SystemProperties
+ */
+class NativeSystemProperties {
+
+ /**
+ * @see gnu.classpath.SystemProperties#doGetProperties()
+ */
+ private static Properties doGetProperties() {
+ return VmSystem.getIOContext().getProperties();
+ }
+
+ /**
+ * @see gnu.classpath.SystemProperties#doSetProperties(java.util.Properties)
+ */
+ private static void doSetProperties(Properties props) {
+ VmSystem.getIOContext().setProperties(props);
+ }
+}
Modified: trunk/core/src/core/org/jnode/vm/VmIOContext.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmIOContext.java 2009-04-29 15:31:45 UTC (rev 5358)
+++ trunk/core/src/core/org/jnode/vm/VmIOContext.java 2009-04-29 15:39:29 UTC (rev 5359)
@@ -28,9 +28,10 @@
/**
* This is the implementation of the IOContext API that is be used when
* 'proclet' mode is not enabled. It also provides static methods for
- * getting and setting the 'global' versions of the Stream state, and
- * the System properties and environment. (The 'global' state is used
- * in 'proclet' mode when the current thread is not part of a 'proclet'.)
+ * getting and setting the 'global' versions of the Stream state,
+ * the System properties and the System environment. The 'global' state
+ * is used and (in the case of the properties and 'env' map, updated) in
+ * 'proclet' mode when the current thread is not part of a 'proclet'.
*
* @author Levente S\u00e1ntha
* @author cr...@jn...
Modified: trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java 2009-04-29 15:31:45 UTC (rev 5358)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java 2009-04-29 15:39:29 UTC (rev 5359)
@@ -20,8 +20,6 @@
package org.jnode.shell.proclet;
-import gnu.classpath.SystemProperties;
-
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
@@ -43,8 +41,6 @@
* limitations of the afore-mentioned class's specification ...
*/
private static PrintStream nullStream;
- private static final char[] line_separator = SystemProperties.getProperty(
- "line.separator", "\n").toCharArray();
private boolean error_occurred = false;
@@ -81,7 +77,7 @@
PrintStream eo = effectiveOutput();
writeChars(eo, str, 0, str.length());
if (println) {
- writeChars(eo, line_separator, 0, line_separator.length);
+ eo.println();
}
flush();
}
@@ -91,7 +87,7 @@
PrintStream eo = effectiveOutput();
writeChars(eo, chars, pos, len);
if (println) {
- writeChars(eo, line_separator, 0, line_separator.length);
+ eo.println();
}
flush();
}
@@ -145,7 +141,7 @@
}
public void println() {
- print(line_separator, 0, line_separator.length, false);
+ effectiveOutput().println();
}
public void println(boolean bool) {
Modified: trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java 2009-04-29 15:31:45 UTC (rev 5358)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java 2009-04-29 15:39:29 UTC (rev 5359)
@@ -32,7 +32,15 @@
/**
* The ProcletIOContext is an IOContext implementation that uses Proxy streams to
* direct System.in/out/err traffic to different places depending on the current
- * proclet.
+ * proclet. The System properties and 'env' are also 'procletized' in this
+ * implementation.
+ * <p>
+ * A JNode isolate is switched to 'proclet mode" by calling
+ * {@link VmSystem#switchToExternalIOContext(IOContext)}.
+ * In theory, calling {@link VmSystem#resetIOContext()} will return the isolate
+ * to "normal mode". However, doing this abruptly cause any remaining
+ * proclets' procletized state to abruptly revert to the isolate-global version
+ * of that state.
*
* @author Levente S\u00e1ntha
* @author cr...@jn...
@@ -75,19 +83,39 @@
}
public Map<String, String> getEnv() {
- return Proclet.currentProcletContext().getEnvironment();
+ Proclet proclet = Proclet.currentProcletContext();
+ if (proclet != null) {
+ return proclet.getEnvironment();
+ } else {
+ return VmIOContext.getGlobalEnv();
+ }
}
public Properties getProperties() {
- return Proclet.currentProcletContext().getProperties();
+ Proclet proclet = Proclet.currentProcletContext();
+ if (proclet != null) {
+ return proclet.getProperties();
+ } else {
+ return VmIOContext.getGlobalProperties();
+ }
}
public void setEnv(Map<String, String> env) {
- Proclet.currentProcletContext().setEnvironment(env);
+ Proclet proclet = Proclet.currentProcletContext();
+ if (proclet != null) {
+ proclet.setEnvironment(env);
+ } else {
+ VmIOContext.setGlobalEnv(env);
+ }
}
public void setProperties(Properties props) {
- Proclet.currentProcletContext().setProperties(props);
+ Proclet proclet = Proclet.currentProcletContext();
+ if (proclet != null) {
+ proclet.setProperties(props);
+ } else {
+ VmIOContext.setGlobalProperties(props);
+ }
}
private int getCurrentPid() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2009-04-29 19:58:10
|
Revision: 5360
http://jnode.svn.sourceforge.net/jnode/?rev=5360&view=rev
Author: lsantha
Date: 2009-04-29 19:58:08 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Improved handling of classlib classes in jnode trunk.
Modified Paths:
--------------
trunk/all/build-x86.xml
trunk/all/build.xml
trunk/all/conf/default-plugin-list.xml
trunk/all/conf/system-plugin-list.xml
trunk/builder/src/builder/org/jnode/build/AbstractAsmConstBuilder.java
trunk/core/build.xml
trunk/core/descriptors/com.sun.tools.javac.xml
trunk/core/descriptors/com.sun.tools.jdi.xml
trunk/core/descriptors/javax.ext.tools.xml
trunk/core/descriptors/org.classpath.core.xml
trunk/core/descriptors/org.classpath.ext.awt.xml
trunk/core/descriptors/org.classpath.ext.corba.xml
trunk/core/descriptors/org.classpath.ext.core.xml
trunk/core/descriptors/org.classpath.ext.imageio.xml
trunk/core/descriptors/org.classpath.ext.jdwp.xml
trunk/core/descriptors/org.classpath.ext.management.xml
trunk/core/descriptors/org.classpath.ext.print.xml
trunk/core/descriptors/org.classpath.ext.security.xml
trunk/core/descriptors/org.classpath.ext.sql.xml
trunk/core/descriptors/org.classpath.ext.xml
trunk/core/descriptors/org.classpath.ext.xml.ws.tools.xml
trunk/core/descriptors/org.classpath.ext.xml.ws.xml
trunk/core/descriptors/org.classpath.ext.xml.xml
trunk/core/descriptors/org.classpath.tools.xml
trunk/core/descriptors/org.jnode.vm.core.xml
trunk/core/descriptors/sun.tools.xml
trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java
trunk/core/src/test/org/jnode/test/core/IMTCompilerTest.java
Added Paths:
-----------
trunk/core/descriptors/org.classpath.core.vm.xml
trunk/core/descriptors/org.classpath.ext.core.vm.xml
Modified: trunk/all/build-x86.xml
===================================================================
--- trunk/all/build-x86.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/all/build-x86.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -130,7 +130,8 @@
<taskdef name="genconst" classname="org.jnode.build.x86.AsmConstBuilder" classpathref="cp-x86" />
<taskdef name="asm" classname="org.jnode.ant.taskdefs.Asm" classpathref="cp-x86" />
- <genconst destfile="${build.native.dir}/src/java.inc" bits="${jnode.bits}" classesURL="file:///${jnode-core.jar}/">
+ <genconst destfile="${build.native.dir}/src/java.inc" bits="${jnode.bits}"
+ classesURL="file:///${jnode-core.jar}/,jar:file://${classlib.jar}!/,file:///${root.dir}/builder/build/classes/">
<class classname="java.lang.Throwable" />
<class classname="org.jnode.build.x86.BootImageBuilder" static="on" />
<class classname="org.jnode.vm.SoftByteCodes" static="on" />
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/all/build.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -108,6 +108,7 @@
<property name="jnode-x86_64-lite.iso" value="${cdroms.dir}/jnode-x86_64-lite.iso"/>
<path id="cp">
+ <pathelement location="${classlib.jar}"/>
<pathelement location="${mmtk.jar}"/>
<pathelement location="${ant.jar}"/>
<pathelement location="${junit.jar}"/>
@@ -230,18 +231,6 @@
</then>
</if>
<property name="classlib.stamp" value="${root.dir}/all/build/classlib.stamp" />
- <if>
- <or>
- <not>
- <available file="${classlib.stamp}" />
- </not>
- <uptodate srcfile="${classlib.stamp}" targetfile="${classlib.jar}"/>
- </or>
- <then>
- <unjar src="${classlib.jar}" dest="${jnode-core.jar}"/>
- <touch file="${classlib.stamp}"/>
- </then>
- </if>
</target>
<!-- Call the assemble target of all subprojects -->
@@ -255,6 +244,96 @@
<target name="assemble-plugins" depends="assemble-projects,openjdk-annotate">
<!-- Now assemble all plugins -->
<taskdef name="plugin" classname="org.jnode.build.PluginTask" classpathref="cp-jnode"/>
+ <if>
+ <or>
+ <not>
+ <available file="${classlib.stamp}" />
+ </not>
+ <uptodate srcfile="${classlib.stamp}" targetfile="${classlib.jar}"/>
+ </or>
+ <then>
+ <!-- Now assemble all plugins -->
+ <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}"/>
+ <libalias name="jnode-gui.jar" alias="${jnode-gui.jar}"/>
+ <libalias name="jnode-textui.jar" alias="${jnode-textui.jar}"/>
+ <libalias name="jnode-net.jar" alias="${jnode-net.jar}"/>
+ <libalias name="jnode-shell.jar" alias="${jnode-shell.jar}"/>
+
+ <libalias name="jnode-mmtk-genrc.jar" alias="${jnode-mmtk-genrc.jar}"/>
+ <libalias name="jnode-mmtk-ms.jar" alias="${jnode-mmtk-ms.jar}"/>
+ <libalias name="jnode-mmtk-nogc.jar" alias="${jnode-mmtk-nogc.jar}"/>
+
+ <libalias name="mmtk.jar" alias="${mmtk.jar}"/>
+
+ <libalias name="commons-net-1.1.0.jar" alias="${commons-net.jar}"/>
+ <libalias name="dnsjava-1.6.6.jar" alias="${dnsjava.jar}"/>
+ <libalias name="jsch-0.1.24.jar" alias="${jsch.jar}"/>
+ <libalias name="log4j.jar" alias="${log4j.jar}"/>
+ <libalias name="beanshell.jar" alias="${beanshell.jar}"/>
+ <libalias name="nanoxml-java.jar" alias="${nanoxml-java.jar}"/>
+ <libalias name="js.jar" alias="${js.jar}"/>
+ <libalias name="thinlet.jar" alias="${thinlet.jar}"/>
+
+ <libalias name="junit.jar" alias="${junit.jar}"/>
+ <libalias name="jmock-1.0.1.jar" alias="${jmock.jar}"/>
+ <libalias name="jmock-cglib-1.0.1.jar" alias="${jmock-cglib.jar}"/>
+ <libalias name="asm.jar" alias="${asm.jar}"/>
+ <libalias name="asm-attrs.jar" alias="${asm-attrs.jar}"/>
+ <libalias name="asm-util.jar" alias="${asm-util.jar}"/>
+ <libalias name="cglib.jar" alias="${cglib.jar}"/>
+ <libalias name="mauve.jar" alias="${mauve.jar}"/>
+
+ <libalias name="ant.jar" alias="${ant.jar}"/>
+ <libalias name="ant-launcher.jar" alias="${ant-launcher.jar}"/>
+ <libalias name="edtftpj.jar" alias="${edtftpj.jar}"/>
+ <libalias name="jcifs.jar" alias="${jcifs.jar}"/>
+ <libalias name="ejc.jar" alias="${ejc.jar}"/>
+ <libalias name="oncrpc.jar" alias="${oncrpc.jar}"/>
+ <libalias name="telnetd.jar" alias="${telnetd.jar}"/>
+ <libalias name="commons-logging.jar" alias="${commons-logging.jar}"/>
+ <libalias name="jawk.jar" alias="${jawk.jar}"/>
+ <libalias name="jetty.jar" alias="${jetty.jar}"/>
+ <libalias name="jetty-util.jar" alias="${jetty-util.jar}"/>
+ <libalias name="jsp.jar" alias="${jsp.jar}"/>
+ <libalias name="jsp-api.jar" alias="${jsp-api.jar}"/>
+ <libalias name="servlet.jar" alias="${servlet.jar}"/>
+ <libalias name="derby.jar" alias="${derby.jar}"/>
+ <libalias name="derbynet.jar" alias="${derbynet.jar}"/>
+ <libalias name="derbytools.jar" alias="${derbytools.jar}"/>
+ <libalias name="classlib.jar" alias="${classlib.jar}"/>
+
+ <descriptors dir="${descriptors.dir}/">
+ <include name="org.classpath.core.xml"/>
+ <include name="org.classpath.ext.awt.xml"/>
+ <include name="org.classpath.ext.corba.xml"/>
+ <include name="org.classpath.ext.core.xml"/>
+ <include name="org.classpath.ext.imageio.xml"/>
+ <include name="org.classpath.ext.jdwp.xml"/>
+ <include name="org.classpath.ext.management.xml"/>
+ <include name="org.classpath.ext.print.xml"/>
+ <include name="org.classpath.ext.security.xml"/>
+ <include name="org.classpath.ext.sql.xml"/>
+ <include name="org.classpath.ext.xml"/>
+ <include name="org.classpath.ext.xml.ws.tools.xml"/>
+ <include name="org.classpath.ext.xml.ws.xml"/>
+ <include name="org.classpath.ext.xml.xml"/>
+ <include name="org.classpath.tools.xml"/>
+ <include name="com.sun.tools.javac.xml"/>
+ <include name="com.sun.tools.jdi.xml"/>
+ <include name="javax.ext.tools.xml"/>
+ <include name="sun.tools.xml"/>
+ </descriptors>
+ </plugin>
+
+ <touch file="${classlib.stamp}"/>
+ </then>
+ </if>
+
<plugin todir="${plugins.dir}" tmpdir="${build.dir}/tmp/plugins" pluginDir="${descriptors.dir}">
<packager userApplicationsDir="${user.applications.dir}" pathRefId="cp"/>
@@ -311,6 +390,26 @@
<descriptors dir="${descriptors.dir}/">
<include name="*.xml"/>
<exclude name="*plugin-list.xml"/>
+ <exclude name="com.sun.tools.javac.xml"/>
+ <exclude name="com.sun.tools.jdi.xml"/>
+ <exclude name="javax.ext.tools.xml"/>
+ <exclude name="sun.tools.xml"/>
+ <exclude name="org.classpath.core.xml"/>
+ <exclude name="org.classpath.core.xml"/>
+ <exclude name="org.classpath.ext.awt.xml"/>
+ <exclude name="org.classpath.ext.corba.xml"/>
+ <exclude name="org.classpath.ext.core.xml"/>
+ <exclude name="org.classpath.ext.imageio.xml"/>
+ <exclude name="org.classpath.ext.jdwp.xml"/>
+ <exclude name="org.classpath.ext.management.xml"/>
+ <exclude name="org.classpath.ext.print.xml"/>
+ <exclude name="org.classpath.ext.security.xml"/>
+ <exclude name="org.classpath.ext.sql.xml"/>
+ <exclude name="org.classpath.ext.xml"/>
+ <exclude name="org.classpath.ext.xml.ws.tools.xml"/>
+ <exclude name="org.classpath.ext.xml.ws.xml"/>
+ <exclude name="org.classpath.ext.xml.xml"/>
+ <exclude name="org.classpath.tools.xml"/>
</descriptors>
</plugin>
</target>
Modified: trunk/all/conf/default-plugin-list.xml
===================================================================
--- trunk/all/conf/default-plugin-list.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/all/conf/default-plugin-list.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -10,6 +10,7 @@
<attribute key="Main-Class-Arg" value="boot"/>
</manifest>
+ <plugin id="org.classpath.ext.core.vm"/>
<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 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/all/conf/system-plugin-list.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -9,6 +9,7 @@
<plugin id="org.apache.jakarta.log4j"/>
<plugin id="nanoxml"/>
<plugin id="rt"/>
+ <plugin id="rt.vm"/>
<plugin id="org.jnode.runtime"/>
<plugin id="org.jnode.runtime.core"/>
Modified: trunk/builder/src/builder/org/jnode/build/AbstractAsmConstBuilder.java
===================================================================
--- trunk/builder/src/builder/org/jnode/build/AbstractAsmConstBuilder.java 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/builder/src/builder/org/jnode/build/AbstractAsmConstBuilder.java 2009-04-29 19:58:08 UTC (rev 5360)
@@ -46,7 +46,7 @@
public abstract class AbstractAsmConstBuilder {
private File destFile;
- private URL classesURL;
+ private String classesURL;
private ArrayList<ClassName> classes = new ArrayList<ClassName>();
/**
@@ -76,8 +76,12 @@
throws BuildException, ClassNotFoundException, IllegalAccessException, IOException, InstantiationException {
final VmArchitecture arch = getArchitecture();
- final int slotSize = arch.getReferenceSize();
- final VmSystemClassLoader cl = new VmSystemClassLoader(classesURL, arch);
+ String[] urls = classesURL.split(",");
+ URL[] urla = new URL[urls.length];
+ for (int i = 0; i < urls.length; i++)
+ urla[i] = new URL(urls[i].trim());
+
+ final VmSystemClassLoader cl = new VmSystemClassLoader(urla, arch);
final Vm vm = new Vm("?", arch, cl.getSharedStatics(), false, cl, null);
vm.toString(); // Just to avoid compiler warnings
VmType.initializeForBootImage(cl);
@@ -90,8 +94,8 @@
out.println();
for (ClassName cn : classes) {
- final URL classUrl = cn.getURL(classesURL);
- lastModified = Math.max(lastModified, classUrl.openConnection().getLastModified());
+ lastModified = Math.max(lastModified, cl.findResource(cn.getClassFileName()).
+ openConnection().getLastModified());
out.println("; Constants for " + cn.getClassName());
if (cn.isStatic()) {
@@ -221,6 +225,10 @@
public URL getURL(URL root) throws MalformedURLException {
return new URL(root.toExternalForm() + "/" + className.replace('.', '/') + ".class");
}
+
+ public String getClassFileName() {
+ return "/" + className.replace('.', '/') + ".class";
+ }
}
/**
@@ -228,7 +236,7 @@
*
* @return URL
*/
- public URL getClassesURL() {
+ public String getClassesURL() {
return classesURL;
}
@@ -237,7 +245,7 @@
*
* @param classesURL The classesURL to set
*/
- public void setClassesURL(URL classesURL) {
+ public void setClassesURL(String classesURL) {
this.classesURL = classesURL;
}
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/build.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -95,6 +95,7 @@
<jnode.compile destdir="${my-classes-plan.dir}/@{package}/">
<src path="${my-gen-plan.dir}/@{package}/"/>
<classpath>
+ <pathelement location="${classlib.jar}"/>
<pathelement location="${jnode-code.jar}"/>
<pathelement location="${mmtk.jar}"/>
</classpath>
Modified: trunk/core/descriptors/com.sun.tools.javac.xml
===================================================================
--- trunk/core/descriptors/com.sun.tools.javac.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/com.sun.tools.javac.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -13,7 +13,7 @@
<import plugin="javax.ext.tools"/>
</requires>
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="com.sun.mirror.apt.*"/>
<export name="com.sun.mirror.declaration.*"/>
<export name="com.sun.mirror.type.*"/>
Modified: trunk/core/descriptors/com.sun.tools.jdi.xml
===================================================================
--- trunk/core/descriptors/com.sun.tools.jdi.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/com.sun.tools.jdi.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -10,7 +10,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="com.sun.jdi.*"/>
<export name="com.sun.jdi.connect.*"/>
<export name="com.sun.jdi.connect.spi.*"/>
Modified: trunk/core/descriptors/javax.ext.tools.xml
===================================================================
--- trunk/core/descriptors/javax.ext.tools.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/javax.ext.tools.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -15,7 +15,7 @@
</requires>
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="javax.annotation.processing.*"/>
<export name="javax.lang.model.*"/>
<export name="javax.lang.model.element.*"/>
Copied: trunk/core/descriptors/org.classpath.core.vm.xml (from rev 5355, trunk/core/descriptors/org.classpath.ext.awt.xml)
===================================================================
--- trunk/core/descriptors/org.classpath.core.vm.xml (rev 0)
+++ trunk/core/descriptors/org.classpath.core.vm.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="rt.vm"
+ name="Classpath AWT classes"
+ version="@VERSION@"
+ system="true"
+ plugin-version="@VERSION@"
+ provider-name="Classpath"
+ provider-url="http://classpath.org"
+ license-name="classpath">
+
+ <runtime>
+ <library name="jnode-core.jar">
+ <export name="gnu.classpath.*"/>
+ <export name="gnu.classpath.jdwp.*"/>
+ <export name="gnu.classpath.jdwp.transport.*"/>
+ <export name="gnu.java.security.action.*"/>
+ <export name="gnu.java.security.util.*"/>
+ <export name="java.io.*"/>
+ <export name="java.lang.*"/>
+ <export name="java.lang.ref.*"/>
+ <export name="java.lang.reflect.*"/>
+ <export name="java.net.*"/>
+ <export name="java.nio.*"/>
+ <export name="java.nio.channels.*"/>
+ <export name="java.security.*"/>
+ <export name="java.sql.*"/>
+ <export name="java.util.*"/>
+ <export name="java.util.concurrent.atomic.*"/>
+ <export name="java.util.jar.*"/>
+ <export name="java.util.logging.*"/>
+ <export name="java.util.prefs.*"/>
+ <export name="javax.imageio.spi.*"/>
+ <export name="sun.reflect.*"/>
+ <export name="sun.misc.*"/>
+ <export name="sun.security.provider.*"/>
+
+ <export name="javax.isolate.*"/>
+ </library>
+ </runtime>
+</plugin>
Modified: trunk/core/descriptors/org.classpath.core.xml
===================================================================
--- trunk/core/descriptors/org.classpath.core.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.core.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -10,7 +10,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="com.sun.beans.*"/>
<export name="com.sun.beans.finder.*"/>
<export name="com.sun.java.util.jar.pack.*"/>
@@ -121,8 +121,6 @@
<export name="java.util.concurrent.atomic.*"/>
<export name="java.util.concurrent.locks.*"/>
- <export name="javax.isolate.*"/>
-
<export name="javax.naming.*"/>
<export name="javax.naming.spi.*"/>
@@ -160,6 +158,7 @@
<export name="org.xml.sax.*"/>
<export name="org.jnode.java.io.*"/>
+ <export name="org.jnode.annotation.*"/>
<export name="org.w3c.dom.*"/>
<export name="org.w3c.dom.bootstrap.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.awt.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.awt.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.awt.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="gnu.java.awt.peer.headless.*"/>
<export name="gnu.java.awt.peer.swing.*"/>
<export name="gnu.java.awt.font.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.corba.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.corba.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.corba.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="javax.rmi.CORBA.*"/>
<export name="org.omg.CORBA.*"/>
Added: trunk/core/descriptors/org.classpath.ext.core.vm.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.core.vm.xml (rev 0)
+++ trunk/core/descriptors/org.classpath.ext.core.vm.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<fragment id="org.classpath.ext.core.vm"
+ name="Classpath AWT classes"
+ version="@VERSION@"
+ plugin-id="rt"
+ plugin-version="@VERSION@"
+ provider-name="Classpath"
+ provider-url="http://classpath.org"
+ license-name="classpath">
+
+ <runtime>
+ <library name="jnode-core.jar">
+ <export name="java.awt.*"/>
+ <export name="java.awt.event.*"/>
+ <export name="java.awt.image.*"/>
+ <export name="sun.awt.*"/>
+ <export name="sun.awt.image.*"/>
+ <export name="sun.font.*"/>
+ <export name="sun.java2d.*"/>
+ <export name="sun.java2d.loops.*"/>
+ <export name="sun.java2d.pipe.*"/>
+ <export name="sun.rmi.server.*"/>
+ <export name="org.jnode.imageio.jpeg.*"/>
+ </library>
+ </runtime>
+</fragment>
Modified: trunk/core/descriptors/org.classpath.ext.core.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.core.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.core.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="com.sun.media.sound.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.imageio.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.imageio.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.imageio.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="com.sun.imageio.stream.*"/>
<export name="com.sun.imageio.spi.*"/>
@@ -34,8 +34,6 @@
<export name="gnu.javax.imageio.gif.*"/>
<export name="gnu.javax.imageio.jpeg.*"/>
<export name="gnu.javax.imageio.png.*"/>
-
- <export name="org.jnode.imageio.jpeg.*"/>
</library>
</runtime>
Modified: trunk/core/descriptors/org.classpath.ext.jdwp.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.jdwp.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.jdwp.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="gnu.classpath.jdwp.*"/>
<export name="gnu.classpath.jdwp.event.*"/>
<export name="gnu.classpath.jdwp.event.filters.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.management.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.management.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.management.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="com.sun.management.*"/>
<export name="com.sun.jmx.defaults.*"/>
<export name="com.sun.jmx.interceptor.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.print.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.print.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.print.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="javax.print.*"/>
<export name="javax.print.attribute.*"/>
<export name="javax.print.attribute.standard.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.security.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.security.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.security.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="sun.security.tools.*"/>
<export name="sun.security.timestamp.*"/>
<export name="sun.security.acl.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.sql.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.sql.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.sql.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="java.sql.*"/>
<export name="javax.sql.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="javax.security.*"/>
<export name="javax.security.auth.spi.*"/>
<export name="javax.security.auth.kerberos.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.xml.ws.tools.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.xml.ws.tools.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.xml.ws.tools.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="com.sun.codemodel.internal.*"/>
<export name="com.sun.codemodel.internal.fmt.*"/>
<export name="com.sun.codemodel.internal.util.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.xml.ws.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.xml.ws.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.xml.ws.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="com.sun.activation.registries.*"/>
<export name="com.sun.istack.internal.*"/>
<export name="com.sun.istack.internal.tools.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.xml.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.xml.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.ext.xml.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="com.sun.org.apache.bcel.internal.*"/>
<export name="com.sun.org.apache.bcel.internal.classfile.*"/>
<export name="com.sun.org.apache.bcel.internal.generic.*"/>
Modified: trunk/core/descriptors/org.classpath.tools.xml
===================================================================
--- trunk/core/descriptors/org.classpath.tools.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.classpath.tools.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -11,7 +11,7 @@
license-name="classpath">
<runtime>
- <library name="jnode-core.jar">
+ <library name="classlib.jar">
<export name="gnu.classpath.tools.*"/>
<export name="gnu.classpath.tools.common.*"/>
<export name="gnu.classpath.tools.getopt.*"/>
Modified: trunk/core/descriptors/org.jnode.vm.core.xml
===================================================================
--- trunk/core/descriptors/org.jnode.vm.core.xml 2009-04-29 15:39:29 UTC (rev 5359)
+++ trunk/core/descriptors/org.jnode.vm.core.xml 2009-04-29 19:58:08 UTC (rev 5360)
@@ -20,7 +20,6 @@
<export name="org.vmmagic.unboxed.*"/>
<export name="org.jnode.assembler.*"/>
<export name="org.jnode.vm.*"/>
- <export name="org.jnode.annotation.*"/>
<export name="org.jnode.vm.bytecode.*"/>
<export name="org.jnode.vm.classmgr.*"/>
<export name="org.jnode.vm.compiler.*"/>
...
[truncated message content] |
|
From: <chr...@us...> - 2009-04-29 21:55:54
|
Revision: 5361
http://jnode.svn.sourceforge.net/jnode/?rev=5361&view=rev
Author: chrisboertien
Date: 2009-04-29 21:55:50 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Refactored commands from fs project to cli project
This is the first in a series of commits that aims to pull commands
out of the various subprojects and into a common projects.
This update brings most of the commands from the fs project into
org.jnode.command.file and the fs/archive commands into org.jnode.command.archive
Signed-off-by: chrisboertien <chr...@gm...>
Modified Paths:
--------------
trunk/all/build.xml
trunk/all/conf/default-plugin-list.xml
trunk/all/conf/shell-plugin-list.xml
trunk/all/lib/jnode.xml
trunk/fs/descriptors/org.jnode.fs.command.xml
trunk/fs/descriptors/org.jnode.fs.ext2.command.xml
Added Paths:
-----------
trunk/cli/
trunk/cli/build.xml
trunk/cli/descriptors/
trunk/cli/descriptors/org.apache.tools.archive.xml
trunk/cli/descriptors/org.jnode.command.archive.xml
trunk/cli/descriptors/org.jnode.command.file.xml
trunk/cli/descriptors/org.jnode.command.util.xml
trunk/cli/src/
trunk/cli/src/commands/
trunk/cli/src/commands/org/
trunk/cli/src/commands/org/jnode/
trunk/cli/src/commands/org/jnode/command/
trunk/cli/src/commands/org/jnode/command/archive/
trunk/cli/src/commands/org/jnode/command/archive/ArchiveCommand.java
trunk/cli/src/commands/org/jnode/command/archive/BUnzipCommand.java
trunk/cli/src/commands/org/jnode/command/archive/BZCatCommand.java
trunk/cli/src/commands/org/jnode/command/archive/BZip.java
trunk/cli/src/commands/org/jnode/command/archive/BZipCommand.java
trunk/cli/src/commands/org/jnode/command/archive/GUnzipCommand.java
trunk/cli/src/commands/org/jnode/command/archive/GZip.java
trunk/cli/src/commands/org/jnode/command/archive/GZipCommand.java
trunk/cli/src/commands/org/jnode/command/archive/TarCommand.java
trunk/cli/src/commands/org/jnode/command/archive/UnzipCommand.java
trunk/cli/src/commands/org/jnode/command/archive/ZCatCommand.java
trunk/cli/src/commands/org/jnode/command/archive/Zip.java
trunk/cli/src/commands/org/jnode/command/archive/ZipCommand.java
trunk/cli/src/commands/org/jnode/command/file/
trunk/cli/src/commands/org/jnode/command/file/CdCommand.java
trunk/cli/src/commands/org/jnode/command/file/CpCommand.java
trunk/cli/src/commands/org/jnode/command/file/DFCommand.java
trunk/cli/src/commands/org/jnode/command/file/DeleteCommand.java
trunk/cli/src/commands/org/jnode/command/file/DirCommand.java
trunk/cli/src/commands/org/jnode/command/file/FindCommand.java
trunk/cli/src/commands/org/jnode/command/file/HexdumpCommand.java
trunk/cli/src/commands/org/jnode/command/file/Md5SumCommand.java
trunk/cli/src/commands/org/jnode/command/file/MkdirCommand.java
trunk/cli/src/commands/org/jnode/command/file/PwdCommand.java
trunk/cli/src/commands/org/jnode/command/file/TouchCommand.java
trunk/cli/src/commands/org/jnode/command/util/
trunk/cli/src/commands/org/jnode/command/util/AbstractDirectoryWalker.java
Removed Paths:
-------------
trunk/fs/descriptors/org.apache.tools.archive.xml
trunk/fs/descriptors/org.jnode.fs.command.archive.xml
trunk/fs/src/fs/org/jnode/fs/command/AbstractDirectoryWalker.java
trunk/fs/src/fs/org/jnode/fs/command/CdCommand.java
trunk/fs/src/fs/org/jnode/fs/command/CpCommand.java
trunk/fs/src/fs/org/jnode/fs/command/DFCommand.java
trunk/fs/src/fs/org/jnode/fs/command/DeleteCommand.java
trunk/fs/src/fs/org/jnode/fs/command/DirCommand.java
trunk/fs/src/fs/org/jnode/fs/command/FindCommand.java
trunk/fs/src/fs/org/jnode/fs/command/HexdumpCommand.java
trunk/fs/src/fs/org/jnode/fs/command/Md5SumCommand.java
trunk/fs/src/fs/org/jnode/fs/command/MkdirCommand.java
trunk/fs/src/fs/org/jnode/fs/command/PwdCommand.java
trunk/fs/src/fs/org/jnode/fs/command/TouchCommand.java
trunk/fs/src/fs/org/jnode/fs/command/archive/ArchiveCommand.java
trunk/fs/src/fs/org/jnode/fs/command/archive/BUnzipCommand.java
trunk/fs/src/fs/org/jnode/fs/command/archive/BZCatCommand.java
trunk/fs/src/fs/org/jnode/fs/command/archive/BZip.java
trunk/fs/src/fs/org/jnode/fs/command/archive/BZipCommand.java
trunk/fs/src/fs/org/jnode/fs/command/archive/GUnzipCommand.java
trunk/fs/src/fs/org/jnode/fs/command/archive/GZip.java
trunk/fs/src/fs/org/jnode/fs/command/archive/GZipCommand.java
trunk/fs/src/fs/org/jnode/fs/command/archive/TarCommand.java
trunk/fs/src/fs/org/jnode/fs/command/archive/UnzipCommand.java
trunk/fs/src/fs/org/jnode/fs/command/archive/ZCatCommand.java
trunk/fs/src/fs/org/jnode/fs/command/archive/Zip.java
trunk/fs/src/fs/org/jnode/fs/command/archive/ZipCommand.java
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2009-04-29 19:58:08 UTC (rev 5360)
+++ trunk/all/build.xml 2009-04-29 21:55:50 UTC (rev 5361)
@@ -38,6 +38,7 @@
<property name="jnode-textui.jar" value="${root.dir}/textui/build/classes"/>
<property name="jnode-net.jar" value="${root.dir}/net/build/classes"/>
<property name="jnode-shell.jar" value="${root.dir}/shell/build/classes"/>
+ <property name="jnode-coreutils.jar" value="${root.dir}/coreutils/build/classes"/>
<property name="jnode-fonts.jar" value="${build.dir}/descriptors/jnode-fonts.jar"/>
<property name="jnode-images.jar" value="${build.dir}/descriptors/jnode-images.jar"/>
@@ -143,6 +144,7 @@
<pathelement location="${jnode-shell.jar}"/>
<pathelement location="${jnode-net.jar}"/>
<pathelement location="${jnode-gui.jar}"/>
+ <pathelement location="${jnode-coreutils.jar}"/>
<pathelement location="${thinlet.jar}"/>
<pathelement location="${jnode-textui.jar}"/>
<pathelement location="${bcel-5.1.jar}"/>
@@ -344,6 +346,7 @@
<libalias name="jnode-textui.jar" alias="${jnode-textui.jar}"/>
<libalias name="jnode-net.jar" alias="${jnode-net.jar}"/>
<libalias name="jnode-shell.jar" alias="${jnode-shell.jar}"/>
+ <libalias name="jnode-coreutils.jar" alias="${jnode-coreutils.jar}"/>
<libalias name="jnode-mmtk-genrc.jar" alias="${jnode-mmtk-genrc.jar}"/>
<libalias name="jnode-mmtk-ms.jar" alias="${jnode-mmtk-ms.jar}"/>
Modified: trunk/all/conf/default-plugin-list.xml
===================================================================
--- trunk/all/conf/default-plugin-list.xml 2009-04-29 19:58:08 UTC (rev 5360)
+++ trunk/all/conf/default-plugin-list.xml 2009-04-29 21:55:50 UTC (rev 5361)
@@ -31,7 +31,6 @@
<plugin id="org.classpath.ext.security"/>
<plugin id="org.classpath.tools"/>
- <plugin id="org.apache.tools.archive" />
<plugin id="org.apache.jakarta.commons.net"/>
<plugin id="org.xbill.dns"/>
@@ -49,6 +48,12 @@
<plugin id="org.jnode.awt.font"/>
<plugin id="org.jnode.awt.font.truetype"/>
<plugin id="org.jnode.awt.swingpeers"/>
+
+ <plugin id="org.apache.tools.archive" />
+ <plugin id="org.jnode.command.archive"/>
+ <plugin id="org.jnode.command.file"/>
+ <plugin id="org.jnode.command.util"/>
+
<plugin id="org.jnode.debug"/>
<plugin id="org.jnode.debugger"/>
@@ -116,7 +121,6 @@
<plugin id="org.jnode.driver.video.vesa"/>
<plugin id="org.jnode.fs.command"/>
- <plugin id="org.jnode.fs.command.archive" />
<plugin id="org.jnode.fs.ext2"/>
<plugin id="org.jnode.fs.ext2.command"/>
<plugin id="org.jnode.fs.hfsplus"/>
Modified: trunk/all/conf/shell-plugin-list.xml
===================================================================
--- trunk/all/conf/shell-plugin-list.xml 2009-04-29 19:58:08 UTC (rev 5360)
+++ trunk/all/conf/shell-plugin-list.xml 2009-04-29 21:55:50 UTC (rev 5361)
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin-list name="shell">
<manifest>
- <attribute key="Main-Class" value="org.jnode.shell.CommandShell"/>
+ <attribute key="Main-Class" value="org.jnode.shell.CommandShell"/>
+ <attribute key="Main-Class-Arg" value="boot"/>
</manifest>
<plugin id="org.jnode.driver"/>
Modified: trunk/all/lib/jnode.xml
===================================================================
--- trunk/all/lib/jnode.xml 2009-04-29 19:58:08 UTC (rev 5360)
+++ trunk/all/lib/jnode.xml 2009-04-29 21:55:50 UTC (rev 5361)
@@ -70,6 +70,7 @@
<ant target="@{target}" dir="${root.dir}/gui" inheritall="on" inheritrefs="on" />
<ant target="@{target}" dir="${root.dir}/textui" inheritall="on" inheritrefs="on" />
<ant target="@{target}" dir="${root.dir}/distr" inheritall="on" inheritrefs="on" />
+ <ant target="@{target}" dir="${root.dir}/coreutils" inheritall="on" inheritrefs="on" />
</sequential>
</macrodef>
Added: trunk/cli/build.xml
===================================================================
--- trunk/cli/build.xml (rev 0)
+++ trunk/cli/build.xml 2009-04-29 21:55:50 UTC (rev 5361)
@@ -0,0 +1,42 @@
+<project name="JNode-CoreUtils" default="all" basedir=".">
+
+ <typedef file="${basedir}/../all/lib/jnode.xml"/>
+
+ <property name="my-build.dir" value="${basedir}/build"/>
+ <property name="my-classes.dir" value="${my-build.dir}/classes"/>
+ <property name="my-src.dir" value="${basedir}/src"/>
+ <property name="my.jar" value="${jnode-coreutils.jar}"/>
+ <property name="my-report.dir" value="${my-build.dir}/report"/>
+
+<!-- Subproject specific classpath -->
+ <path id="my-cp">
+ <pathelement location="${jnode-core.jar}"/>
+ <pathelement location="${jnode-fs.jar}"/>
+ <pathelement location="${jnode-shell.jar}"/>
+ <pathelement location="${jnode-net.jar}"/>
+ <pathelement location="${jnode-gui.jar}"/>
+ <path refid="cp"/>
+ </path>
+
+<!-- Initialize subproject directories -->
+ <target name="prepare">
+ <mkdir dir="${my-classes.dir}"/>
+ <jnode.copy-descriptors/>
+ </target>
+
+<!-- Compile subproject -->
+ <target name="compile" depends="prepare">
+ <jnode.compile>
+ <src path="${my-src.dir}/commands"/>
+ <classpath refid="my-cp"/>
+ </jnode.compile>
+ </target>
+
+ <target name="assemble" depends="compile"/>
+
+ <target name="all" depends="assemble"/>
+
+ <target name="clean">
+ <jnode.clean/>
+ </target>
+</project>
Copied: trunk/cli/descriptors/org.apache.tools.archive.xml (from rev 5360, trunk/fs/descriptors/org.apache.tools.archive.xml)
===================================================================
--- trunk/cli/descriptors/org.apache.tools.archive.xml (rev 0)
+++ trunk/cli/descriptors/org.apache.tools.archive.xml 2009-04-29 21:55:50 UTC (rev 5361)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="org.apache.tools.archive"
+ name="Ant archive tools"
+ version="1.7.1"
+ provider-name="Apache Ant"
+ provider-url="http://ant.apache.org"
+ license-name="apache2.0">
+
+ <runtime>
+ <library name="ant.jar">
+ <export name="org.apache.tools.tar.*" />
+ <export name="org.apache.tools.zip.*" />
+ <export name="org.apache.tools.bzip2.*" />
+ </library>
+ </runtime>
+
+ <extension point="org.jnode.security.permissions">
+ <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
+ <permission class="java.lang.RuntimePermission" name="readFileDescriptor"/>
+ <permission class="java.lang.RuntimePermission" name="writeFileDescriptor"/>
+ <permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
+ </extension>
+</plugin>
Copied: trunk/cli/descriptors/org.jnode.command.archive.xml (from rev 5360, trunk/fs/descriptors/org.jnode.fs.command.archive.xml)
===================================================================
--- trunk/cli/descriptors/org.jnode.command.archive.xml (rev 0)
+++ trunk/cli/descriptors/org.jnode.command.archive.xml 2009-04-29 21:55:50 UTC (rev 5361)
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="org.jnode.command.archive"
+ name="JNode archive commands"
+ version="@VERSION@"
+ provider-name="@PROVIDER@"
+ license-name="lgpl">
+
+ <requires>
+ <import plugin="org.apache.tools.archive" />
+ <import plugin="org.jnode.shell.syntax" />
+ <import plugin="org.jnode.command.util" />
+ </requires>
+
+ <runtime>
+ <library name="jnode-coreutils.jar">
+ <export name="org.jnode.command.archive.*" />
+ </library>
+ </runtime>
+
+ <extension point="org.jnode.shell.aliases">
+ <alias name="bzip2" class="org.jnode.command.archive.BZipCommand" />
+ <alias name="bunzip2" class="org.jnode.command.archive.BUnzipCommand" />
+ <alias name="bzcat" class="org.jnode.command.archive.BZCatCommand" />
+ <alias name="gzip" class="org.jnode.command.archive.GZipCommand" />
+ <alias name="gunzip" class="org.jnode.command.archive.GUnzipCommand" />
+ <alias name="tar" class="org.jnode.command.archive.TarCommand" />
+ <alias name="unzip" class="org.jnode.command.archive.UnzipCommand" />
+ <alias name="zcat" class="org.jnode.command.archive.ZCatCommand" />
+ <alias name="zip" class="org.jnode.command.archive.ZipCommand" />
+ </extension>
+
+ <extension point="org.jnode.shell.syntaxes">
+ <syntax alias="bunzip2">
+ <empty description="decompress stdin to stdout" />
+ <sequence description="decompress files">
+ <optionSet>
+ <!-- BZip -->
+ <option argLabel="compress" shortName="z" longName="compress"/>
+ <option argLabel="decompress" shortName="d" longName="decompress"/>
+ <option argLabel="test" shortName="t" longName="test" />
+ <option argLabel="keep" shortName="k" longName="keep" />
+ <option argLabel="small" shortName="s" longName="small" />
+ <!-- ArchiveCommand -->
+ <option argLabel="stdout" shortName="c" longName="stdout" />
+ <option argLabel="force" shortName="f" longName="force" />
+ <option argLabel="verbose" shortName="v" longName="verbose" />
+ <option argLabel="quiet" shortName="q" longName="quiet" />
+ <option argLabel="debug" longName="debug" />
+ </optionSet>
+ <repeat>
+ <argument argLabel="files" />
+ </repeat>
+ </sequence>
+ </syntax>
+ <syntax alias="bzcat">
+ <empty description="decompress stdin to stdout" />
+ <sequence description="decompress files to stdout">
+ <optionSet>
+ <option argLabel="small" shortName="s" longName="small" />
+ </optionSet>
+ <repeat>
+ <argument argLabel="files" />
+ </repeat>
+ </sequence>
+ </syntax>
+ <syntax alias="bzip2">
+ <empty description="compress stdin to stdout" />
+ <sequence description="compress files">
+ <optionSet>
+ <!-- BZipCommand -->
+ <option argLabel="c1" shortName="1" longName="fast" />
+ <option argLabel="c2" shortName="2" />
+ <option argLabel="c3" shortName="3" />
+ <option argLabel="c4" shortName="4" />
+ <option argLabel="c5" shortName="5" />
+ <option argLabel="c6" shortName="6" />
+ <option argLabel="c7" shortName="7" />
+ <option argLabel="c8" shortName="8" />
+ <option argLabel="c9" shortName="9" longName="best" />
+ <!-- BZip -->
+ <option argLabel="decompress" shortName="d" longName="decompress" />
+ <option argLabel="compress" shortName="z" longName="compress" />
+ <option argLabel="test" shortName="t" longName="test" />
+ <option argLabel="keep" shortName="k" longName="keep" />
+ <option argLabel="small" shortName="s" longName="small" />
+ <!-- ArchiveCommand -->
+ <option argLabel="stdout" shortName="c" longName="stdout" />
+ <option argLabel="force" shortName="f" longName="force" />
+ <option argLabel="verbose" shortName="v" longName="verbose" />
+ <option argLabel="quiet" shortName="q" longName="quiet" />
+ <option argLabel="debug" longName="debug" />
+ </optionSet>
+ <repeat>
+ <argument argLabel="files" />
+ </repeat>
+ </sequence>
+ </syntax>
+ <syntax alias="gunzip">
+ <empty description="decompress standard input to standard output" />
+ <sequence description="decompress files">
+ <optionSet>
+ <!-- GZip -->
+ <option argLabel="test" shortName="t" longName="test" />
+ <option argLabel="list" shortName="l" longName="list" />
+ <option argLabel="recurse" shortName="r" longName="recursive" />
+ <option argLabel="noname" shortName="n" longName="no-name" />
+ <option argLabel="name" shortName="N" longName="name" />
+ <!-- ArchiveCommand -->
+ <option argLabel="stdout" shortName="c" longName="stdout" />
+ <option argLabel="force" shortName="f" longName="force" />
+ <option argLabel="quiet" shortName="q" longName="quiet" />
+ <option argLabel="verbose" shortName="v" longName="verbose" />
+ <option argLabel="debug" longName="debug" />
+ </optionSet>
+ <optional eager="true">
+ <option argLabel="suffix" shortName="S" longName="suffix" />
+ </optional>
+ <repeat minCount="1">
+ <argument argLabel="files" />
+ </repeat>
+ </sequence>
+ </syntax>
+ <syntax alias="gzip">
+ <empty description="compress standard input to standard output" />
+ <sequence description="compress files">
+ <optionSet>
+ <!-- GZipCommand -->
+ <option argLabel="c1" shortName="1" longName="fast" />
+ <option argLabel="c9" shortName="9" longName="best" />
+ <option argLabel="decompress" shortName="d" longName="decompress" />
+ <!-- GZip -->
+ <option argLabel="test" shortName="t" longName="test" />
+ <option argLabel="list" shortName="l" longName="list" />
+ <option argLabel="recurse" shortName="r" longName="recursive" />
+ <option argLabel="noname" shortName="n" longName="no-name" />
+ <option argLabel="name" shortName="N" longName="name" />
+ <!-- ArchiveCommand -->
+ <option argLabel="stdout" shortName="c" longName="stdout" />
+ <option argLabel="force" shortName="f" longName="force" />
+ <option argLabel="quiet" shortName="q" longName="quiet" />
+ <option argLabel="verbose" shortName="v" longName="verbose" />
+ <option argLabel="debug" longName="debug" />
+ </optionSet>
+ <optional eager="true">
+ <option argLabel="suffix" shortName="S" longName="suffix" />
+ </optional>
+ <repeat minCount="1">
+ <argument argLabel="files" />
+ </repeat>
+ </sequence>
+ </syntax>
+ <syntax alias="tar">
+ <sequence>
+ <optionSet description="tar options">
+ <!-- Tar Operations -->
+ <option argLabel="doAppend" shortName="r" longName="append" />
+ <option argLabel="doCreate" shortName="c" longName="create" />
+ <option argLabel="doConcat" shortName="A" longName="concatenate" />
+ <option argLabel="doDiff" shortName="d" longName="diff" />
+ <option argLabel="doExtract" shortName="x" longName="extract" />
+ <option argLabel="doList" shortName="t" longName="list" />
+ <option argLabel="doUpdate" shortName="u" longName="update" />
+ <option argLabel="doDelete" longName="delete" />
+ <!-- Tar Global Options -->
+ <option argLabel="archive" shortName="f" longName="file" />
+ <option argLabel="bzip" shortName="j" longName="bzip2" />
+ <option argLabel="fileList" shortName="T" longName="files-from"/>
+ <option argLabel="gzip" shortName="z" longName="gzip" />
+ <option argLabel="interact" shortName="w" longName="interactive" />
+ <option argLabel="keep_old" shortName="k" longName="keep-old-files" />
+ <option argLabel="verify" shortName="W" longName="verify" />
+ <option argLabel="xfile" shortName="X" longName="exclude-from"/>
+ <option argLabel="backup" longName="backup" />
+ <option argLabel="keep_new" longName="keep-newer-files" />
+ <option argLabel="removeFiles" longName="remove-files" />
+ <option argLabel="showTotals" longName="totals" />
+ <option argLabel="suffix" longName="suffix" />
+ <option argLabel="unlink" longName="unlink" />
+ <!-- Tar Path Parser Options -->
+ <option argLabel="dir" shortName="C" longName="directory" />
+ <option argLabel="exclude" longName="exclude" label="pattern" />
+ <option argLabel="noRecurse" longName="no-recursion" />
+ <option argLabel="recurse" longName="recursion" />
+ <!-- ArchiveCommand -->
+ <option argLabel="verbose" shortName="v" longName="verbose" />
+ <option argLabel="stdout" shortName="O" longName="to-stdout" />
+ <option argLabel="debug" longName="debug" />
+ <!--
+ <option argLabel="minDate" shortName="N" longName="newer" />
+ <option argLabel="minMTime" longName="newer-mtime" />
+ -->
+ </optionSet>
+ <repeat>
+ <argument argLabel="paths"/>
+ </repeat>
+ </sequence>
+ </syntax>
+ <syntax alias="unzip">
+ <sequence>
+ <optionSet>
+ <!-- UnzipCommand -->
+ <option argLabel="backup" shortName="B"/>
+ <option argLabel="ignore-case" shortName="C"/>
+ <option argLabel="keep" shortName="n"/>
+ <option argLabel="overwrite" shortName="o"/>
+ <!-- Zip -->
+ <option argLabel="no-path" shortName="j"/>
+ <!-- Zip Operations -->
+ <option argLabel="freshen" shortName="f"/>
+ <option argLabel="list" shortName="l"/>
+ <option argLabel="test" shortName="t"/>
+ <option argLabel="update" shortName="u"/>
+ <!-- ArchiveCommand -->
+ <option argLabel="stdout" shortName="p"/>
+ <option argLabel="verbose" shortName="v"/>
+ <option argLabel="quiet" shortName="q"/>
+ <option argLabel="debug" longName="debug"/>
+ </optionSet>
+ <argument argLabel="archive"/>
+ <repeat>
+ <argument argLabel="patterns"/>
+ </repeat>
+ <!-- TODO
+ <repeat>
+ <option argLabel="exclude" shortName="x"/>
+ </repeat>
+ <optional>
+ <option argLabel="extract-dir" shortName="d"/>
+ </optional>
+ -->
+ </sequence>
+ </syntax>
+ <syntax alias="zcat">
+ <empty description="decompress standard input to standard output" />
+ <repeat minCount="1">
+ <argument argLabel="files" />
+ </repeat>
+ </syntax>
+ <syntax alias="zip">
+ <sequence>
+ <optionSet>
+ <!-- ZipCommand -->
+ <option argLabel="files-stdin" shortName="@"/>
+ <option argLabel="tmp-dir" shortName="b"/>
+ <option argLabel="no-dirs" shortName="D"/>
+ <option argLabel="no-compress" shortName="n"/>
+ <option argLabel="recurse" shortName="r"/>
+ <!--<option argLabel="recurse-cd" shortName="R"/>-->
+ <option argLabel="newer" shortName="t"/>
+ <option argLabel="older" longName="tt"/>
+ <!-- Zip -->
+ <option argLabel="no-path" shortName="j"/>
+ <!-- Zip Operations -->
+ <option argLabel="delete" shortName="d"/>
+ <option argLabel="freshen" shortName="f"/>
+ <option argLabel="move" shortName="m"/>
+ <option argLabel="update" shortName="u"/>
+ <!-- ArchiveCommand -->
+ <option argLabel="quiet" shortName="q"/>
+ <option argLabel="verbose" shortName="v"/>
+ <option argLabel="debug" longName="debug"/>
+ </optionSet>
+ <argument argLabel="archive"/>
+ <repeat>
+ <alternatives>
+ <option argLabel="exclude" shortName="x"/>
+ <option argLabel="include" shortName="i"/>
+ <argument argLabel="patterns"/>
+ </alternatives>
+ </repeat>
+ </sequence>
+ </syntax>
+ </extension>
+
+ <extension point="org.jnode.security.permissions">
+ <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write,delete"/>
+ <permission class="java.util.PropertyPermission" name="user.dir" actions="read,write"/>
+ <permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
+ <permission class="java.lang.RuntimePermission" name="modifyThreadGroup"/>
+ <permission class="java.lang.RuntimePermission" name="exitVM"/>
+ <permission class="org.jnode.security.JNodePermission" name="getVmClass"/>
+ </extension>
+</plugin>
Added: trunk/cli/descriptors/org.jnode.command.file.xml
===================================================================
--- trunk/cli/descriptors/org.jnode.command.file.xml (rev 0)
+++ trunk/cli/descriptors/org.jnode.command.file.xml 2009-04-29 21:55:50 UTC (rev 5361)
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="org.jnode.command.file"
+ name="JNode file commands"
+ version="@VERSION@"
+ provider-name="@PROVIDER@"
+ license-name="lgpl">
+
+ <requires>
+ <import plugin="org.jnode.shell.syntax"/>
+ <import plugin="org.jnode.command.util"/>
+ </requires>
+
+ <runtime>
+ <library name="jnode-coreutils.jar">
+ <export name="org.jnode.command.file.*"/>
+ </library>
+ </runtime>
+
+ <extension point="org.jnode.shell.aliases">
+ <alias name="cd" class="org.jnode.command.file.CdCommand" internal="yes"/>
+ <alias name="cp" class="org.jnode.command.file.CpCommand"/>
+ <alias name="del" class="org.jnode.command.file.DeleteCommand"/>
+ <alias name="df" class="org.jnode.command.file.DFCommand"/>
+ <alias name="dir" class="org.jnode.command.file.DirCommand"/>
+ <alias name="find" class="org.jnode.command.file.FindCommand"/>
+ <alias name="hexdump" class="org.jnode.command.file.HexdumpCommand"/>
+ <alias name="ls" class="org.jnode.command.file.DirCommand"/>
+ <alias name="md5sum" class="org.jnode.command.file.Md5SumCommand"/>
+ <alias name="mkdir" class="org.jnode.command.file.MkdirCommand"/>
+ <alias name="pwd" class="org.jnode.command.file.PwdCommand"/>
+ <alias name="rm" class="org.jnode.command.file.DeleteCommand"/>
+ <alias name="touch" class="org.jnode.command.file.TouchCommand"/>
+ </extension>
+
+ <extension point="org.jnode.shell.syntaxes">
+ <syntax alias="cd">
+ <empty description="change the current directory to the 'user.home' directory"/>
+ <argument argLabel="directory" description="change the current directory to 'directory'"/>
+ </syntax>
+ <syntax alias="cp">
+ <sequence description="copy files or directories">
+ <optionSet>
+ <option argLabel="force" shortName="f" longName="force"/>
+ <option argLabel="update" shortName="u" longName="update"/>
+ <option argLabel="interactive" shortName="i" longName="interactive"/>
+ <option argLabel="recursive" shortName="r" longName="recursive"/>
+ <option argLabel="verbose" shortName="v" longName="verbose"/>
+ </optionSet>
+ <repeat minCount="1">
+ <argument argLabel="source"/>
+ </repeat>
+ <argument argLabel="target"/>
+ </sequence>
+ </syntax>
+ <syntax alias="del">
+ <sequence description="delete files and directories">
+ <optionSet>
+ <option argLabel="recursive" shortName="r" longName="recursive"/>
+ <option argLabel="force" shortName="f" longName="force" />
+ <option argLabel="interactive" shortName="i" longName="interactive" />
+ <option argLabel="verbose" shortName="v" longName="verbose" />
+ </optionSet>
+ <repeat minCount="1">
+ <argument argLabel="paths"/>
+ </repeat>
+ </sequence>
+ </syntax>
+ <syntax alias="df">
+ <empty description="display disk usage for all filesystems"/>
+ <argument argLabel="device" description="display disk usage for the filesystem on a device"/>
+ </syntax>
+ <syntax alias="dir">
+ <empty description="list the current directory"/>
+ <argument argLabel="path" description="list a file or directory"/>
+ </syntax>
+ <syntax alias="find">
+ <sequence description="find files or directories">
+ <repeat minCount="0">
+ <argument argLabel="directory" description="directory to start searching from"/>
+ </repeat>
+ <optionSet>
+ <option argLabel="type" shortName="t" longName="type"/>
+ <option argLabel="maxdepth" shortName="D" longName="maxdepth"/>
+ <option argLabel="mindepth" shortName="d" longName="mindepth"/>
+ <option argLabel="name" shortName="n" longName="name"/>
+ <option argLabel="iname" shortName="N" longName="iname"/>
+ </optionSet>
+ </sequence>
+ </syntax>
+ <syntax alias="hexdump">
+ <empty description="print a hex dump of standard input"/>
+ <argument argLabel="file" description="print a hex dump of a file"/>
+ <option argLabel="url" shortName="u" longName="url" description="print a hex dump of a URL"/>
+ </syntax>
+ <syntax alias="ls">
+ <empty descrip...
[truncated message content] |
|
From: <chr...@us...> - 2009-04-29 21:56:58
|
Revision: 5362
http://jnode.svn.sourceforge.net/jnode/?rev=5362&view=rev
Author: chrisboertien
Date: 2009-04-29 21:56:54 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Refactor of org.jnode.net.command to org.jnode.command.net
Signed-off-by: chrisboertien <chr...@gm...>
Modified Paths:
--------------
trunk/all/conf/default-plugin-list.xml
Added Paths:
-----------
trunk/cli/coreutils/
trunk/cli/coreutils/descriptors/
trunk/cli/coreutils/descriptors/org.jnode.command.net.xml
trunk/cli/coreutils/src/
trunk/cli/coreutils/src/commands/
trunk/cli/coreutils/src/commands/org/
trunk/cli/coreutils/src/commands/org/jnode/
trunk/cli/coreutils/src/commands/org/jnode/command/
trunk/cli/coreutils/src/commands/org/jnode/command/net/
trunk/cli/coreutils/src/commands/org/jnode/command/net/ArpCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/BootpCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/DhcpCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/IfconfigCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/NetstatCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/PingCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/ResolverCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/RouteCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/RpcInfoCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/TcpInoutCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/TftpCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/WLanCtlCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/WgetCommand.java
Removed Paths:
-------------
trunk/net/descriptors/org.jnode.net.command.xml
trunk/net/src/net/org/jnode/net/command/ArpCommand.java
trunk/net/src/net/org/jnode/net/command/BootpCommand.java
trunk/net/src/net/org/jnode/net/command/DhcpCommand.java
trunk/net/src/net/org/jnode/net/command/IfconfigCommand.java
trunk/net/src/net/org/jnode/net/command/NetstatCommand.java
trunk/net/src/net/org/jnode/net/command/PingCommand.java
trunk/net/src/net/org/jnode/net/command/ResolverCommand.java
trunk/net/src/net/org/jnode/net/command/RouteCommand.java
trunk/net/src/net/org/jnode/net/command/RpcInfoCommand.java
trunk/net/src/net/org/jnode/net/command/TcpInoutCommand.java
trunk/net/src/net/org/jnode/net/command/TftpCommand.java
trunk/net/src/net/org/jnode/net/command/WLanCtlCommand.java
trunk/net/src/net/org/jnode/net/command/WgetCommand.java
Modified: trunk/all/conf/default-plugin-list.xml
===================================================================
--- trunk/all/conf/default-plugin-list.xml 2009-04-29 21:55:50 UTC (rev 5361)
+++ trunk/all/conf/default-plugin-list.xml 2009-04-29 21:56:54 UTC (rev 5362)
@@ -52,6 +52,7 @@
<plugin id="org.apache.tools.archive" />
<plugin id="org.jnode.command.archive"/>
<plugin id="org.jnode.command.file"/>
+ <plugin id="org.jnode.command.net"/>
<plugin id="org.jnode.command.util"/>
<plugin id="org.jnode.debug"/>
@@ -152,7 +153,6 @@
<plugin id="org.jnode.net"/>
<plugin id="org.jnode.net.arp"/>
- <plugin id="org.jnode.net.command"/>
<plugin id="org.jnode.net.ipv4"/>
<plugin id="org.jnode.net.ipv4.config"/>
<plugin id="org.jnode.net.ipv4.core"/>
Copied: trunk/cli/coreutils/descriptors/org.jnode.command.net.xml (from rev 5361, trunk/net/descriptors/org.jnode.net.command.xml)
===================================================================
--- trunk/cli/coreutils/descriptors/org.jnode.command.net.xml (rev 0)
+++ trunk/cli/coreutils/descriptors/org.jnode.command.net.xml 2009-04-29 21:56:54 UTC (rev 5362)
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="org.jnode.command.net"
+ name="JNode net commands"
+ version="@VERSION@"
+ provider-name="@PROVIDER@"
+ license-name="lgpl">
+
+ <requires>
+ <import plugin="org.jnode.net"/>
+ <import plugin="org.jnode.net.arp"/>
+ <import plugin="org.jnode.net.ipv4"/>
+ <import plugin="org.jnode.net.ipv4.config"/>
+ <import plugin="org.jnode.shell.help"/>
+ <import plugin="org.acplt.oncrpc"/>
+ </requires>
+
+ <runtime>
+ <library name="jnode-net.jar">
+ <export name="org.jnode.net.syntax.*"/>
+ </library>
+ <library name="jnode-coreutils.jar">
+ <export name="org.jnode.command.net.*"/>
+ </library>
+ </runtime>
+
+ <extension point="org.jnode.shell.aliases">
+ <alias name="arp" class="org.jnode.command.net.ArpCommand"/>
+ <alias name="bootp" class="org.jnode.command.net.BootpCommand"/>
+ <alias name="dhcp" class="org.jnode.command.net.DhcpCommand"/>
+ <alias name="ifconfig" class="org.jnode.command.net.IfconfigCommand"/>
+ <alias name="netstat" class="org.jnode.command.net.NetstatCommand"/>
+ <alias name="ping" class="org.jnode.command.net.PingCommand"/>
+ <alias name="route" class="org.jnode.command.net.RouteCommand"/>
+ <alias name="resolver" class="org.jnode.command.net.ResolverCommand"/>
+ <alias name="resolve" class="org.jnode.command.net.ResolveCommand"/>
+ <alias name="tftp" class="org.jnode.command.net.TftpCommand"/>
+ <alias name="wlanctl" class="org.jnode.command.net.WLanCtlCommand"/>
+ <alias name="tcpinout" class="org.jnode.command.net.TcpInoutCommand"/>
+ <alias name="rpcinfo" class="org.jnode.command.net.RpcInfoCommand"/>
+ <alias name="wget" class="org.jnode.command.net.WgetCommand"/>
+ </extension>
+
+ <extension point="org.jnode.shell.syntaxes">
+ <syntax alias="arp">
+ <empty description="List the ARP cache"/>
+ <option argLabel="clear" shortName="c" longName="clear" description="Clear the ARP cache"/>
+ </syntax>
+ <syntax alias="bootp">
+ <argument argLabel="device" description="Configure a network interface using BOOTP"/>
+ </syntax>
+ <syntax alias="dhcp">
+ <argument argLabel="device" description="Configure a network interface using DHCP"/>
+ </syntax>
+ <syntax alias="ifconfig">
+ <empty description="Print network addresses for all network devices"/>
+ <argument argLabel="device" description="Print network addresses for a given device"/>
+ <sequence description="Bind a given device to an IPv4 address">
+ <argument argLabel="device"/>
+ <argument argLabel="ipAddress"/>
+ <optional><argument argLabel="subnetMask"/></optional>
+ </sequence>
+ </syntax>
+ <syntax alias="netstat">
+ <empty description="Print statistics for all network devices"/>
+ </syntax>
+ <syntax alias="ping">
+ <argument argLabel="host" description="Ping a remote host"/>
+ </syntax>
+ <syntax alias="resolver">
+ <empty description="List the DNS servers used by the resolver's list"/>
+ <sequence description="Add a DNS server to the resolver">
+ <option argLabel="add" shortName="a" longName="add"/>
+ <argument argLabel="server"/>
+ </sequence>
+ <sequence description="Remove a DNS server from the resolver's list">
+ <option argLabel="del" shortName="d" longName="del"/>
+ <argument argLabel="server"/>
+ </sequence>
+ </syntax>
+ <syntax alias="route">
+ <empty description="Print the routing table"/>
+ <sequence description="Add or remove a route">
+ <alternatives>
+ <option argLabel="add" shortName="a" longName="add"/>
+ <option argLabel="del" shortName="d" longName="del"/>
+ </alternatives>
+ <argument argLabel="target"/>
+ <argument argLabel="device"/>
+ <optional><argument argLabel="gateway"/></optional>
+ </sequence>
+ </syntax>
+ <syntax alias="rpcinfo">
+ <argument argLabel="host" description="Probe a remote host's portmapper service"/>
+ </syntax>
+ <syntax alias="tcpinout">
+ <argument argLabel="localPort" description="Run tcpinout in server mode"/>
+ <sequence description="Run tcpinout in client mode">
+ <argument argLabel="host"/>
+ <argument argLabel="port"/>
+ </sequence>
+ </syntax>
+ <syntax alias="tftp">
+ <optional description="Run an interactive TFTP client"><argument argLabel="host"/></optional>
+ <sequence description="Do a non-interactive TFTP 'get' or 'put'">
+ <alternatives>
+ <option argLabel="get" longName="get"/>
+ <option argLabel="put" longName="put"/>
+ </alternatives>
+ <argument argLabel="host"/>
+ <argument argLabel="filename"/>
+ </sequence>
+ </syntax>
+ <syntax alias="wlanctl">
+ <sequence description="Set the ESSID for a WLan device">
+ <option argLabel="setEssid" longName="setessid"/>
+ <argument argLabel="device"/>
+ <argument argLabel="value"/>
+ </sequence>
+ </syntax>
+ <syntax alias="wget">
+ <sequence description="Fetch the contents of one or more URLs">
+ <optional><option argLabel="debug" shortName="d" longName="debug"/></optional>
+ <repeat minCount="1"><argument argLabel="url"/></repeat>
+ </sequence>
+ </syntax>
+ </extension>
+
+ <extension point="org.jnode.security.permissions">
+ <permission class="java.net.SocketPermission" name="*" actions="connect,resolve"/>
+ <permission class="java.net.SocketPermission" name="*:1024-" actions="listen,accept"/>
+ <permission class="java.net.SocketPermission" name="*:53" actions="resolve,listen,connect"/>
+ <permission class="java.net.SocketPermission" name="*:80" actions="resolve,listen,connect"/>
+ <permission class="java.net.SocketPermission" name="*:8080" actions="resolve,listen,connect"/>
+ <permission class="java.util.PropertyPermission" name="dns.server" actions="read"/>
+ <permission class="java.util.PropertyPermission" name="dns.search" actions="read"/>
+ <permission class="java.util.PropertyPermission" name="user.dir" actions="read"/>
+ <permission class="org.jnode.net.NetPermission" name="bootpClient"/>
+ <permission class="org.jnode.net.NetPermission" name="dhcpClient"/>
+ <permission class="org.jnode.net.NetPermission" name="wget"/>
+ <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
+ </extension>
+</plugin>
Copied: trunk/cli/coreutils/src/commands/org/jnode/command/net/ArpCommand.java (from rev 5361, trunk/net/src/net/org/jnode/net/command/ArpCommand.java)
===================================================================
--- trunk/cli/coreutils/src/commands/org/jnode/command/net/ArpCommand.java (rev 0)
+++ trunk/cli/coreutils/src/commands/org/jnode/command/net/ArpCommand.java 2009-04-29 21:56:54 UTC (rev 5362)
@@ -0,0 +1,72 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.command.net;
+
+import java.io.PrintWriter;
+
+import org.jnode.driver.net.NetworkException;
+import org.jnode.net.NoSuchProtocolException;
+import org.jnode.net.arp.ARPCacheEntry;
+import org.jnode.net.arp.ARPNetworkLayer;
+import org.jnode.net.ethernet.EthernetConstants;
+import org.jnode.net.util.NetUtils;
+import org.jnode.shell.AbstractCommand;
+import org.jnode.shell.syntax.Argument;
+import org.jnode.shell.syntax.FlagArgument;
+
+/**
+ * @author epr
+ */
+public class ArpCommand extends AbstractCommand {
+
+ private static final String help_clear = "if set, clear the ARP cache";
+ private static final String help_super = "print or clear the ARP cache";
+ private static final String str_cleared = "Cleared the ARP cache";
+
+ private final FlagArgument argClear;
+
+ public ArpCommand() {
+ super(help_super);
+ argClear = new FlagArgument("clear", Argument.OPTIONAL, help_super);
+ registerArguments(argClear);
+ }
+
+ /**
+ * Execute this command
+ */
+ public static void main(String[] args) throws Exception {
+ new ArpCommand().execute(args);
+ }
+
+ public void execute() throws NoSuchProtocolException, NetworkException {
+ ARPNetworkLayer arp = (ARPNetworkLayer)
+ NetUtils.getNLM().getNetworkLayer(EthernetConstants.ETH_P_ARP);
+ PrintWriter out = getOutput().getPrintWriter();
+ if (argClear.isSet()) {
+ arp.getCache().clear();
+ out.println(str_cleared);
+ } else {
+ for (ARPCacheEntry entry : arp.getCache().entries()) {
+ out.println(entry);
+ }
+ }
+ }
+}
Copied: trunk/cli/coreutils/src/commands/org/jnode/command/net/BootpCommand.java (from rev 5361, trunk/net/src/net/org/jnode/net/command/BootpCommand.java)
===================================================================
--- trunk/cli/coreutils/src/commands/org/jnode/command/net/BootpCommand.java (rev 0)
+++ trunk/cli/coreutils/src/commands/org/jnode/command/net/BootpCommand.java 2009-04-29 21:56:54 UTC (rev 5362)
@@ -0,0 +1,62 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.command.net;
+
+import javax.naming.NameNotFoundException;
+
+import org.jnode.driver.Device;
+import org.jnode.driver.net.NetDeviceAPI;
+import org.jnode.driver.net.NetworkException;
+import org.jnode.naming.InitialNaming;
+import org.jnode.net.ipv4.config.IPv4ConfigurationService;
+import org.jnode.shell.AbstractCommand;
+import org.jnode.shell.syntax.Argument;
+import org.jnode.shell.syntax.DeviceArgument;
+
+/**
+ * @author epr
+ */
+public class BootpCommand extends AbstractCommand {
+
+ private static final String help_device = "";
+ private static final String help_super = "Configure a network interface using BOOTP";
+ private static final String fmt_config = "Trying to configure %s...%n";
+
+ private final DeviceArgument argDevice;
+
+ public BootpCommand() {
+ super(help_super);
+ argDevice = new DeviceArgument("device", Argument.MANDATORY, help_device, NetDeviceAPI.class);
+ registerArguments(argDevice);
+ }
+
+ public static void main(String[] args) throws Exception {
+ new BootpCommand().execute(args);
+ }
+
+ public void execute() throws NameNotFoundException, NetworkException {
+ final Device dev = argDevice.getValue();
+ getOutput().getPrintWriter().format(fmt_config, dev.getId());
+ final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
+ cfg.configureDeviceBootp(dev, true);
+ }
+
+}
Copied: trunk/cli/coreutils/src/commands/org/jnode/command/net/DhcpCommand.java (from rev 5361, trunk/net/src/net/org/jnode/net/command/DhcpCommand.java)
===================================================================
--- trunk/cli/coreutils/src/commands/org/jnode/command/net/DhcpCommand.java (rev 0)
+++ trunk/cli/coreutils/src/commands/org/jnode/command/net/DhcpCommand.java 2009-04-29 21:56:54 UTC (rev 5362)
@@ -0,0 +1,90 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.command.net;
+
+import java.io.PrintWriter;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import javax.naming.NameNotFoundException;
+
+import org.jnode.driver.ApiNotFoundException;
+import org.jnode.driver.Device;
+import org.jnode.driver.DeviceManager;
+import org.jnode.driver.DeviceNotFoundException;
+import org.jnode.driver.net.NetDeviceAPI;
+import org.jnode.driver.net.NetworkException;
+import org.jnode.naming.InitialNaming;
+import org.jnode.net.ProtocolAddressInfo;
+import org.jnode.net.ethernet.EthernetConstants;
+import org.jnode.net.ipv4.config.IPv4ConfigurationService;
+import org.jnode.shell.AbstractCommand;
+import org.jnode.shell.syntax.Argument;
+import org.jnode.shell.syntax.DeviceArgument;
+
+/**
+ * @author markhale
+ * @author cr...@jn...
+ */
+public class DhcpCommand extends AbstractCommand {
+
+ private static final String help_device = "the network interface device to be configured";
+ private static final String help_super = "Configure a network interface using DHCP";
+ private static final String err_loopback = "The loopback network device is not bound to IP address 127.0.0.1%n" +
+ "Run 'ifconfig loopback 127.0.0.1 255.255.255.255' to fix this.%n";
+ private static final String fmt_config = "Configuring network device %s...%n";
+
+ private final DeviceArgument argDevice;
+
+ public DhcpCommand() {
+ super(help_super);
+ argDevice = new DeviceArgument("device", Argument.MANDATORY, help_device, NetDeviceAPI.class);
+ registerArguments(argDevice);
+ }
+
+ public static void main(String[] args) throws Exception {
+ new DhcpCommand().execute(args);
+ }
+
+ public void execute() throws DeviceNotFoundException, NameNotFoundException, ApiNotFoundException,
+ UnknownHostException, NetworkException {
+ final Device dev = argDevice.getValue();
+
+ // The DHCP network configuration process will attempt to configure the DNS. This will only work if
+ // the IP address 127.0.0.1 is bound to the loopback network interface. And if there isn't, JNode's
+ // network layer is left in a state that will require a reboot to unjam it (AFAIK).
+ //
+ // So, check that loopback is correctly bound ...
+ Device loopback = (InitialNaming.lookup(DeviceManager.NAME)).getDevice("loopback");
+ NetDeviceAPI api = loopback.getAPI(NetDeviceAPI.class);
+ ProtocolAddressInfo info = api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
+ if (info == null || !info.contains(InetAddress.getByAddress(new byte[]{127, 0, 0, 1}))) {
+ PrintWriter err = getError().getPrintWriter();
+ err.format(err_loopback);
+ exit(1);
+ }
+
+ // Now it should be safe to do the DHCP configuration.
+ getOutput().getPrintWriter().format(fmt_config, dev.getId());
+ final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
+ cfg.configureDeviceDhcp(dev, true);
+ }
+}
Copied: trunk/cli/coreutils/src/commands/org/jnode/command/net/IfconfigCommand.java (from rev 5361, trunk/net/src/net/org/jnode/net/command/IfconfigCommand.java)
===================================================================
--- trunk/cli/coreutils/src/commands/org/jnode/command/net/IfconfigCommand.java (rev 0)
+++ trunk/cli/coreutils/src/commands/org/jnode/command/net/IfconfigCommand.java 2009-04-29 21:56:54 UTC (rev 5362)
@@ -0,0 +1,107 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.command.net;
+
+import java.io.PrintWriter;
+
+import javax.naming.NameNotFoundException;
+
+import org.jnode.driver.ApiNotFoundException;
+import org.jnode.driver.Device;
+import org.jnode.driver.DeviceManager;
+import org.jnode.driver.net.NetDeviceAPI;
+import org.jnode.driver.net.NetworkException;
+import org.jnode.naming.InitialNaming;
+import org.jnode.net.ethernet.EthernetConstants;
+import org.jnode.net.ipv4.IPv4Address;
+import org.jnode.net.ipv4.config.IPv4ConfigurationService;
+import org.jnode.net.syntax.IPv4AddressArgument;
+import org.jnode.shell.AbstractCommand;
+import org.jnode.shell.syntax.Argument;
+import org.jnode.shell.syntax.DeviceArgument;
+
+/**
+ * This command class binds IP addresses to network devices, and displays bindings.
+ *
+ * @author epr
+ * @author cr...@jn...
+ */
+public class IfconfigCommand extends AbstractCommand {
+ // FIXME should support IPv6 and other address families.
+
+ private static final String help_device = "the device";
+ private static final String help_ip = "the IPv4 address to bind the device to";
+ private static final String help_subnet = "the IPv4 subnet mask for the device";
+ private static final String help_super = "List or manage network interface bindings";
+ private static final String fmt_devices = "%s: MAC-Address %s MTU %s%n %s";
+ private static final String fmt_ip = "IP address(es) for %s %s";
+ private static final String fmt_set_ip = "IP Address for %s set to %s";
+
+ private final DeviceArgument argDevice;
+ private final IPv4AddressArgument argIPAddress;
+ private final IPv4AddressArgument argSubnetMask;
+
+
+ public IfconfigCommand() {
+ super(help_super);
+ argDevice = new DeviceArgument("device", Argument.OPTIONAL, help_device, NetDeviceAPI.class);
+ argIPAddress = new IPv4AddressArgument("ipAddress", Argument.OPTIONAL, help_ip);
+ argSubnetMask = new IPv4AddressArgument("subnetMask", Argument.OPTIONAL, help_subnet);
+ registerArguments(argDevice, argIPAddress, argSubnetMask);
+ }
+
+ public static void main(String[] args) throws Exception {
+ new IfconfigCommand().execute(args);
+ }
+
+ public void execute() throws NameNotFoundException, ApiNotFoundException, NetworkException {
+ PrintWriter out = getOutput().getPrintWriter();
+ if (!argDevice.isSet()) {
+ // Print MAC address, MTU and IP address(es) for all network devices.
+ final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
+ for (Device dev : dm.getDevicesByAPI(NetDeviceAPI.class)) {
+ final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
+ String info = api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP).toString();
+ out.format(fmt_devices, dev.getId(), api.getAddress(), api.getMTU(), info);
+ }
+ } else {
+ final Device dev = argDevice.getValue();
+ final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
+
+ if (!argIPAddress.isSet()) {
+ // Print IP address(es) for device
+ out.format(fmt_ip, dev.getId(), api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP));
+ } else {
+ // Set IP address for device
+ final IPv4Address ip = argIPAddress.getValue();
+ final IPv4Address mask = argSubnetMask.getValue();
+ final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
+ cfg.configureDeviceStatic(dev, ip, mask, true);
+
+ // FIXME ... this doesn't show the device's new address because the
+ // IPv4 ConfigurationServiceImpl calls processor.apply with the
+ // waitUntilReady parameter == false. (The comment in the code
+ // talks about avoiding deadlocks.)
+ out.format(fmt_set_ip, dev.getId(), api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP));
+ }
+ }
+ }
+}
Copied: trunk/cli/coreutils/src/commands/org/jnode/command/net/NetstatCommand.java (from rev 5361, trunk/net/src/net/org/jnode/net/command/NetstatCommand.java)
===================================================================
--- trunk/cli/coreutils/src/commands/org/jnode/command/net/NetstatCommand.java (rev 0)
+++ trunk/cli/coreutils/src/commands/org/jnode/command/net/NetstatCommand.java 2009-04-29 21:56:54 UTC (rev 5362)
@@ -0,0 +1,102 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.command.net;
+
+import java.io.PrintWriter;
+
+import org.jnode.driver.net.NetworkException;
+import org.jnode.net.NetworkLayer;
+import org.jnode.net.NetworkLayerManager;
+import org.jnode.net.TransportLayer;
+import org.jnode.net.util.NetUtils;
+import org.jnode.shell.AbstractCommand;
+import org.jnode.util.Statistic;
+import org.jnode.util.Statistics;
+
+/**
+ * @author epr
+ */
+public class NetstatCommand extends AbstractCommand {
+
+ private static final String help_super = "Print statistics for all network devices";
+ private static final String fmt_stat = "%s: ID %s";
+ private static final String str_none = "none";
+
+ public NetstatCommand() {
+ super(help_super);
+ }
+
+ public static void main(String[] args) throws Exception {
+ new NetstatCommand().execute(args);
+ }
+
+ /**
+ * Execute this command
+ */
+ public void execute() throws Exception {
+ final NetworkLayerManager nlm = NetUtils.getNLM();
+
+ for (NetworkLayer nl : nlm.getNetworkLayers()) {
+ showStats(getOutput().getPrintWriter(), nl, 80);
+ }
+ }
+
+ private void showStats(PrintWriter out, NetworkLayer nl, int maxWidth) throws NetworkException {
+ out.format(fmt_stat, nl.getName(), nl.getProtocolID());
+ final String prefix = " ";
+ out.print(prefix);
+ showStats(out, nl.getStatistics(), maxWidth - prefix.length(), prefix);
+ for (TransportLayer tl : nl.getTransportLayers()) {
+ out.print(prefix);
+ out.format(fmt_stat, tl.getName(), tl.getProtocolID());
+ final String prefix2 = prefix + prefix;
+ out.print(prefix2);
+ showStats(out, tl.getStatistics(), maxWidth - prefix2.length(), prefix2);
+ }
+ out.println();
+ }
+
+ private void showStats(PrintWriter out, Statistics stat, int maxWidth, String prefix)
+ throws NetworkException {
+ final Statistic[] list = stat.getStatistics();
+ if (list.length == 0) {
+ out.print(str_none);
+ } else {
+ int width = 0;
+ for (int i = 0; i < list.length; i++) {
+ final Statistic st = list[i];
+ String msg = st.getName() + " " + st.getValue();
+ if (i + 1 < list.length) {
+ msg = msg + ", ";
+ }
+ if (width + msg.length() > maxWidth) {
+ out.println();
+ out.print(prefix);
+ width = 0;
+ }
+ out.print(msg);
+ width += msg.length();
+ ...
[truncated message content] |
|
From: <chr...@us...> - 2009-04-29 21:59:24
|
Revision: 5363
http://jnode.svn.sourceforge.net/jnode/?rev=5363&view=rev
Author: chrisboertien
Date: 2009-04-29 21:59:13 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Refactored commands from shell to cli
Signed-off-by: chrisboertien <chr...@gm...>
Modified Paths:
--------------
trunk/cli/descriptors/org.jnode.command.file.xml
Added Paths:
-----------
trunk/cli/descriptors/org.jnode.command.common.xml
trunk/cli/descriptors/org.jnode.command.dev.ant.xml
trunk/cli/descriptors/org.jnode.command.dev.xml
trunk/cli/descriptors/org.jnode.command.system.xml
trunk/cli/src/commands/org/jnode/command/common/
trunk/cli/src/commands/org/jnode/command/common/BasenameCommand.java
trunk/cli/src/commands/org/jnode/command/common/DateCommand.java
trunk/cli/src/commands/org/jnode/command/common/DirnameCommand.java
trunk/cli/src/commands/org/jnode/command/common/EchoCommand.java
trunk/cli/src/commands/org/jnode/command/common/EnvCommand.java
trunk/cli/src/commands/org/jnode/command/common/ExitCommand.java
trunk/cli/src/commands/org/jnode/command/common/ExprCommand.java
trunk/cli/src/commands/org/jnode/command/common/FalseCommand.java
trunk/cli/src/commands/org/jnode/command/common/HelpCommand.java
trunk/cli/src/commands/org/jnode/command/common/HistoryCommand.java
trunk/cli/src/commands/org/jnode/command/common/SleepCommand.java
trunk/cli/src/commands/org/jnode/command/common/TimeCommand.java
trunk/cli/src/commands/org/jnode/command/common/TrueCommand.java
trunk/cli/src/commands/org/jnode/command/common/UnixTestCommand.java
trunk/cli/src/commands/org/jnode/command/common/UptimeCommand.java
trunk/cli/src/commands/org/jnode/command/dev/
trunk/cli/src/commands/org/jnode/command/dev/CompileCommand.java
trunk/cli/src/commands/org/jnode/command/dev/DebugCommand.java
trunk/cli/src/commands/org/jnode/command/dev/DisassembleCommand.java
trunk/cli/src/commands/org/jnode/command/dev/RemoteOutputCommand.java
trunk/cli/src/commands/org/jnode/command/dev/ant/
trunk/cli/src/commands/org/jnode/command/dev/ant/AntCommand.java
trunk/cli/src/commands/org/jnode/command/file/CatCommand.java
trunk/cli/src/commands/org/jnode/command/file/GrepCommand.java
trunk/cli/src/commands/org/jnode/command/file/HeadCommand.java
trunk/cli/src/commands/org/jnode/command/file/TailCommand.java
trunk/cli/src/commands/org/jnode/command/file/WcCommand.java
trunk/cli/src/commands/org/jnode/command/system/
trunk/cli/src/commands/org/jnode/command/system/AliasCommand.java
trunk/cli/src/commands/org/jnode/command/system/BindKeysCommand.java
trunk/cli/src/commands/org/jnode/command/system/ClassCommand.java
trunk/cli/src/commands/org/jnode/command/system/ClasspathCommand.java
trunk/cli/src/commands/org/jnode/command/system/CpuIDCommand.java
trunk/cli/src/commands/org/jnode/command/system/GcCommand.java
trunk/cli/src/commands/org/jnode/command/system/HaltCommand.java
trunk/cli/src/commands/org/jnode/command/system/IsolateCommand.java
trunk/cli/src/commands/org/jnode/command/system/JavaCommand.java
trunk/cli/src/commands/org/jnode/command/system/KdbCommand.java
trunk/cli/src/commands/org/jnode/command/system/KillCommand.java
trunk/cli/src/commands/org/jnode/command/system/LoadkeysCommand.java
trunk/cli/src/commands/org/jnode/command/system/LocaleCommand.java
trunk/cli/src/commands/org/jnode/command/system/Log4jCommand.java
trunk/cli/src/commands/org/jnode/command/system/LsIRQCommand.java
trunk/cli/src/commands/org/jnode/command/system/MemoryCommand.java
trunk/cli/src/commands/org/jnode/command/system/NamespaceCommand.java
trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java
trunk/cli/src/commands/org/jnode/command/system/PageCommand.java
trunk/cli/src/commands/org/jnode/command/system/PluginCommand.java
trunk/cli/src/commands/org/jnode/command/system/PrintEnvCommand.java
trunk/cli/src/commands/org/jnode/command/system/RebootCommand.java
trunk/cli/src/commands/org/jnode/command/system/RunCommand.java
trunk/cli/src/commands/org/jnode/command/system/SetCommand.java
trunk/cli/src/commands/org/jnode/command/system/SyntaxCommand.java
trunk/cli/src/commands/org/jnode/command/system/TerminateCommand.java
trunk/cli/src/commands/org/jnode/command/system/ThreadCommand.java
trunk/cli/src/commands/org/jnode/command/system/VmInfoCommand.java
Removed Paths:
-------------
trunk/shell/descriptors/org.jnode.shell.command.ant.xml
trunk/shell/descriptors/org.jnode.shell.command.debug.xml
trunk/shell/descriptors/org.jnode.shell.command.log4j.xml
trunk/shell/descriptors/org.jnode.shell.command.plugin.xml
trunk/shell/descriptors/org.jnode.shell.command.posix.xml
trunk/shell/descriptors/org.jnode.shell.command.system.xml
trunk/shell/descriptors/org.jnode.shell.command.xml
trunk/shell/src/shell/org/jnode/shell/command/AliasCommand.java
trunk/shell/src/shell/org/jnode/shell/command/BindKeysCommand.java
trunk/shell/src/shell/org/jnode/shell/command/CatCommand.java
trunk/shell/src/shell/org/jnode/shell/command/ClassCommand.java
trunk/shell/src/shell/org/jnode/shell/command/ClasspathCommand.java
trunk/shell/src/shell/org/jnode/shell/command/CompileCommand.java
trunk/shell/src/shell/org/jnode/shell/command/DateCommand.java
trunk/shell/src/shell/org/jnode/shell/command/DisassembleCommand.java
trunk/shell/src/shell/org/jnode/shell/command/EchoCommand.java
trunk/shell/src/shell/org/jnode/shell/command/EnvCommand.java
trunk/shell/src/shell/org/jnode/shell/command/ExitCommand.java
trunk/shell/src/shell/org/jnode/shell/command/GcCommand.java
trunk/shell/src/shell/org/jnode/shell/command/GrepCommand.java
trunk/shell/src/shell/org/jnode/shell/command/HeadCommand.java
trunk/shell/src/shell/org/jnode/shell/command/HelpCommand.java
trunk/shell/src/shell/org/jnode/shell/command/HistoryCommand.java
trunk/shell/src/shell/org/jnode/shell/command/IsolateCommand.java
trunk/shell/src/shell/org/jnode/shell/command/JavaCommand.java
trunk/shell/src/shell/org/jnode/shell/command/KillCommand.java
trunk/shell/src/shell/org/jnode/shell/command/LoadkeysCommand.java
trunk/shell/src/shell/org/jnode/shell/command/LocaleCommand.java
trunk/shell/src/shell/org/jnode/shell/command/MemoryCommand.java
trunk/shell/src/shell/org/jnode/shell/command/NamespaceCommand.java
trunk/shell/src/shell/org/jnode/shell/command/OnHeapCommand.java
trunk/shell/src/shell/org/jnode/shell/command/PageCommand.java
trunk/shell/src/shell/org/jnode/shell/command/PrintEnvCommand.java
trunk/shell/src/shell/org/jnode/shell/command/RunCommand.java
trunk/shell/src/shell/org/jnode/shell/command/SetCommand.java
trunk/shell/src/shell/org/jnode/shell/command/SleepCommand.java
trunk/shell/src/shell/org/jnode/shell/command/SyntaxCommand.java
trunk/shell/src/shell/org/jnode/shell/command/TailCommand.java
trunk/shell/src/shell/org/jnode/shell/command/TerminateCommand.java
trunk/shell/src/shell/org/jnode/shell/command/ThreadCommand.java
trunk/shell/src/shell/org/jnode/shell/command/TimeCommand.java
trunk/shell/src/shell/org/jnode/shell/command/UptimeCommand.java
trunk/shell/src/shell/org/jnode/shell/command/ant/AntCommand.java
trunk/shell/src/shell/org/jnode/shell/command/debug/DebugCommand.java
trunk/shell/src/shell/org/jnode/shell/command/debug/RemoteOutputCommand.java
trunk/shell/src/shell/org/jnode/shell/command/log4j/Log4jCommand.java
trunk/shell/src/shell/org/jnode/shell/command/plugin/HaltCommand.java
trunk/shell/src/shell/org/jnode/shell/command/plugin/PluginCommand.java
trunk/shell/src/shell/org/jnode/shell/command/plugin/RebootCommand.java
trunk/shell/src/shell/org/jnode/shell/command/posix/BasenameCommand.java
trunk/shell/src/shell/org/jnode/shell/command/posix/DirnameCommand.java
trunk/shell/src/shell/org/jnode/shell/command/posix/ExprCommand.java
trunk/shell/src/shell/org/jnode/shell/command/posix/FalseCommand.java
trunk/shell/src/shell/org/jnode/shell/command/posix/TrueCommand.java
trunk/shell/src/shell/org/jnode/shell/command/posix/UnixTestCommand.java
trunk/shell/src/shell/org/jnode/shell/command/posix/WcCommand.java
trunk/shell/src/shell/org/jnode/shell/command/system/CpuIDCommand.java
trunk/shell/src/shell/org/jnode/shell/command/system/KdbCommand.java
trunk/shell/src/shell/org/jnode/shell/command/system/LsIRQCommand.java
trunk/shell/src/shell/org/jnode/shell/command/system/VmInfoCommand.java
Added: trunk/cli/descriptors/org.jnode.command.common.xml
===================================================================
--- trunk/cli/descriptors/org.jnode.command.common.xml (rev 0)
+++ trunk/cli/descriptors/org.jnode.command.common.xml 2009-04-29 21:59:13 UTC (rev 5363)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="org.jnode.command.common"
+ name="JNode common commands"
+ version="@VERSION@"
+ provider-name="@PROVIDER@"
+ license-name="lgpl">
+
+ <requires>
+ <import plugin="org.jnode.shell.help"/>
+ <import plugin="org.jnode.shell.syntax"/>
+ </requires>
+
+ <runtime>
+ <library name="jnode-coreutils.jar">
+ <export name="org.jnode.command.common.*"/>
+ </library>
+ </runtime>
+
+ <extension point="org.jnode.shell.aliases">
+ <alias name="basename" class="org.jnode.command.common.BasenameCommand"/>
+ <alias name="date" class="org.jnode.command.common.DateCommand"/>
+ <alias name="dirname" class="org.jnode.command.common.DirnameCommand"/>
+ <alias name="echo" class="org.jnode.command.common.EchoCommand"/>
+ <alias name="env" class="org.jnode.command.common.EnvCommand"/>
+ <alias name="exit" class="org.jnode.command.common.ExitCommand"/>
+ <alias name="expr" class="org.jnode.command.common.ExprCommand"/>
+ <alias name="false" class="org.jnode.command.common.FalseCommand"/>
+ <alias name="help" class="org.jnode.command.common.HelpCommand"/>
+ <alias name="history" class="org.jnode.command.common.HistoryCommand"/>
+ <alias name="man" class="org.jnode.command.common.HelpCommand"/>
+ <alias name="sleep" class="org.jnode.command.common.SleepCommand"/>
+ <alias name="test" class="org.jnode.command.common.UnixTestCommand"/>
+ <alias name="time" class="org.jnode.command.common.TimeCommand"/>
+ <alias name="true" class="org.jnode.command.common.TrueCommand"/>
+ <alias name="uptime" class="org.jnode.command.common.UptimeCommand"/>
+ <alias name="[" class="org.jnode.command.common.UnixTestCommand"/>
+ </extension>
+
+ <extension point="org.jnode.shell.syntaxes">
+ <syntax alias="basename">
+ <sequence description="strip the directory prefix from a filename, as well as an option suffix">
+ <argument argLabel="name" />
+ <optional><argument argLabel="suffix"/></optional>
+ </sequence>
+ </syntax>
+ <syntax alias="date" description="Print the current date"/>
+ <syntax alias="dirname">
+ <argument argLabel="name"/>
+ </syntax>
+ <syntax alias="echo" description="Print the arguments">
+ <repeat>
+ <argument argLabel="text"/>
+ </repeat>
+ </syntax>
+ <syntax alias="env">
+ <empty description="Print the system properties"/>
+ <option argLabel="env" shortName="e" longName="env"
+ description="Print the system environment variables"/>
+ <option argLabel="shell" shortName="s" longName="shell"
+ description="Print the current shell properties"/>
+ </syntax>
+ <syntax alias="exit" description="Exit the current shell"/>
+ <syntax alias="false">
+ <empty description="Set a non-zero return code"/>
+ </syntax>
+ <syntax alias="help">
+ <empty description="Print help about 'help'"/>
+ <argument argLabel="alias" description="Print help about a command alias or class"/>
+ </syntax>
+ <syntax alias="history">
+ <empty description="List history entries"/>
+ <sequence description="Run a history command">
+ <alternatives><empty/><option argLabel="test" shortName="t" longName="test"/></alternatives>
+ <alternatives>
+ <argument argLabel="index"/>
+ <argument argLabel="prefix"/>
+ </alternatives>
+ </sequence>
+ </syntax>
+ <syntax alias="man">
+ <empty description="Print help about 'man'"/>
+ <argument argLabel="alias" description="Print help about a command alias or class"/>
+ </syntax>
+ <syntax alias="sleep" description="Sleep for a given number of seconds">
+ <argument argLabel="seconds"/>
+ </syntax>
+ <syntax alias="time" description="Measures command execution time">
+ <sequence>
+ <argument argLabel="alias"/>
+ <repeat><argument argLabel="args"/></repeat>
+ </sequence>
+ </syntax>
+ <syntax alias="true">
+ <empty description="Set a zero return code"/>
+ </syntax>
+ </extension>
+
+ <extension point="org.jnode.security.permissions">
+ <permission class="java.util.FilePermission" name="<<ALL FILES>>" actions="read"/>
+ </extension>
+</plugin>
Copied: trunk/cli/descriptors/org.jnode.command.dev.ant.xml (from rev 5362, trunk/shell/descriptors/org.jnode.shell.command.ant.xml)
===================================================================
--- trunk/cli/descriptors/org.jnode.command.dev.ant.xml (rev 0)
+++ trunk/cli/descriptors/org.jnode.command.dev.ant.xml 2009-04-29 21:59:13 UTC (rev 5363)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="org.jnode.command.dev.ant"
+ name="JNode Ant Commands"
+ version="@VERSION@"
+ license-name="lgpl"
+ provider-name="JNode.org">
+
+ <requires>
+ <import plugin="org.jnode.shell.help"/>
+ <import plugin="org.apache.tools.ant"/>
+ <import plugin="org.apache.tools.ant-launcher"/>
+ </requires>
+
+ <runtime>
+ <library name="jnode-coreutils.jar">
+ <export name="org.jnode.command.dev.ant.*"/>
+ </library>
+ </runtime>
+
+ <extension point="org.jnode.shell.aliases">
+ <alias name="ant" class="org.jnode.command.dev.ant.AntCommand"/>
+ </extension>
+
+ <extension point="org.jnode.security.permissions">
+ <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
+ <permission class="java.lang.RuntimePermission" name="setSecurityManager" actions="*" />
+ <permission class="java.lang.RuntimePermission" name="createClassLoader" actions="*" />
+ <permission class="java.lang.RuntimePermission" name="setIO" actions="*" />
+ <permission class="java.lang.RuntimePermission" name="exitVM" actions="*" />
+ <permission class="org.jnode.security.JNodePermission" name="getVmClass" actions="*" />
+ <permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
+ </extension>
+
+</plugin>
Added: trunk/cli/descriptors/org.jnode.command.dev.xml
===================================================================
--- trunk/cli/descriptors/org.jnode.command.dev.xml (rev 0)
+++ trunk/cli/descriptors/org.jnode.command.dev.xml 2009-04-29 21:59:13 UTC (rev 5363)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="org.jnode.command.dev"
+ name="JNode developer commands"
+ version="@VERSION@"
+ provider-name="@PROVIDER@"
+ license-name="lgpl">
+
+ <requires>
+ <import plugin="org.jnode.debug"/>
+ <import plugin="org.classpath.ext.jdwp"/>
+ <import plugin="org.jnode.shell.syntax"/>
+ </requires>
+
+ <runtime>
+ <library name="jnode-coreutils.jar">
+ <export name="org.jnode.command.dev.*"/>
+ </library>
+ </runtime>
+
+ <extension point="org.jnode.shell.aliases">
+ <alias name="compile" class="org.jnode.command.dev.CompileCommand"/>
+ <alias name="debug" class="org.jnode.command.dev.DebugCommand"/>
+ <alias name="disasm" class="org.jnode.command.dev.DisassembleCommand"/>
+ <alias name="netout" class="org.jnode.command.dev.RemoteOutputCommand"/>
+ </extension>
+
+ <extension point="org.jnode.shell.syntaxes">
+ <syntax alias="compile" description="Compile a class to native code">
+ <sequence>
+ <optionSet>
+ <option argLabel="test" longName="test"/>
+ <option argLabel="level" longName="level"/>
+ </optionSet>
+ <argument argLabel="className"/>
+ </sequence>
+ </syntax>
+ <syntax alias="disasm" description="Disassemble a native code class">
+ <sequence>
+ <optionSet>
+ <option argLabel="test" longName="test"/>
+ <option argLabel="level" longName="level"/>
+ </optionSet>
+ <argument argLabel="className"/>
+ <optional>
+ <argument argLabel="methodName"/>
+ </optional>
+ </sequence>
+ </syntax>
+ <syntax alias="debug">
+ <optional description="Run a JDWP listener to enable remote debugging">
+ <option argLabel="port" shortName="p"/>
+ </optional>
+ </syntax>
+ <syntax alias="remoteout">
+ <optionSet description="Redirect output and logging to a remote receiver">
+ <option argLabel="host" shortName="h" longName="host"/>
+ <option argLabel="port" shortName="p" longName="port"/>
+ <option argLabel="udp" shortName="u" longName="udp"/>
+ </optionSet>
+ </syntax>
+ </extension>
+
+ <extension point="org.jnode.security.permissions">
+ <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
+ <permission class="java.lang.RuntimePermission" name="modifyThreadGroup"/>
+ <permission class="java.lang.RuntimePermission" name="setIO"/>
+ <permission class="java.lang.RuntimePermission" name="exitVM"/>
+ <permission class="java.net.SocketPermission" name="*:1-" actions="resolve,listen,connect"/>
+ <permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
+ </extension>
+</plugin>
Modified: trunk/cli/descriptors/org.jnode.command.file.xml
===================================================================
--- trunk/cli/descriptors/org.jnode.command.file.xml 2009-04-29 21:56:54 UTC (rev 5362)
+++ trunk/cli/descriptors/org.jnode.command.file.xml 2009-04-29 21:59:13 UTC (rev 5363)
@@ -19,22 +19,39 @@
</runtime>
<extension point="org.jnode.shell.aliases">
+ <alias name="cat" class="org.jnode.command.file.CatCommand"/>
<alias name="cd" class="org.jnode.command.file.CdCommand" internal="yes"/>
<alias name="cp" class="org.jnode.command.file.CpCommand"/>
<alias name="del" class="org.jnode.command.file.DeleteCommand"/>
<alias name="df" class="org.jnode.command.file.DFCommand"/>
<alias name="dir" class="org.jnode.command.file.DirCommand"/>
- <alias name="find" class="org.jnode.command.file.FindCommand"/>
+ <alias name="find" class="org.jnode.command.file.FindCommand"/>
+ <alias name="grep" class="org.jnode.command.file.GrepCommand"/>
+ <alias name="head" class="org.jnode.command.file.HeadCommand"/>
<alias name="hexdump" class="org.jnode.command.file.HexdumpCommand"/>
<alias name="ls" class="org.jnode.command.file.DirCommand"/>
<alias name="md5sum" class="org.jnode.command.file.Md5SumCommand"/>
<alias name="mkdir" class="org.jnode.command.file.MkdirCommand"/>
<alias name="pwd" class="org.jnode.command.file.PwdCommand"/>
<alias name="rm" class="org.jnode.command.file.DeleteCommand"/>
+ <alias name="tail" class="org.jnode.command.file.TailCommand"/>
<alias name="touch" class="org.jnode.command.file.TouchCommand"/>
+ <alias name="wc" class="org.jnode.command.file.WcCommand"/>
</extension>
<extension point="org.jnode.shell.syntaxes">
+ <syntax alias="cat">
+ <empty description="copy standard input to standard output"/>
+ <sequence description="fetch and concatenate urls to standard output">
+ <option argLabel="urls" shortName="u" longName="urls"/>
+ <repeat minCount="1">
+ <argument argLabel="url"/>
+ </repeat>
+ </sequence>
+ <repeat minCount="1" description="concatenate files to standard output">
+ <argument argLabel="file"/>
+ </repeat>
+ </syntax>
<syntax alias="cd">
<empty description="change the current directory to the 'user.home' directory"/>
<argument argLabel="directory" description="change the current directory to 'directory'"/>
@@ -89,6 +106,86 @@
</optionSet>
</sequence>
</syntax>
+ <syntax alias="grep">
+ <!-- grep [Options] <pattern> [<file>...] or
+ grep [Options] (-e <pattern> | -f <file>)... [<file>...] -->
+ <sequence description="Search for lines that match a string or regex">
+ <optionSet>
+ <!-- Matcher type -->
+ <option argLabel="matcher-fixed" shortName="F" longName="fixed-strings"/>
+ <option argLabel="matcher-ext" shortName="E" longName="extended-regexp"/>
+ <option argLabel="matcher-basic" shortName="G" longName="basic-regexp"/>
+ <option argLabel="matcher-perl" shortName="P" longName="perl-regexp"/>
+ <!-- Matching options -->
+ <option argLabel="ignore-case" shortName="i" longName="ignore-case"/>
+ <option argLabel="invert" shortName="v" longName="invert-match"/>
+ <option argLabel="word-match" shortName="w" longName="word-regexp"/>
+ <option argLabel="line-match" shortName="x" longName="line-regexp"/>
+ <!-- Output options -->
+ <option argLabel="show-count" shortName="c" longName="count"/>
+ <option argLabel="show-files-nomatch" shortName="L" longName="files-without-match"/>
+ <option argLabel="show-files-match" shortName="l" longName="files-with-match"/>
+ <option argLabel="show-only-match" shortName="o" longName="only-matching"/>
+ <option argLabel="max-matches" shortName="m" longName="max-count"/>
+ <option argLabel="quiet" shortName="q" longName="quiet"/>
+ <option argLabel="quiet" longName="silent"/>
+ <option argLabel="suppress" shortName="s" longName="no-messages"/>
+ <!-- Output prefix control -->
+ <option argLabel="prefix-byte" shortName="b" longName="byte-offset"/>
+ <option argLabel="prefix-file" shortName="H" longName="with-filename"/>
+ <option argLabel="prefix-nofile" shortName="h" longName="no-filename"/>
+ <option argLabel="prefix-label" longName="label"/>
+ <option argLabel="prefix-line" shortName="n" longName="line-number"/>
+ <option argLabel="prefix-tab" shortName="T" longName="initial-tab"/>
+ <option argLabel="prefix-null" shortName="Z" longName="null"/>
+ <!-- Context lines -->
+ <option argLabel="show-context-after" shortName="A" longName="after-context"/>
+ <option argLabel="show-context-before" shortName="B" longName="before-context"/>
+ <option argLabel="show-context-both" shortName="C" longName="context"/>
+ <!-- File/Directory selection -->
+ <option argLabel="mode-binary" longName="binary-files"/>
+ <option argLabel="mode-binary-text" shortName="a" longName="text"/>
+ <option argLabel="mode-binary-skip" shortName="I"/>
+ <option argLabel="mode-device" shortName="D" longName="devices"/>
+ <option argLabel="mode-dir" shortName="d" longName="directories"/>
+ <option argLabel="mode-dir-recurse" shortName="r" longName="recursive"/>
+ <option argLabel="mode-dir-recurse" shortName="R"/>
+ <option argLabel="pattern-exclude" longName="exclude"/>
+ <option argLabel="pattern-exclude-file" longName="exclude-from"/>
+ <option argLabel="pattern-exclude-dir" longName="exclude-dir"/>
+ <option argLabel="pattern-include" longName="include"/>
+ <!-- Other options -->
+ <option argLabel="null-term" shortName="z" longName="null-data"/>
+ <option argLabel="debug" longName="debug"/>
+ </optionSet>
+ <alternatives>
+ <repeat minCount="1">
+ <alternatives>
+ <option argLabel="patterns" shortName="e"/>
+ <option argLabel="pattern-files" shortName="f"/>
+ </alternatives>
+ </repeat>
+ <argument argLabel="patterns"/>
+ </alternatives>
+ <repeat>
+ <argument argLabel="files"/>
+ </repeat>
+ </sequence>
+ </syntax>
+ <syntax alias="head">
+ <sequence>
+ <optionSet>
+ <option argLabel="quiet" shortName="q" longName="quiet"/>
+ <option argLabel="quiet" longName="silent"/>
+ <option argLabel="verbose" shortName="v" longName="verbose"/>
+ <option argLabel="bytes" shortName="c" longName="bytes"/>
+ <option argLabel="lines" shortName="n" longName="lines"/>
+ </optionSet>
+ <repeat>
+ <argument argLabel="files" />
+ </repeat>
+ </sequence>
+ </syntax>
<syntax alias="hexdump">
<empty description="print a hex dump of standard input"/>
<argument argLabel="file" description="print a hex dump of a file"/>
@@ -129,9 +226,42 @@
</repeat>
</sequence>
</syntax>
+ <syntax alias="tail">
+ <sequence>
+ <optionSet label="globals">
+ <option argLabel="follow" shortName="f" longName="follow"/>
+ <option argLabel="followr" shortName="F"/>
+ <option argLabel="retry" longName="retry"/>
+ <option argLabel="unchanged" longName="max-unchanged-stats"/>
+ <!--<option argLabel="pid" longName="pid"/> disabled -->
+ <option argLabel="sleep" shortName="s" longName="sleep-interval"/>
+ <option argLabel="quiet" shortName="q" longName="quiet"/>
+ <option argLabel="verbose" shortName="v" longName="verbose"/>
+ <option argLabel="bytes" shortName="c" longName="bytes"/>
+ <option argLabel="lines" shortName="n" longName="lines"/>
+ </optionSet>
+ <repeat>
+ <argument argLabel="files"/>
+ </repeat>
+ </sequence>
+ </syntax>
<syntax alias="touch">
<argument argLabel="file" description="touch the given file"/>
</syntax>
+ <syntax alias="wc">
+ <sequence>
+ <optionSet>
+ <option argLabel="bytes" shortName="c" longName="bytes"/>
+ <option argLabel="chars" shortName="m" longName="chars"/>
+ <option argLabel="lines" shortName="l" longName="lines"/>
+ <option argLabel="worlds" shortName="w" longName="words"/>
+ <option argLabel="maxCharLine" shortName="L" longName="max-line-length"/>
+ </optionSet>
+ <repeat>
+ <argument argLabel="files"/>
+ </repeat>
+ </sequence>
+ </syntax>
</extension>
<extension point="org.jnode.security.permissions">
Added: trunk/cli/descriptors/org.jnode.command.system.xml
===================================================================
--- trunk/cli/descriptors/org.jnode.command.system.xml (rev 0)
+++ trunk/cli/descriptors/org.jnode.command.system.xml 2009-04-29 21:59:13 UTC (rev 5363)
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="org.jnode.command.system"
+ name="JNode system commands"
+ version="@VERSION@"
+ provider-name="@PROVIDER@"
+ license-name="lgpl">
+
+ <requires>
+ <import plugin="org.jnode.shell.syntax"/>
+ </requires>
+
+ <runtime>
+ <library name="jnode-coreutils.jar">
+ <export name="org.jnode.command.system.*"/>
+ </library>
+ </runtime>
+
+ <extension point="org.jnode.shell.aliases">
+ <alias name="alias" class="org.jnode.shell.command.AliasCommand"/>
+ <alias name="bindkeys" class="org.jnode.shell.command.BindKeysCommand"/>
+ <alias name="class" class="org.jnode.shell.command.ClassCommand"/>
+ <alias name="classpath" class="org.jnode.shell.command.ClasspathCommand" internal="yes"/>
+ <alias name="gc" class="org.jnode.shell.command.GcCommand"/>
+ <alias name="isolate" class="org.jnode.shell.command.IsolateCommand"/>
+ <alias name="java" class="org.jnode.shell.command.JavaCommand"/>
+ <alias name="kill" class="org.jnode.shell.command.KillCommand"/>
+ <alias name="loadkeys" class="org.jnode.shell.command.LoadkeysCommand"/>
+ <alias name="locale" class="org.jnode.shell.command.LocaleCommand"/>
+ <alias name="memory" class="org.jnode.shell.command.MemoryCommand"/>
+ <alias name="namespace" class="org.jnode.shell.command.NamespaceCommand"/>
+ <alias name="onheap" class="org.jnode.shell.command.OnHeapCommand"/>
+ <alias name="page" class="org.jnode.shell.command.PageCommand"/>
+ <alias name="printenv" class="org.jnode.shell.command.PrintEnvCommand"/>
+ <alias name="propset" class="org.jnode.shell.command.SetCommand" internal="yes"/>
+ <alias name="run" class="org.jnode.shell.command.RunCommand"/>
+ <alias name="syntax" class="org.jnode.shell.command.SyntaxCommand"/>
+ <alias name="terminate" class="org.jnode.shell.command.TerminateCommand"/>
+ <alias name="thread" class="org.jnode.shell.command.ThreadCommand"/>
+ </extension>
+
+ <extension point="org.jnode.shell.syntaxes">
+ <syntax alias="alias">
+ <empty description="List all aliases"/>
+ <option argLabel="remove" shortName="r" description="Remove an alias"/>
+ <sequence description="Create or update an alias">
+ <argument argLabel="alias"/>
+ <argument argLabel="className"/>
+ </sequence>
+ </syntax>
+ <syntax alias="bindkeys">
+ <empty d...
[truncated message content] |
|
From: <chr...@us...> - 2009-04-29 22:01:24
|
Revision: 5364
http://jnode.svn.sourceforge.net/jnode/?rev=5364&view=rev
Author: chrisboertien
Date: 2009-04-29 22:01:19 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Finishing touches on the refactoring.
Signed-off-by: chrisboertien <chr...@gm...>
Modified Paths:
--------------
trunk/all/build.xml
trunk/all/conf/default-plugin-list.xml
trunk/all/conf/full-plugin-list.xml
trunk/all/conf/shell-plugin-list.xml
trunk/all/lib/jnode.xml
trunk/cli/build.xml
trunk/cli/descriptors/org.apache.tools.archive.xml
trunk/cli/descriptors/org.jnode.command.archive.xml
trunk/cli/descriptors/org.jnode.command.common.xml
trunk/cli/descriptors/org.jnode.command.dev.ant.xml
trunk/cli/descriptors/org.jnode.command.dev.xml
trunk/cli/descriptors/org.jnode.command.file.xml
trunk/cli/descriptors/org.jnode.command.system.xml
trunk/cli/descriptors/org.jnode.command.util.xml
trunk/cli/src/commands/org/jnode/command/archive/ArchiveCommand.java
trunk/cli/src/commands/org/jnode/command/common/BasenameCommand.java
trunk/cli/src/commands/org/jnode/command/common/DirnameCommand.java
trunk/cli/src/commands/org/jnode/command/common/EnvCommand.java
trunk/cli/src/commands/org/jnode/command/common/FalseCommand.java
trunk/cli/src/commands/org/jnode/command/common/HistoryCommand.java
trunk/cli/src/commands/org/jnode/command/common/TimeCommand.java
trunk/cli/src/commands/org/jnode/command/dev/RemoteOutputCommand.java
trunk/cli/src/commands/org/jnode/command/file/CdCommand.java
trunk/cli/src/commands/org/jnode/command/file/CpCommand.java
trunk/cli/src/commands/org/jnode/command/file/DFCommand.java
trunk/cli/src/commands/org/jnode/command/file/DeleteCommand.java
trunk/cli/src/commands/org/jnode/command/file/DirCommand.java
trunk/cli/src/commands/org/jnode/command/file/FindCommand.java
trunk/cli/src/commands/org/jnode/command/file/HexdumpCommand.java
trunk/cli/src/commands/org/jnode/command/file/Md5SumCommand.java
trunk/cli/src/commands/org/jnode/command/file/MkdirCommand.java
trunk/cli/src/commands/org/jnode/command/file/TailCommand.java
trunk/cli/src/commands/org/jnode/command/file/TouchCommand.java
trunk/cli/src/commands/org/jnode/command/file/WcCommand.java
trunk/cli/src/commands/org/jnode/command/system/AliasCommand.java
trunk/cli/src/commands/org/jnode/command/system/LocaleCommand.java
trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java
trunk/cli/src/commands/org/jnode/command/system/ThreadCommand.java
Added Paths:
-----------
trunk/cli/descriptors/org.jnode.command.net.xml
trunk/cli/src/commands/org/jnode/command/net/
trunk/cli/src/commands/org/jnode/command/net/ArpCommand.java
trunk/cli/src/commands/org/jnode/command/net/BootpCommand.java
trunk/cli/src/commands/org/jnode/command/net/DhcpCommand.java
trunk/cli/src/commands/org/jnode/command/net/IfconfigCommand.java
trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java
trunk/cli/src/commands/org/jnode/command/net/PingCommand.java
trunk/cli/src/commands/org/jnode/command/net/ResolverCommand.java
trunk/cli/src/commands/org/jnode/command/net/RouteCommand.java
trunk/cli/src/commands/org/jnode/command/net/RpcInfoCommand.java
trunk/cli/src/commands/org/jnode/command/net/TcpInoutCommand.java
trunk/cli/src/commands/org/jnode/command/net/TftpCommand.java
trunk/cli/src/commands/org/jnode/command/net/WLanCtlCommand.java
trunk/cli/src/commands/org/jnode/command/net/WgetCommand.java
Removed Paths:
-------------
trunk/cli/coreutils/descriptors/org.jnode.command.net.xml
trunk/cli/coreutils/src/commands/org/jnode/command/net/ArpCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/BootpCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/DhcpCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/IfconfigCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/NetstatCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/PingCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/ResolverCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/RouteCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/RpcInfoCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/TcpInoutCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/TftpCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/WLanCtlCommand.java
trunk/cli/coreutils/src/commands/org/jnode/command/net/WgetCommand.java
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2009-04-29 21:59:13 UTC (rev 5363)
+++ trunk/all/build.xml 2009-04-29 22:01:19 UTC (rev 5364)
@@ -38,7 +38,7 @@
<property name="jnode-textui.jar" value="${root.dir}/textui/build/classes"/>
<property name="jnode-net.jar" value="${root.dir}/net/build/classes"/>
<property name="jnode-shell.jar" value="${root.dir}/shell/build/classes"/>
- <property name="jnode-coreutils.jar" value="${root.dir}/coreutils/build/classes"/>
+ <property name="jnode-cli.jar" value="${root.dir}/cli/build/classes"/>
<property name="jnode-fonts.jar" value="${build.dir}/descriptors/jnode-fonts.jar"/>
<property name="jnode-images.jar" value="${build.dir}/descriptors/jnode-images.jar"/>
@@ -144,7 +144,7 @@
<pathelement location="${jnode-shell.jar}"/>
<pathelement location="${jnode-net.jar}"/>
<pathelement location="${jnode-gui.jar}"/>
- <pathelement location="${jnode-coreutils.jar}"/>
+ <pathelement location="${jnode-cli.jar}"/>
<pathelement location="${thinlet.jar}"/>
<pathelement location="${jnode-textui.jar}"/>
<pathelement location="${bcel-5.1.jar}"/>
@@ -346,7 +346,7 @@
<libalias name="jnode-textui.jar" alias="${jnode-textui.jar}"/>
<libalias name="jnode-net.jar" alias="${jnode-net.jar}"/>
<libalias name="jnode-shell.jar" alias="${jnode-shell.jar}"/>
- <libalias name="jnode-coreutils.jar" alias="${jnode-coreutils.jar}"/>
+ <libalias name="jnode-cli.jar" alias="${jnode-cli.jar}"/>
<libalias name="jnode-mmtk-genrc.jar" alias="${jnode-mmtk-genrc.jar}"/>
<libalias name="jnode-mmtk-ms.jar" alias="${jnode-mmtk-ms.jar}"/>
Modified: trunk/all/conf/default-plugin-list.xml
===================================================================
--- trunk/all/conf/default-plugin-list.xml 2009-04-29 21:59:13 UTC (rev 5363)
+++ trunk/all/conf/default-plugin-list.xml 2009-04-29 22:01:19 UTC (rev 5364)
@@ -51,8 +51,11 @@
<plugin id="org.apache.tools.archive" />
<plugin id="org.jnode.command.archive"/>
+ <plugin id="org.jnode.command.common"/>
+ <plugin id="org.jnode.command.dev"/>
<plugin id="org.jnode.command.file"/>
<plugin id="org.jnode.command.net"/>
+ <plugin id="org.jnode.command.system"/>
<plugin id="org.jnode.command.util"/>
<plugin id="org.jnode.debug"/>
@@ -171,19 +174,13 @@
<plugin id="org.jnode.shell.bjorne"/>
<plugin id="org.jnode.shell.help"/>
<plugin id="org.jnode.shell.syntax"/>
- <plugin id="org.jnode.shell.command"/>
<plugin id="org.jnode.shell.command.bsh"/>
- <plugin id="org.jnode.shell.command.debug"/>
<plugin id="org.jnode.shell.command.driver"/>
<!-- temporally disabled
<plugin id="org.jnode.shell.command.driver.system.acpi"/>
-->
<plugin id="org.jnode.shell.command.driver.system.bus"/>
<plugin id="org.jnode.shell.command.driver.console"/>
- <plugin id="org.jnode.shell.command.log4j"/>
- <plugin id="org.jnode.shell.command.plugin"/>
- <plugin id="org.jnode.shell.command.posix"/>
- <plugin id="org.jnode.shell.command.system"/>
<plugin id="org.beanshell"/>
<plugin id="js"/>
Modified: trunk/all/conf/full-plugin-list.xml
===================================================================
--- trunk/all/conf/full-plugin-list.xml 2009-04-29 21:59:13 UTC (rev 5363)
+++ trunk/all/conf/full-plugin-list.xml 2009-04-29 22:01:19 UTC (rev 5364)
@@ -24,8 +24,8 @@
<plugin id="org.jnode.apps.httpd"/>
<plugin id="org.apache.tools.ant-launcher"/>
- <plugin id="org.apache.tools.ant"/>
- <plugin id="org.jnode.shell.command.ant"/>
+ <plugin id="org.apache.tools.ant"/>
+ <plugin id="org.jnode.command.dev.ant"/>
<plugin id="ejc"/>
Modified: trunk/all/conf/shell-plugin-list.xml
===================================================================
--- trunk/all/conf/shell-plugin-list.xml 2009-04-29 21:59:13 UTC (rev 5363)
+++ trunk/all/conf/shell-plugin-list.xml 2009-04-29 22:01:19 UTC (rev 5364)
@@ -12,6 +12,12 @@
<plugin id="org.jnode.fs"/>
<plugin id="org.jnode.fs.ramfs"/>
<plugin id="org.jnode.fs.ramfs.def"/>
+
+ <plugin id="org.apache.tools.archive"/>
+ <plugin id="org.jnode.command.archive"/>
+ <plugin id="org.jnode.command.common"/>
+ <plugin id="org.jnode.command.file"/>
+ <plugin id="org.jnode.command.util"/>
<plugin id="org.jnode.driver.character"/>
<plugin id="org.jnode.driver.console"/>
@@ -26,8 +32,6 @@
<plugin id="org.jnode.driver.textscreen.core"/>
<plugin id="org.jnode.log4j"/>
<plugin id="org.jnode.shell"/>
- <plugin id="org.jnode.shell.command"/>
- <plugin id="org.jnode.shell.command.plugin"/>
<plugin id="org.jnode.shell.help"/>
<plugin id="org.jnode.shell.syntax"/>
</plugin-list>
Modified: trunk/all/lib/jnode.xml
===================================================================
--- trunk/all/lib/jnode.xml 2009-04-29 21:59:13 UTC (rev 5363)
+++ trunk/all/lib/jnode.xml 2009-04-29 22:01:19 UTC (rev 5364)
@@ -70,7 +70,7 @@
<ant target="@{target}" dir="${root.dir}/gui" inheritall="on" inheritrefs="on" />
<ant target="@{target}" dir="${root.dir}/textui" inheritall="on" inheritrefs="on" />
<ant target="@{target}" dir="${root.dir}/distr" inheritall="on" inheritrefs="on" />
- <ant target="@{target}" dir="${root.dir}/coreutils" inheritall="on" inheritrefs="on" />
+ <ant target="@{target}" dir="${root.dir}/cli" inheritall="on" inheritrefs="on" />
</sequential>
</macrodef>
Modified: trunk/cli/build.xml
===================================================================
--- trunk/cli/build.xml 2009-04-29 21:59:13 UTC (rev 5363)
+++ trunk/cli/build.xml 2009-04-29 22:01:19 UTC (rev 5364)
@@ -5,7 +5,7 @@
<property name="my-build.dir" value="${basedir}/build"/>
<property name="my-classes.dir" value="${my-build.dir}/classes"/>
<property name="my-src.dir" value="${basedir}/src"/>
- <property name="my.jar" value="${jnode-coreutils.jar}"/>
+ <property name="my.jar" value="${jnode-cli.jar}"/>
<property name="my-report.dir" value="${my-build.dir}/report"/>
<!-- Subproject specific classpath -->
@@ -14,7 +14,6 @@
<pathelement location="${jnode-fs.jar}"/>
<pathelement location="${jnode-shell.jar}"/>
<pathelement location="${jnode-net.jar}"/>
- <pathelement location="${jnode-gui.jar}"/>
<path refid="cp"/>
</path>
Deleted: trunk/cli/coreutils/descriptors/org.jnode.command.net.xml
===================================================================
--- trunk/cli/coreutils/descriptors/org.jnode.command.net.xml 2009-04-29 21:59:13 UTC (rev 5363)
+++ trunk/cli/coreutils/descriptors/org.jnode.command.net.xml 2009-04-29 22:01:19 UTC (rev 5364)
@@ -1,144 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plugin SYSTEM "jnode.dtd">
-
-<plugin id="org.jnode.command.net"
- name="JNode net commands"
- version="@VERSION@"
- provider-name="@PROVIDER@"
- license-name="lgpl">
-
- <requires>
- <import plugin="org.jnode.net"/>
- <import plugin="org.jnode.net.arp"/>
- <import plugin="org.jnode.net.ipv4"/>
- <import plugin="org.jnode.net.ipv4.config"/>
- <import plugin="org.jnode.shell.help"/>
- <import plugin="org.acplt.oncrpc"/>
- </requires>
-
- <runtime>
- <library name="jnode-net.jar">
- <export name="org.jnode.net.syntax.*"/>
- </library>
- <library name="jnode-coreutils.jar">
- <export name="org.jnode.command.net.*"/>
- </library>
- </runtime>
-
- <extension point="org.jnode.shell.aliases">
- <alias name="arp" class="org.jnode.command.net.ArpCommand"/>
- <alias name="bootp" class="org.jnode.command.net.BootpCommand"/>
- <alias name="dhcp" class="org.jnode.command.net.DhcpCommand"/>
- <alias name="ifconfig" class="org.jnode.command.net.IfconfigCommand"/>
- <alias name="netstat" class="org.jnode.command.net.NetstatCommand"/>
- <alias name="ping" class="org.jnode.command.net.PingCommand"/>
- <alias name="route" class="org.jnode.command.net.RouteCommand"/>
- <alias name="resolver" class="org.jnode.command.net.ResolverCommand"/>
- <alias name="resolve" class="org.jnode.command.net.ResolveCommand"/>
- <alias name="tftp" class="org.jnode.command.net.TftpCommand"/>
- <alias name="wlanctl" class="org.jnode.command.net.WLanCtlCommand"/>
- <alias name="tcpinout" class="org.jnode.command.net.TcpInoutCommand"/>
- <alias name="rpcinfo" class="org.jnode.command.net.RpcInfoCommand"/>
- <alias name="wget" class="org.jnode.command.net.WgetCommand"/>
- </extension>
-
- <extension point="org.jnode.shell.syntaxes">
- <syntax alias="arp">
- <empty description="List the ARP cache"/>
- <option argLabel="clear" shortName="c" longName="clear" description="Clear the ARP cache"/>
- </syntax>
- <syntax alias="bootp">
- <argument argLabel="device" description="Configure a network interface using BOOTP"/>
- </syntax>
- <syntax alias="dhcp">
- <argument argLabel="device" description="Configure a network interface using DHCP"/>
- </syntax>
- <syntax alias="ifconfig">
- <empty description="Print network addresses for all network devices"/>
- <argument argLabel="device" description="Print network addresses for a given device"/>
- <sequence description="Bind a given device to an IPv4 address">
- <argument argLabel="device"/>
- <argument argLabel="ipAddress"/>
- <optional><argument argLabel="subnetMask"/></optional>
- </sequence>
- </syntax>
- <syntax alias="netstat">
- <empty description="Print statistics for all network devices"/>
- </syntax>
- <syntax alias="ping">
- <argument argLabel="host" description="Ping a remote host"/>
- </syntax>
- <syntax alias="resolver">
- <empty description="List the DNS servers used by the resolver's list"/>
- <sequence description="Add a DNS server to the resolver">
- <option argLabel="add" shortName="a" longName="add"/>
- <argument argLabel="server"/>
- </sequence>
- <sequence description="Remove a DNS server from the resolver's list">
- <option argLabel="del" shortName="d" longName="del"/>
- <argument argLabel="server"/>
- </sequence>
- </syntax>
- <syntax alias="route">
- <empty description="Print the routing table"/>
- <sequence description="Add or remove a route">
- <alternatives>
- <option argLabel="add" shortName="a" longName="add"/>
- <option argLabel="del" shortName="d" longName="del"/>
- </alternatives>
- <argument argLabel="target"/>
- <argument argLabel="device"/>
- <optional><argument argLabel="gateway"/></optional>
- </sequence>
- </syntax>
- <syntax alias="rpcinfo">
- <argument argLabel="host" description="Probe a remote host's portmapper service"/>
- </syntax>
- <syntax alias="tcpinout">
- <argument argLabel="localPort" description="Run tcpinout in server mode"/>
- <sequence description="Run tcpinout in client mode">
- <argument argLabel="host"/>
- <argument argLabel="port"/>
- </sequence>
- </syntax>
- <syntax alias="tftp">
- <optional description="Run an interactive TFTP client"><argument argLabel="host"/></optional>
- <sequence description="Do a non-interactive TFTP 'get' or 'put'">
- <alternatives>
- <option argLabel="get" longName="get"/>
- <option argLabel="put" longName="put"/>
- </alternatives>
- <argument argLabel="host"/>
- <argument argLabel="filename"/>
- </sequence>
- </syntax>
- <syntax alias="wlanctl">
- <sequence description="Set the ESSID for a WLan device">
- <option argLabel="setEssid" longName="setessid"/>
- <argument argLabel="device"/>
- <argument argLabel="value"/>
- </sequence>
- </syntax>
- <syntax alias="wget">
- <sequence description="Fetch the contents of one or more URLs">
- <optional><option argLabel="debug" shortName="d" longName="debug"/></optional>
- <repeat minCount="1"><argument argLabel="url"/></repeat>
- </sequence>
- </syntax>
- </extension>
-
- <extension point="org.jnode.security.permissions">
- <permission class="java.net.SocketPermission" name="*" actions="connect,resolve"/>
- <permission class="java.net.SocketPermission" name="*:1024-" actions="listen,accept"/>
- <permission class="java.net.SocketPermission" name="*:53" actions="resolve,listen,connect"/>
- <permission class="java.net.SocketPermission" name="*:80" actions="resolve,listen,connect"/>
- <permission class="java.net.SocketPermission" name="*:8080" actions="resolve,listen,connect"/>
- <permission class="java.util.PropertyPermission" name="dns.server" actions="read"/>
- <permission class="java.util.PropertyPermission" name="dns.search" actions="read"/>
- <permission class="java.util.PropertyPermission" name="user.dir" actions="read"/>
- <permission class="org.jnode.net.NetPermission" name="bootpClient"/>
- <permission class="org.jnode.net.NetPermission" name="dhcpClient"/>
- <permission class="org.jnode.net.NetPermission" name="wget"/>
- <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
- </extension>
-</plugin>
Deleted: trunk/cli/coreutils/src/commands/org/jnode/command/net/ArpCommand.java
===================================================================
--- trunk/cli/coreutils/src/commands/org/jnode/command/net/ArpCommand.java 2009-04-29 21:59:13 UTC (rev 5363)
+++ trunk/cli/coreutils/src/commands/org/jnode/command/net/ArpCommand.java 2009-04-29 22:01:19 UTC (rev 5364)
@@ -1,72 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2003-2009 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.command.net;
-
-import java.io.PrintWriter;
-
-import org.jnode.driver.net.NetworkException;
-import org.jnode.net.NoSuchProtocolException;
-import org.jnode.net.arp.ARPCacheEntry;
-import org.jnode.net.arp.ARPNetworkLayer;
-import org.jnode.net.ethernet.EthernetConstants;
-import org.jnode.net.util.NetUtils;
-import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.syntax.Argument;
-import org.jnode.shell.syntax.FlagArgument;
-
-/**
- * @author epr
- */
-public class ArpCommand extends AbstractCommand {
-
- private static final String help_clear = "if set, clear the ARP cache";
- private static final String help_super = "print or clear the ARP cache";
- private static final String str_cleared = "Cleared the ARP cache";
-
- private final FlagArgument argClear;
-
- public ArpCommand() {
- super(help_super);
- argClear = new FlagArgument("clear", Argument.OPTIONAL, help_super);
- registerArguments(argClear);
- }
-
- /**
- * Execute this command
- */
- public static void main(String[] args) throws Exception {
- new ArpCommand().execute(args);
- }
-
- public void execute() throws NoSuchProtocolException, NetworkException {
- ARPNetworkLayer arp = (ARPNetworkLayer)
- NetUtils.getNLM().getNetworkLayer(EthernetConstants.ETH_P_ARP);
- PrintWriter out = getOutput().getPrintWriter();
- if (argClear.isSet()) {
- arp.getCache().clear();
- out.println(str_cleared);
- } else {
- for (ARPCacheEntry entry : arp.getCache().entries()) {
- out.println(entry);
- }
- }
- }
-}
Deleted: trunk/cli/coreutils/src/commands/org/jnode/command/net/BootpCommand.java
===================================================================
--- trunk/cli/coreutils/src/commands/org/jnode/command/net/BootpCommand.java 2009-04-29 21:59:13 UTC (rev 5363)
+++ trunk/cli/coreutils/src/commands/org/jnode/command/net/BootpCommand.java 2009-04-29 22:01:19 UTC (rev 5364)
@@ -1,62 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2003-2009 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.command.net;
-
-import javax.naming.NameNotFoundException;
-
-import org.jnode.driver.Device;
-import org.jnode.driver.net.NetDeviceAPI;
-import org.jnode.driver.net.NetworkException;
-import org.jnode.naming.InitialNaming;
-import org.jnode.net.ipv4.config.IPv4ConfigurationService;
-import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.syntax.Argument;
-import org.jnode.shell.syntax.DeviceArgument;
-
-/**
- * @author epr
- */
-public class BootpCommand extends AbstractCommand {
-
- private static final String help_device = "";
- private static final String help_super = "Configure a network interface using BOOTP";
- private static final String fmt_config = "Trying to configure %s...%n";
-
- private final DeviceArgument argDevice;
-
- public BootpCommand() {
- super(help_super);
- argDevice = new DeviceArgument("device", Argument.MANDATORY, help_device, NetDeviceAPI.class);
- registerArguments(argDevice);
- }
-
- public static void main(String[] args) throws Exception {
- new BootpCommand().execute(args);
- }
-
- public void execute() throws NameNotFoundException, NetworkException {
- final Device dev = argDevice.getValue();
- getOutput().getPrintWriter().format(fmt_config, dev.getId());
- final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
- cfg.configureDeviceBootp(dev, true);
- }
-
-}
Deleted: trunk/cli/coreutils/src/commands/org/jnode/command/net/DhcpCommand.java
===================================================================
--- trunk/cli/coreutils/src/commands/org/jnode/command/net/DhcpCommand.java 2009-04-29 21:59:13 UTC (rev 5363)
+++ trunk/cli/coreutils/src/commands/org/jnode/command/net/DhcpCommand.java 2009-04-29 22:01:19 UTC (rev 5364)
@@ -1,90 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2003-2009 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.command.net;
-
-import java.io.PrintWriter;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import javax.naming.NameNotFoundException;
-
-import org.jnode.driver.ApiNotFoundException;
-import org.jnode.driver.Device;
-import org.jnode.driver.DeviceManager;
-import org.jnode.driver.DeviceNotFoundException;
-import org.jnode.driver.net.NetDeviceAPI;
-import org.jnode.driver.net.NetworkException;
-import org.jnode.naming.InitialNaming;
-import org.jnode.net.ProtocolAddressInfo;
-import org.jnode.net.ethernet.EthernetConstants;
-import org.jnode.net.ipv4.config.IPv4ConfigurationService;
-import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.syntax.Argument;
-import org.jnode.shell.syntax.DeviceArgument;
-
-/**
- * @author markhale
- * @author cr...@jn...
- */
-public class DhcpCommand extends AbstractCommand {
-
- private static final String help_device = "the network interface device to be configured";
- private static final String help_super = "Configure a network interface using DHCP";
- private static final String err_loopback = "The loopback network device is not bound to IP address 127.0.0.1%n" +
- "Run 'ifconfig loopback 127.0.0.1 255.255.255.255' to fix this.%n";
- private static final String fmt_config = "Configuring network device %s...%n";
-
- private final DeviceArgument argDevice;
-
- public DhcpCommand() {
- super(help_super);
- argDevice = new DeviceArgument("device", Argument.MANDATORY, help_device, NetDeviceAPI.class);
- registerArguments(argDevice);
- }
-
- public static void main(String[] args) throws Exception {
- new DhcpCommand().execute(args);
- }
-
- public void execute() throws DeviceNotFoundException, NameNotFoundException, ApiNotFoundException,
- UnknownHostException, NetworkException {
- final Device dev = argDevice.getValue();
-
- // The DHCP network configuration process will attempt to configure the DNS. This will only work if
- // the IP address 127.0.0.1 is bound to the loopback network interface. And if there isn't, JNode's
- // network layer is left in a state that will require a reboot to unjam it (AFAIK).
- //
- // So, check that loopback is correctly bound ...
- Device loopback = (InitialNaming.lookup(DeviceManager.NAME)).getDevice("loopback");
- NetDeviceAPI api = loopback.getAPI(NetDeviceAPI.class);
- ProtocolAddressInfo info = api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
- if (info == null || !info.contains(InetAddress.getByAddress(new byte[]{127, 0, 0, 1}))) {
- PrintWriter err = getError().getPrintWriter();
- err.format(err_loopback);
- exit(1);
- }
-
- // Now it should be safe to do the DHCP configuration.
- getOutput().getPrintWriter().format(fmt_config, dev.getId());
- final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
- cfg.configureDeviceDhcp(dev, true);
- }
-}
Deleted: trunk/cli/coreutils/src/commands/org/jnode/command/net/IfconfigCommand.java
===================================================================
--- trunk/cli/coreutils/src/commands/org/jnode/command/net/IfconfigCommand.java 2009-04-29 21:59:13 UTC (rev 5363)
+++ trunk/cli/coreutils/src/commands/org/jnode/command/net/IfconfigCommand.java 2009-04-29 22:01:19 UTC (rev 5364)
@@ -1,107 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2003-2009 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.command.net;
-
-import java.io.PrintWriter;
-
-import javax.naming.NameNotFoundException;
-
-import org.jnode.driver.ApiNotFoundException;
-import org.jnode.driver.Device;
-import org.jnode.driver.DeviceManager;
-import org.jnode.driver.net.NetDeviceAPI;
-import org.jnode.driver.net.NetworkException;
-import org.jnode.naming.InitialNaming;
-import org.jnode.net.ethernet.EthernetConstants;
-import org.jnode.net.ipv4.IPv4Address;
-import org.jnode.net.ipv4.config.IPv4ConfigurationService;
-import org.jnode.net.syntax.IPv4AddressArgument;
-import org.jnode.shell.AbstractCommand;
-import org.jnode.shell.syntax.Arg...
[truncated message content] |
|
From: <chr...@us...> - 2009-04-29 22:41:01
|
Revision: 5366
http://jnode.svn.sourceforge.net/jnode/?rev=5366&view=rev
Author: chrisboertien
Date: 2009-04-29 22:40:55 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Added an IOUtils class to org.jnode.command.util
Mostly some convenience methods to make dealing with streams a little easier.
Signed-off-by: chrisboertien <chr...@gm...>
Added Paths:
-----------
trunk/coreutils/
trunk/coreutils/src/
trunk/coreutils/src/commands/
trunk/coreutils/src/commands/org/
trunk/coreutils/src/commands/org/jnode/
trunk/coreutils/src/commands/org/jnode/command/
trunk/coreutils/src/commands/org/jnode/command/util/
trunk/coreutils/src/commands/org/jnode/command/util/IOUtils.java
Added: trunk/coreutils/src/commands/org/jnode/command/util/IOUtils.java
===================================================================
--- trunk/coreutils/src/commands/org/jnode/command/util/IOUtils.java (rev 0)
+++ trunk/coreutils/src/commands/org/jnode/command/util/IOUtils.java 2009-04-29 22:40:55 UTC (rev 5366)
@@ -0,0 +1,418 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.command.util;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.Flushable;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Reader;
+
+/**
+ * Convenience IO methods.
+ *
+ * @author chris boertien
+ */
+public final class IOUtils {
+
+ private static final int BUFFER_SIZE = 4096;
+
+ private static final String ex_null_param = "A required paramater is null";
+
+ /**
+ * Call the close method of a list of Closeable objects.
+ *
+ * This will not throw a NullPointerException if any of the objects are null.
+ *
+ * This is a convenience method that traps the exception from various
+ * stream close() methods.
+ *
+ * @param objs one or more Closeable objects.
+ */
+ public static void close(Closeable... objs) {
+ close(false, objs);
+ }
+
+ /**
+ * Call the close method of a list of Closeable objects.
+ *
+ * If the flush paramater is set to true, and an object implements
+ * the Flushable interface, then the flush method will be called before
+ * the close method is called.
+ *
+ * This will not throw a NullPointerException if any of the objects are null.
+ *
+ * This will not throw an IOException if either the close or flush methods throw
+ * an IOException.
+ *
+ * If calling flush causes an IOException, close will still be called.
+ *
+ * @param flush if true, check if the object is Flushable
+ * @param objs one or more Closeable objects
+ */
+ public static void close(boolean flush, Closeable... objs) {
+ for (Closeable obj : objs) {
+ if (obj != null) {
+ if (flush && (obj instanceof Flushable)) {
+ try {
+ ((Flushable) obj).flush();
+ } catch (IOException _) {
+ // ignore
+ }
+ }
+ try {
+ obj.close();
+ } catch (IOException _) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * Copies data from an Inputstream to an OutputStream.
+ *
+ * This method allocates a 4096 byte buffer each time it is called.
+ *
+ * At the end of writing, the OutputStream will be flushed, but no streams will be closed.
+ *
+ * @param in the stream to read from
+ * @param out the stream to write to
+ * @param bufferSize the size of buffer to use for the copy
+ * @return the number of bytes read from the input stream
+ * @throws NullPointerException if either in or out are null
+ * @throws IOException if an I/O error occurs
+ */
+ public static long copyStream(InputStream in, OutputStream out) throws IOException {
+ return copyStream(in, out, new byte[BUFFER_SIZE]);
+ }
+
+ /**
+ * Copies data from an Inputstream to an OutputStream.
+ *
+ * This method allocates a buffer of 'bufferSize' when it is called.
+ *
+ * At the end of writing, the OutputStream will be flushed, but no streams will be closed.
+ *
+ * @param in the stream to read from
+ * @param out the stream to write to
+ * @param bufferSize the size of buffer to use for the copy
+ * @return the number of bytes read from the input stream
+ * @throws NullPointerException if either in or out are null
+ * @throws IOException if an I/O error occurs
+ */
+ public static long copyStream(InputStream in, OutputStream out, int bufferSize) throws IOException {
+ return copyStream(in, out, new byte[bufferSize]);
+ }
+
+ /**
+ * Copies data from an InputStream to an OutputStream
+ *
+ * If copying multiple streams, this method may be prefered to the others
+ * as a way to use the same buffer instead of allocating a new buffer on each call.
+ *
+ * At the end of writing, the OutputStream will be flushed, but no streams will be closed.
+ *
+ * @param in the stream to read from
+ * @param out the stream to write to
+ * @param buffer a pre-allocated buffer to use.
+ * @return the number of bytes read from the input stream
+ * @throws NullPointerException if either in, out or buffer are null
+ * @throws IOException if an I/O error occurs
+ */
+ public static long copyStream(InputStream in, OutputStream out, byte[] buffer) throws IOException {
+ checkNull(in, out, buffer);
+
+ long totalBytes = 0;
+ int len = 0;
+ while ((len = in.read(buffer)) > 0) {
+ out.write(buffer, 0, len);
+ totalBytes += len;
+ }
+ out.flush();
+ return totalBytes;
+ }
+
+ /**
+ * Opens an InputStream on a file for reading.
+ *
+ * This method will not throw a FileNotFoundException or SecurityException like
+ * the FileInputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @return an InputStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ */
+ public static InputStream openInputStream(File file) {
+ return openInputStream(file, false);
+ }
+
+ /**
+ * Opens an InputStream on a file for reading.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileInputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @param buffer if true, wrap the stream in a buffered stream
+ * @return an InpustStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ */
+ public static InputStream openInputStream(File file, boolean buffer) {
+ return openInputStream(file, buffer, BUFFER_SIZE);
+ }
+
+ /**
+ * Opens an InputStream on a file for reading.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileInputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @param buffer if true, wrap the stream in a buffered stream
+ * @param bufferSize the buffer size to use if buffer is true
+ * @return an InpustStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ * @throws IllegalArgumentException if bufferSize < 0
+ */
+ public static InputStream openInputStream(File file, boolean buffer, int bufferSize) {
+ checkNull(file);
+
+ try {
+ InputStream in = new FileInputStream(file);
+ if (buffer) {
+ in = new BufferedInputStream(in, bufferSize);
+ }
+ return in;
+ } catch (FileNotFoundException e) {
+ return null;
+ } catch (SecurityException e2) {
+ return null;
+ }
+ }
+
+ /**
+ * Opens an OutputStream on a file for writing.
+ *
+ * If the file exists and has content, it will be overwritten. That is to say the append
+ * paramater will be false.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileOutputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @return an OutputStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ */
+ public static OutputStream openOutputStream(File file) {
+ return openOutputStream(file, false, 0);
+ }
+
+ /**
+ * Opens an OutputStream on a file for writing.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileOutputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @param append if true, open the stream in append mode
+ * @return an OutputStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ */
+ public static OutputStream openOutputstream(File file, boolean append) {
+ return openOutputStream(file, append, 0);
+ }
+
+ /**
+ * Opens an OutputStream on a file for writing.
+ *
+ * The stream will be wrapped in a buffered stream if bufferSize is > 0.
+ *
+ * If the file exists and has content, it will be overwritten. That is to say the append
+ * paramater will be false.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileOutputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @param bufferSize if this is > 0, use it as the buffer size for the stream
+ * @return an OutputStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ * @throws IllegalArgumentException if bufferSize < 0
+ */
+ public static OutputStream openOutputStream(File file, int bufferSize) {
+ return openOutputStream(file, false, bufferSize);
+ }
+
+ /**
+ * Opens an OutputStream on a file for writing.
+ *
+ * The stream will be wrapped in a buffered stream if bufferSize is > 0.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileOutputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @param bufferSize if this is > 0, use it as the buffer size for the stream
+ * @param append if true, open the stream in append mode
+ * @return an OutputStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ * @throws IllegalArgumentException if bufferSize < 0
+ */
+ public static OutputStream openOutputStream(File file, boolean append, int bufferSize) {
+ checkNull(file);
+
+ try {
+ OutputStream out = new FileOutputStream(file, append);
+
+ if (bufferSize > 0) {
+ out = new BufferedOutputStream(out, bufferSize);
+ }
+ return out;
+ } catch (FileNotFoundException e) {
+ return null;
+ } catch (SecurityException e2) {
+ return null;
+ }
+ }
+
+ /**
+ * Prompt the user with a question, asking for a yes or no response.
+ *
+ * The default response if none is given will be 'yes'
+ *
+ * @param in the reader to read user input from.
+ * @param out the writer to send the prompt to the user
+ * @param str the prompt to send to the user
+ * @return true if the user said yes, false if no
+ */
+ public static boolean promptYesOrNo(Reader in, PrintWriter out, String prompt) {
+ return promptYesOrNo(in, out, prompt, true);
+ }
+
+ /**
+ * Prompt the user with a question, asking for a yes or no response.
+ *
+ * If out is not attached to a terminal, then the user will not see the prompt
+ *
+ * If in is not attached to a terminal, then this method has undefined behavior.
+ *
+ * If the user inputs an answer that does not being with an 'n', 'N', 'y' or 'Y'
+ * then it will prompt the user again. If something causes this loop to execute
+ * indefinetly, it has limited loop iterations. If this loop cap is reached, the
+ * method will return false.
+ *
+ * If the user inputs nothing, then the defaultChoice is used.
+ *
+ * If the Reader is not a BufferedReader, then it will be wrapped in one.
+ *
+ * @param in the reader to read user input from.
+ * @param out the writer to send the prompt to the user
+ * @param str the prompt to send to the user
+ * @param defaultChoice if the user inputs no reply, this value is returned
+ * @return true if the user said yes, false if no
+ * @throws NullPointerException if in, out or str are null
+ */
+ public static boolean promptYesOrNo(Reader in, PrintWriter out, String prompt, boolean defaultChoice) {
+ String input;
+
+ // put a cap on the loops so it doesn't become an infinite loop
+ // this can happen if Reader is not attached to a tty
+ for (int i = 0; i < 10; i++) {
+ input = prompt(in, out, prompt);
+
+ if (input == null) {
+ return false;
+ }
+
+ if (input.length() == 0) {
+ return defaultChoice;
+ }
+
+ switch(input.charAt(0)) {
+ case 'y' :
+ case 'Y' :
+ return true;
+ case 'n' :
+ case 'N' :
+ return false;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Prompt the user with a question and capture the response.
+ *
+ * If out is not attached to a terminal, then the user will not see the prompt
+ *
+ * If in is not attached to a terminal, then this method has undefined behavior.
+ *
+ * If the Reader is not a BufferedReader, then it will be wrapped in one.
+ *
+ * @param in the reader to read user input from.
+ * @param out the writer to send the prompt to the user
+ * @param str the prompt to send to the user
+ * @return the string captured from the user, or null if an I/O error occurred.
+ * @throws NullPointerException if in, out or str are null
+ */
+ public static String prompt(Reader in, PrintWriter out, String prompt) {
+ checkNull(in, out, prompt);
+
+ String input;
+ BufferedReader reader;
+
+ if (in instanceof BufferedReader) {
+ reader = (BufferedReader) in;
+ } else {
+ reader = new BufferedReader(in);
+ }
+
+ out.print(prompt);
+ try {
+ input = reader.readLine();
+ } catch (IOException e) {
+ return null;
+ } finally {
+ out.println();
+ }
+
+ return input;
+ }
+
+ /**
+ * Check for null objects in a list of objects.
+ */
+ private static void checkNull(Object... objs) {
+ for(Object obj : objs) {
+ if (obj == null) throw new NullPointerException(ex_null_param);
+ }
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-04-29 22:41:42
|
Revision: 5367
http://jnode.svn.sourceforge.net/jnode/?rev=5367&view=rev
Author: chrisboertien
Date: 2009-04-29 22:41:40 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
du command implementation
Submitted-by: Alexander Kerner
Signed-off-by: chrisboertien <chr...@gm...>
Modified Paths:
--------------
trunk/cli/descriptors/org.jnode.command.file.xml
trunk/cli/descriptors/org.jnode.command.util.xml
trunk/cli/src/commands/org/jnode/command/file/FindCommand.java
trunk/cli/src/commands/org/jnode/command/system/RunCommand.java
trunk/cli/src/commands/org/jnode/command/util/AbstractDirectoryWalker.java
Added Paths:
-----------
trunk/cli/src/commands/org/jnode/command/file/DuCommand.java
trunk/cli/src/commands/org/jnode/command/util/IOUtils.java
Removed Paths:
-------------
trunk/coreutils/src/commands/org/jnode/command/util/IOUtils.java
Modified: trunk/cli/descriptors/org.jnode.command.file.xml
===================================================================
--- trunk/cli/descriptors/org.jnode.command.file.xml 2009-04-29 22:40:55 UTC (rev 5366)
+++ trunk/cli/descriptors/org.jnode.command.file.xml 2009-04-29 22:41:40 UTC (rev 5367)
@@ -29,6 +29,7 @@
<alias name="del" class="org.jnode.command.file.DeleteCommand"/>
<alias name="df" class="org.jnode.command.file.DFCommand"/>
<alias name="dir" class="org.jnode.command.file.DirCommand"/>
+ <alias name="du" class="org.jnode.command.file.DuCommand"/>
<alias name="find" class="org.jnode.command.file.FindCommand"/>
<alias name="grep" class="org.jnode.command.file.GrepCommand"/>
<alias name="head" class="org.jnode.command.file.HeadCommand"/>
@@ -98,10 +99,22 @@
<empty description="list the current directory"/>
<argument argLabel="path" description="list a file or directory"/>
</syntax>
+ <syntax alias="du">
+ <sequence description="print file sizes">
+ <repeat minCount="0">
+ <argument argLabel="directory" description="directory to start printing sizes recursively"/>
+ </repeat>
+ <optionSet>
+ <option argLabel="sum" shortName="s" longName="summarize"/>
+ <option argLabel="all" shortName="a" longName="all"/>
+ <option argLabel="human-readable" shortName="h" longName="human-readable"/>
+ </optionSet>
+ </sequence>
+ </syntax>
<syntax alias="find">
<sequence description="find files or directories">
<repeat minCount="0">
- <argument argLabel="directory" description="directory to start searching from"/>
+ <argument argLabel="directory"/>
</repeat>
<optionSet>
<option argLabel="type" shortName="t" longName="type"/>
Modified: trunk/cli/descriptors/org.jnode.command.util.xml
===================================================================
--- trunk/cli/descriptors/org.jnode.command.util.xml 2009-04-29 22:40:55 UTC (rev 5366)
+++ trunk/cli/descriptors/org.jnode.command.util.xml 2009-04-29 22:41:40 UTC (rev 5367)
@@ -6,7 +6,11 @@
version="@VERSION@"
provider-name="@PROVIDER@"
license-name="lgpl">
-
+
+ <requires>
+ <import plugin="org.jnode.shell"/>
+ </requires>
+
<runtime>
<library name="jnode-cli.jar">
<export name="org.jnode.command.util.*" />
Added: trunk/cli/src/commands/org/jnode/command/file/DuCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/file/DuCommand.java (rev 0)
+++ trunk/cli/src/commands/org/jnode/command/file/DuCommand.java 2009-04-29 22:41:40 UTC (rev 5367)
@@ -0,0 +1,196 @@
+/*
+ * $Id: CdCommand.java 4975 2009-02-02 08:30:52Z lsantha $
+ *
+ * Copyright (C) 2003-2009 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.command.file;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
+import java.util.Map.Entry;
+
+import org.jnode.command.util.AbstractDirectoryWalker;
+import org.jnode.shell.AbstractCommand;
+import org.jnode.shell.syntax.Argument;
+import org.jnode.shell.syntax.FileArgument;
+import org.jnode.shell.syntax.FlagArgument;
+import org.jnode.util.NumberUtils;
+
+/*
+ * @author Alexander Kerner
+ */
+public class DuCommand extends AbstractCommand {
+
+ private static final String err_perm = "Permission denied for '%s'%n";
+
+ private abstract class Walker extends AbstractDirectoryWalker {
+
+ protected final TreeMap<File, Long> map = new TreeMap<File, Long>();
+ protected final boolean humanReadable;
+
+ Walker(boolean humanReadable) {
+ this.humanReadable = humanReadable;
+ }
+
+ @Override
+ public void handleDir(File file) {
+ handleAll(file);
+ }
+
+ @Override
+ public void handleFile(File file) {
+ handleAll(file);
+ }
+
+ @Override
+ protected void handleRestrictedFile(File file) throws IOException {
+ err.format(err_perm, file);
+ }
+
+ private void handleAll(File file) {
+ map.put(file, file.length());
+ }
+
+ protected TreeMap<File, Long> summariseIt(TreeMap<File, Long> map) {
+ TreeMap<File, Long> result = new TreeMap<File, Long>();
+ NavigableMap<File, Long> navMap = map.descendingMap();
+ Long tmpSize = 0L;
+ while (navMap.size() != 0) {
+ Entry<File, Long> e = navMap.pollFirstEntry();
+ File key = e.getKey();
+ Long value = e.getValue();
+ tmpSize += key.length();
+
+ if (key.isFile()) {
+ result.put(key, value);
+ } else if (key.isDirectory()) {
+ result.put(key, tmpSize);
+ } else {
+ // ignore unknown file type
+ }
+ }
+ return result;
+ }
+ }
+
+ private class AllWalker extends Walker {
+
+ AllWalker(boolean humanReadable) {
+ super(humanReadable);
+ }
+
+ @Override
+ protected void lastAction(boolean wasCancelled) {
+ Map<File, Long> summarisedMap = summariseIt(map);
+ for (Entry<File, Long> e : summarisedMap.entrySet()) {
+ if(humanReadable)
+ out.println(NumberUtils.toBinaryByte(e.getValue()) + "\t" + e.getKey());
+ else
+ out.println(e.getValue() + "\t" + e.getKey());
+ }
+ }
+ }
+
+ private class OnlyDirsWalker extends Walker {
+
+ OnlyDirsWalker(boolean humanReadable) {
+ super(humanReadable);
+ }
+
+ @Override
+ protected void lastAction(boolean wasCancelled) {
+ Map<File, Long> summarisedMap = summariseIt(map);
+ for (Entry<File, Long> e : summarisedMap.entrySet()) {
+ if (e.getKey().isDirectory()) {
+ if(humanReadable)
+ out.println(NumberUtils.toBinaryByte(e.getValue()) + "\t" + e.getKey());
+ else
+ out.println(e.getValue() + "\t" + e.getKey());
+ }
+ }
+ }
+ }
+
+ private class TotalWalker extends Walker {
+
+ TotalWalker(boolean humanReadable) {
+ super(humanReadable);
+ }
+
+ @Override
+ protected void lastAction(boolean wasCancelled) {
+ TreeMap<File, Long> summarisedMap = summariseIt(map);
+ Entry<File, Long> e = summarisedMap.firstEntry();
+ if(humanReadable)
+ out.println(NumberUtils.toBinaryByte(e.getValue()) + "\t" + e.getKey());
+ else
+ out.println(e.getValue() + "\t" + e.getKey());
+
+ }
+ }
+
+ private PrintWriter out;
+ private PrintWriter err;
+
+ private static final String HELP_TOTAL = "display only a total for each argument";
+ private static final String HELP_ALL = "write counts for all files, not just directories";
+ private static final String HELP_SUPER = "print file sizes";
+ private static final String HELP_DIR = "directory to start printing sizes";
+ private static final String HELP_HUMAN_READABLE = "print sizes in human readable format (e.g., 1K 234M 2G)";
+
+ private final FlagArgument totalArg;
+ private final FlagArgument allArg;
+ private final FileArgument dirArg;
+ private final FlagArgument humanReadableArg;
+
+ public DuCommand() {
+ super(HELP_SUPER);
+ totalArg = new FlagArgument("sum", Argument.OPTIONAL, HELP_TOTAL);
+ allArg = new FlagArgument("all", Argument.OPTIONAL, HELP_ALL);
+ dirArg = new FileArgument("directory", Argument.OPTIONAL | Argument.MULTIPLE, HELP_DIR);
+ humanReadableArg = new FlagArgument("human-readable", Argument.OPTIONAL, HELP_HUMAN_READABLE);
+ registerArguments(totalArg, allArg, humanReadableArg, dirArg );
+ }
+
+ public static void main(String[] args) throws IOException {
+ new DuCommand().execute();
+ }
+
+ public void execute() throws IOException {
+ out = getOutput().getPrintWriter();
+ err = getError().getPrintWriter();
+ Walker walker = null;
+ if (totalArg.isSet()) {
+ walker = new TotalWalker(humanReadableArg.isSet());
+ } else if (allArg.isSet()) {
+ walker = new AllWalker(humanReadableArg.isSet());
+ } else {
+ walker = new OnlyDirsWalker(humanReadableArg.isSet());
+ }
+
+ if (dirArg.isSet()) {
+ walker.walk(dirArg.getValues());
+ } else {
+ walker.walk(new File(System.getProperty("user.dir")));
+ }
+ }
+}
+
Modified: trunk/cli/src/commands/org/jnode/command/file/FindCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/file/FindCommand.java 2009-04-29 22:40:55 UTC (rev 5366)
+++ trunk/cli/src/commands/org/jnode/command/file/FindCommand.java 2009-04-29 22:41:40 UTC (rev 5367)
@@ -94,7 +94,8 @@
public static void main(String[] args) throws IOException {
new FindCommand().execute();
}
-
+
+ @Override
public void execute() throws IOException {
out = getOutput().getPrintWriter();
err = getError().getPrintWriter();
Modified: trunk/cli/src/commands/org/jnode/command/system/RunCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/system/RunCommand.java 2009-04-29 22:40:55 UTC (rev 5366)
+++ trunk/cli/src/commands/org/jnode/command/system/RunCommand.java 2009-04-29 22:41:40 UTC (rev 5367)
@@ -18,7 +18,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-package org.jnode.shell.command;
+package org.jnode.command.system;
import java.io.File;
import java.io.PrintWriter;
Modified: trunk/cli/src/commands/org/jnode/command/util/AbstractDirectoryWalker.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/util/AbstractDirectoryWalker.java 2009-04-29 22:40:55 UTC (rev 5366)
+++ trunk/cli/src/commands/org/jnode/command/util/AbstractDirectoryWalker.java 2009-04-29 22:41:40 UTC (rev 5367)
@@ -147,6 +147,7 @@
while (!cancelled && !stack.isEmpty()) {
handle(stack.pop());
}
+ lastAction(cancelled);
}
}
@@ -253,7 +254,7 @@
/**
* This method is called, when access to a file was denied.<br>
* Default implementation will rise a <code>IOException</code> instead of
- * <code>SecurityException</code>. Maybe overridden by extending classes to
+ * <code>SecurityException</code>. May be overridden by extending classes to
* do something else.
*
* @param file <code>File</code>-object, to which access was restricted.
@@ -265,7 +266,7 @@
/**
* This method is called, when walking is about to start.<br>
- * By default, it does nothing. Maybe overridden by extending classes to do
+ * By default, it does nothing. May be overridden by extending classes to do
* something else.
*
* @param file <code>File</code>-object, that represents starting dir.
@@ -274,6 +275,15 @@
protected void handleStartingDir(final File file) throws IOException {
// do nothing by default
}
+
+ /**
+ * This method is called, when walking has finished. <br>
+ * By default, it does nothing. May be overridden by extending classes to do something else.
+ * @param wasCancelled true, if directory walking was aborted.
+ */
+ protected void lastAction(boolean wasCancelled){
+ // do nothing by default
+ }
/**
*
Copied: trunk/cli/src/commands/org/jnode/command/util/IOUtils.java (from rev 5366, trunk/coreutils/src/commands/org/jnode/command/util/IOUtils.java)
===================================================================
--- trunk/cli/src/commands/org/jnode/command/util/IOUtils.java (rev 0)
+++ trunk/cli/src/commands/org/jnode/command/util/IOUtils.java 2009-04-29 22:41:40 UTC (rev 5367)
@@ -0,0 +1,418 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2003-2009 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.command.util;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.Flushable;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Reader;
+
+/**
+ * Convenience IO methods.
+ *
+ * @author chris boertien
+ */
+public final class IOUtils {
+
+ private static final int BUFFER_SIZE = 4096;
+
+ private static final String ex_null_param = "A required paramater is null";
+
+ /**
+ * Call the close method of a list of Closeable objects.
+ *
+ * This will not throw a NullPointerException if any of the objects are null.
+ *
+ * This is a convenience method that traps the exception from various
+ * stream close() methods.
+ *
+ * @param objs one or more Closeable objects.
+ */
+ public static void close(Closeable... objs) {
+ close(false, objs);
+ }
+
+ /**
+ * Call the close method of a list of Closeable objects.
+ *
+ * If the flush paramater is set to true, and an object implements
+ * the Flushable interface, then the flush method will be called before
+ * the close method is called.
+ *
+ * This will not throw a NullPointerException if any of the objects are null.
+ *
+ * This will not throw an IOException if either the close or flush methods throw
+ * an IOException.
+ *
+ * If calling flush causes an IOException, close will still be called.
+ *
+ * @param flush if true, check if the object is Flushable
+ * @param objs one or more Closeable objects
+ */
+ public static void close(boolean flush, Closeable... objs) {
+ for (Closeable obj : objs) {
+ if (obj != null) {
+ if (flush && (obj instanceof Flushable)) {
+ try {
+ ((Flushable) obj).flush();
+ } catch (IOException _) {
+ // ignore
+ }
+ }
+ try {
+ obj.close();
+ } catch (IOException _) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * Copies data from an Inputstream to an OutputStream.
+ *
+ * This method allocates a 4096 byte buffer each time it is called.
+ *
+ * At the end of writing, the OutputStream will be flushed, but no streams will be closed.
+ *
+ * @param in the stream to read from
+ * @param out the stream to write to
+ * @param bufferSize the size of buffer to use for the copy
+ * @return the number of bytes read from the input stream
+ * @throws NullPointerException if either in or out are null
+ * @throws IOException if an I/O error occurs
+ */
+ public static long copyStream(InputStream in, OutputStream out) throws IOException {
+ return copyStream(in, out, new byte[BUFFER_SIZE]);
+ }
+
+ /**
+ * Copies data from an Inputstream to an OutputStream.
+ *
+ * This method allocates a buffer of 'bufferSize' when it is called.
+ *
+ * At the end of writing, the OutputStream will be flushed, but no streams will be closed.
+ *
+ * @param in the stream to read from
+ * @param out the stream to write to
+ * @param bufferSize the size of buffer to use for the copy
+ * @return the number of bytes read from the input stream
+ * @throws NullPointerException if either in or out are null
+ * @throws IOException if an I/O error occurs
+ */
+ public static long copyStream(InputStream in, OutputStream out, int bufferSize) throws IOException {
+ return copyStream(in, out, new byte[bufferSize]);
+ }
+
+ /**
+ * Copies data from an InputStream to an OutputStream
+ *
+ * If copying multiple streams, this method may be prefered to the others
+ * as a way to use the same buffer instead of allocating a new buffer on each call.
+ *
+ * At the end of writing, the OutputStream will be flushed, but no streams will be closed.
+ *
+ * @param in the stream to read from
+ * @param out the stream to write to
+ * @param buffer a pre-allocated buffer to use.
+ * @return the number of bytes read from the input stream
+ * @throws NullPointerException if either in, out or buffer are null
+ * @throws IOException if an I/O error occurs
+ */
+ public static long copyStream(InputStream in, OutputStream out, byte[] buffer) throws IOException {
+ checkNull(in, out, buffer);
+
+ long totalBytes = 0;
+ int len = 0;
+ while ((len = in.read(buffer)) > 0) {
+ out.write(buffer, 0, len);
+ totalBytes += len;
+ }
+ out.flush();
+ return totalBytes;
+ }
+
+ /**
+ * Opens an InputStream on a file for reading.
+ *
+ * This method will not throw a FileNotFoundException or SecurityException like
+ * the FileInputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @return an InputStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ */
+ public static InputStream openInputStream(File file) {
+ return openInputStream(file, false);
+ }
+
+ /**
+ * Opens an InputStream on a file for reading.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileInputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @param buffer if true, wrap the stream in a buffered stream
+ * @return an InpustStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ */
+ public static InputStream openInputStream(File file, boolean buffer) {
+ return openInputStream(file, buffer, BUFFER_SIZE);
+ }
+
+ /**
+ * Opens an InputStream on a file for reading.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileInputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @param buffer if true, wrap the stream in a buffered stream
+ * @param bufferSize the buffer size to use if buffer is true
+ * @return an InpustStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ * @throws IllegalArgumentException if bufferSize < 0
+ */
+ public static InputStream openInputStream(File file, boolean buffer, int bufferSize) {
+ checkNull(file);
+
+ try {
+ InputStream in = new FileInputStream(file);
+ if (buffer) {
+ in = new BufferedInputStream(in, bufferSize);
+ }
+ return in;
+ } catch (FileNotFoundException e) {
+ return null;
+ } catch (SecurityException e2) {
+ return null;
+ }
+ }
+
+ /**
+ * Opens an OutputStream on a file for writing.
+ *
+ * If the file exists and has content, it will be overwritten. That is to say the append
+ * paramater will be false.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileOutputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @return an OutputStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ */
+ public static OutputStream openOutputStream(File file) {
+ return openOutputStream(file, false, 0);
+ }
+
+ /**
+ * Opens an OutputStream on a file for writing.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileOutputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @param append if true, open the stream in append mode
+ * @return an OutputStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ */
+ public static OutputStream openOutputstream(File file, boolean append) {
+ return openOutputStream(file, append, 0);
+ }
+
+ /**
+ * Opens an OutputStream on a file for writing.
+ *
+ * The stream will be wrapped in a buffered stream if bufferSize is > 0.
+ *
+ * If the file exists and has content, it will be overwritten. That is to say the append
+ * paramater will be false.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileOutputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @param bufferSize if this is > 0, use it as the buffer size for the stream
+ * @return an OutputStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ * @throws IllegalArgumentException if bufferSize < 0
+ */
+ public static OutputStream openOutputStream(File file, int bufferSize) {
+ return openOutputStream(file, false, bufferSize);
+ }
+
+ /**
+ * Opens an OutputStream on a file for writing.
+ *
+ * The stream will be wrapped in a buffered stream if bufferSize is > 0.
+ *
+ * This method will not throw a FileNotFoundException or a SecurityException like
+ * the FileOutputStream constructor would.
+ *
+ * @param file the file to open a stream on
+ * @param bufferSize if this is > 0, use it as the buffer size for the stream
+ * @param append if true, open the stream in append mode
+ * @return an OutputStream on the file, or null if an exception was thrown
+ * @throws NullPointerException if file is null
+ * @throws IllegalArgumentException if bufferSize < 0
+ */
+ public static OutputStream openOutputStream(File file, boolean append, int bufferSize) {
+ checkNull(file);
+
+ try {
+ OutputStream out = new FileOutputStream(file, append);
+
+ if (bufferSize > 0) {
+ out = new BufferedOutputStream(out, bufferSize);
+ }
+ return out;
+ } catch (FileNotFoundException e) {
+ return null;
+ } catch (SecurityException e2) {
+ return null;
+ }
+ }
+
+ /**
+ * Prompt the user with a question, asking for a yes or no response.
+ *
+ * The default response if none is given will be 'yes'
+ *
+ * @param in the reader to read user input from.
+ * @param out the writer to send the prompt to the user
+ * @param str the prompt to send to the user
+ * @return true if the user said yes, false if no
+ */
+ public static boolean promptYesOrNo(Reader in, PrintWriter out, String prompt) {
+ return promptYesOrNo(in, out, prompt, true);
+ }
+
+ /**
+ * Prompt the user with a question, asking for a yes or no response.
+ *
+ * If out is not attached to a terminal, then the user will not see the prompt
+ *
+ * If in is not attached to a terminal, then this method has undefined behavior.
+ *
+ * If the user inputs an answer that does not being with an 'n', 'N', 'y' or 'Y'
+ * then it will prompt the user again. If something causes this loop to execute
+ * indefinetly, it has limited loop iterations. If this loop cap is reached, the
+ * method will return false.
+ *
+ * If the user inputs nothing, then the defaultChoice is used.
+ *
+ * If the Reader is not a BufferedReader, then it will be wrapped in one.
+ *
+ * @param in the reader to read user input from.
+ * @param out the writer to send the prompt to the user
+ * @param str the prompt to send to the user
+ * @param defaultChoice if the user inputs no reply, this value is returned
+ * @return true if the user said yes, false if no
+ * @throws NullPointerException if in, out or str are null
+ */
+ public static boolean promptYesOrNo(Reader in, PrintWriter out, String prompt, boolean defaultChoice) {
+ String input;
+
+ // put a cap on the loops so it doesn't become an infinite loop
+ // this can happen if Reader is not attached to a tty
+ for (int i = 0; i < 10; i++) {
+ input = prompt(in, out, prompt);
+
+ if (input == null) {
+ return false;
+ }
+
+ if (input.length() == 0) {
+ return defaultChoice;
+ }
+
+ switch(input.charAt(0)) {
+ case 'y' :
+ case 'Y' :
+ return true;
+ case 'n' :
+ case 'N' :
+ return false;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Prompt the user with a question and capture the response.
+ *
+ * If out is not attached to a terminal, then the user will not see the prompt
+ *
+ * If in is not attached to a terminal, then this method has undefined behavior.
+ *
+ * If the Reader is not a BufferedReader, then it will be wrapped in one.
+ *
+ * @param in the reader to read user input from.
+ * @param out the writer to send the prompt to the user
+ * @param str the prompt to send to the user
+ * @return the string captured from the user, or null if an I/O error occurred.
+ * @throws NullPointerException if in, out or str are null
+ */
+ public static String prompt(Reader in, PrintWriter out, String prompt) {
+ checkNull(in, out, prompt);
+
+ String input;
+ BufferedReader reader;
+
+ if (in instanceof BufferedReader) {
+ reader = (BufferedReader) in;
+ } else {
+ reader = new BufferedReader(in);
+ }
+
+ out.print(prompt);
+ try {
+ input = reader.readLine();
+ } catch (IOException e) {
+ return null;
+ } finally {
+ out.println();
+ }
+
+ return input;
+ }
+
+ /**
+ * Check for null objects in a list of objects.
+ */
+ private static void checkNull(Object... objs) {
+ for(Object obj : objs) {
+ if (obj == null) throw new NullPointerException(ex_null_param);
+ }
+ }
+}
Deleted: trunk/coreutils/src/commands/org/jnode/command/util/IOUtils.java
===================================================================
--- trunk/coreutils/src/commands/org/jnode/command/util/IOUtils.java 2009-04-29 22:40:55 UTC (rev 5366)
+++ trunk/coreutils/src/commands/org/jnode/command/util/IOUtils.java 2009-04-29 22:41:40 UTC (rev 5367)
@@ -1,418 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2003-2009 JNode.org
- *
- * This library is free software; you can redistribute it and...
[truncated message content] |
|
From: <ls...@us...> - 2009-04-30 09:18:40
|
Revision: 5370
http://jnode.svn.sourceforge.net/jnode/?rev=5370&view=rev
Author: lsantha
Date: 2009-04-30 09:18:39 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Updated Idea project files and build targets for the cli subproject project.
Modified Paths:
--------------
trunk/JNode.ipr
trunk/all/build.xml
Added Paths:
-----------
trunk/cli/cli.iml
Property Changed:
----------------
trunk/cli/
Modified: trunk/JNode.ipr
===================================================================
--- trunk/JNode.ipr 2009-04-30 04:12:27 UTC (rev 5369)
+++ trunk/JNode.ipr 2009-04-30 09:18:39 UTC (rev 5370)
@@ -358,6 +358,7 @@
<modules>
<module fileurl="file://$PROJECT_DIR$/all/all.iml" filepath="$PROJECT_DIR$/all/all.iml" />
<module fileurl="file://$PROJECT_DIR$/builder/builder.iml" filepath="$PROJECT_DIR$/builder/builder.iml" />
+ <module fileurl="file://$PROJECT_DIR$/cli/cli.iml" filepath="$PROJECT_DIR$/cli/cli.iml" />
<module fileurl="file://$PROJECT_DIR$/core/core.iml" filepath="$PROJECT_DIR$/core/core.iml" />
<module fileurl="file://$PROJECT_DIR$/distr/distr.iml" filepath="$PROJECT_DIR$/distr/distr.iml" />
<module fileurl="file://$PROJECT_DIR$/fs/fs.iml" filepath="$PROJECT_DIR$/fs/fs.iml" />
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2009-04-30 04:12:27 UTC (rev 5369)
+++ trunk/all/build.xml 2009-04-30 09:18:39 UTC (rev 5370)
@@ -629,6 +629,9 @@
<target name="javadoc" description="generate documentation of all java source files">
<jnode.javadoc destdir="${build.dir}/javadoc/full">
<sourcepath>
+ <pathelement location="${root.dir}/builder/src/builder"/>
+ <pathelement location="${root.dir}/builder/src/configure"/>
+ <pathelement location="${root.dir}/cli/src/commands"/>
<pathelement location="${root.dir}/core/src/classlib"/>
<pathelement location="${root.dir}/core/src/classpath/ext"/>
<pathelement location="${root.dir}/core/src/classpath/vm"/>
@@ -767,6 +770,7 @@
<header update="on" headerFile="${root.dir}/all/template/header.txt">
<fileset dir="${root.dir}/builder/src/builder" includes="**/*.java"/>
+ <fileset dir="${root.dir}/cli/src/commands" includes="**/*.java"/>
<fileset dir="${root.dir}/core/src/classpath/ext" includes="**/*.java"/>
<fileset dir="${root.dir}/core/src/classpath/vm" includes="**/*.java"
excludes="gnu/classpath/jdwp/VMFrame.java,
@@ -1060,6 +1064,7 @@
<checkstyle config="jnode_checks.xml">
<fileset dir="../builder/src/builder" includes="**/*.java"/>
<fileset dir="../builder/src/configure" includes="**/*.java"/>
+ <fileset dir="../cli/src/commands" includes="**/*.java"/>
<fileset dir="../core/src/core" includes="**/*.java"/>
<fileset dir="../core/src/driver" includes="**/*.java"/>
<fileset dir="../core/src/test" includes="**/*.java"/>
Property changes on: trunk/cli
___________________________________________________________________
Added: svn:ignore
+ build
Added: trunk/cli/cli.iml
===================================================================
--- trunk/cli/cli.iml (rev 0)
+++ trunk/cli/cli.iml 2009-04-30 09:18:39 UTC (rev 5370)
@@ -0,0 +1,35 @@
+<?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$/build/classes" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/commands" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="shell" />
+ <orderEntry type="module" module-name="core" />
+ <orderEntry type="module" module-name="net" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../core/lib/log4j-1.2.8.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../net/lib/oncrpc.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module" module-name="fs" />
+ </component>
+</module>
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2009-04-30 11:48:34
|
Revision: 5371
http://jnode.svn.sourceforge.net/jnode/?rev=5371&view=rev
Author: lsantha
Date: 2009-04-30 11:48:24 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
More fixes after cli project.
Modified Paths:
--------------
trunk/all/conf/shell-plugin-list.xml
trunk/builder/src/builder/org/jnode/pluginlist/PluginRepository.java
Modified: trunk/all/conf/shell-plugin-list.xml
===================================================================
--- trunk/all/conf/shell-plugin-list.xml 2009-04-30 09:18:39 UTC (rev 5370)
+++ trunk/all/conf/shell-plugin-list.xml 2009-04-30 11:48:24 UTC (rev 5371)
@@ -13,11 +13,8 @@
<plugin id="org.jnode.fs.ramfs"/>
<plugin id="org.jnode.fs.ramfs.def"/>
- <plugin id="org.apache.tools.archive"/>
- <plugin id="org.jnode.command.archive"/>
<plugin id="org.jnode.command.common"/>
- <plugin id="org.jnode.command.file"/>
- <plugin id="org.jnode.command.util"/>
+ <plugin id="org.jnode.command.system"/>
<plugin id="org.jnode.driver.character"/>
<plugin id="org.jnode.driver.console"/>
Modified: trunk/builder/src/builder/org/jnode/pluginlist/PluginRepository.java
===================================================================
--- trunk/builder/src/builder/org/jnode/pluginlist/PluginRepository.java 2009-04-30 09:18:39 UTC (rev 5370)
+++ trunk/builder/src/builder/org/jnode/pluginlist/PluginRepository.java 2009-04-30 11:48:24 UTC (rev 5371)
@@ -122,6 +122,7 @@
selected.clear();
pluginMap.clear();
+ addProject(Main.readProject("cli", this));
addProject(Main.readProject("core", this));
addProject(Main.readProject("gui", this));
addProject(Main.readProject("fs", this));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2009-04-30 12:27:59
|
Revision: 5372
http://jnode.svn.sourceforge.net/jnode/?rev=5372&view=rev
Author: crawley
Date: 2009-04-30 12:27:53 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Added Eclipse project/buildbath for CLI and changes others to make
various JARs visible to CLI via the project references
Modified Paths:
--------------
trunk/core/.classpath
trunk/net/.classpath
Added Paths:
-----------
trunk/cli/.classpath
trunk/cli/.project
Added: trunk/cli/.classpath
===================================================================
--- trunk/cli/.classpath (rev 0)
+++ trunk/cli/.classpath 2009-04-30 12:27:53 UTC (rev 5372)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/commands"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/shell"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/core"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/net"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/fs"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
Added: trunk/cli/.project
===================================================================
--- trunk/cli/.project (rev 0)
+++ trunk/cli/.project 2009-04-30 12:27:53 UTC (rev 5372)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>cli</name>
+ <comment></comment>
+ <projects>
+ <project>core</project>
+ <project>shell</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Modified: trunk/core/.classpath
===================================================================
--- trunk/core/.classpath 2009-04-30 11:48:24 UTC (rev 5371)
+++ trunk/core/.classpath 2009-04-30 12:27:53 UTC (rev 5372)
@@ -12,8 +12,8 @@
<classpathentry excluding="**/.svn/**" kind="src" path="src/driver"/>
<classpathentry excluding="**/.svn/**" kind="src" path="src/test"/>
<classpathentry excluding="**/.svn/**" kind="src" path="src/template"/>
- <classpathentry kind="lib" path="lib/ant.jar"/>
- <classpathentry kind="lib" path="lib/log4j-1.2.8.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/ant.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.8.jar"/>
<classpathentry kind="lib" path="lib/junit-4.5.jar"/>
<classpathentry kind="lib" path="lib/mmtk/mmtk.jar"/>
<classpathentry exported="true" kind="lib" path="lib/asm-1.5.3.jar"/>
Modified: trunk/net/.classpath
===================================================================
--- trunk/net/.classpath 2009-04-30 11:48:24 UTC (rev 5371)
+++ trunk/net/.classpath 2009-04-30 12:27:53 UTC (rev 5372)
@@ -4,7 +4,7 @@
<classpathentry excluding="**/.svn/**" kind="src" path="src/driver"/>
<classpathentry excluding="**/.svn/**" kind="src" path="src/test"/>
<classpathentry kind="src" path="/core"/>
- <classpathentry kind="lib" path="lib/oncrpc.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/oncrpc.jar"/>
<classpathentry kind="src" path="/shell"/>
<classpathentry kind="lib" path="lib/jsch-0.1.24.jar"/>
<classpathentry kind="lib" path="lib/dnsjava-1.6.6.jar" sourcepath="lib/dnsjava-1.6.6-src.zip"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2009-05-01 10:16:28
|
Revision: 5379
http://jnode.svn.sourceforge.net/jnode/?rev=5379&view=rev
Author: crawley
Date: 2009-05-01 10:16:18 +0000 (Fri, 01 May 2009)
Log Message:
-----------
Minor tidyups: imports and unreferenced locals.
Modified Paths:
--------------
trunk/cli/src/commands/org/jnode/command/common/EchoCommand.java
trunk/cli/src/commands/org/jnode/command/common/TimeCommand.java
trunk/core/src/classpath/vm/gnu/java/security/action/GetEnvAction.java
Modified: trunk/cli/src/commands/org/jnode/command/common/EchoCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/common/EchoCommand.java 2009-05-01 09:46:19 UTC (rev 5378)
+++ trunk/cli/src/commands/org/jnode/command/common/EchoCommand.java 2009-05-01 10:16:18 UTC (rev 5379)
@@ -62,5 +62,6 @@
out.print(words[i]);
}
out.println();
+ System.getenv();
}
}
Modified: trunk/cli/src/commands/org/jnode/command/common/TimeCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/common/TimeCommand.java 2009-05-01 09:46:19 UTC (rev 5378)
+++ trunk/cli/src/commands/org/jnode/command/common/TimeCommand.java 2009-05-01 10:16:18 UTC (rev 5379)
@@ -20,14 +20,10 @@
package org.jnode.command.common;
import java.io.PrintWriter;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
import org.jnode.shell.AbstractCommand;
import org.jnode.shell.CommandShell;
import org.jnode.shell.ShellException;
import org.jnode.shell.ShellUtils;
-import org.jnode.shell.io.CommandIO;
import org.jnode.shell.syntax.AliasArgument;
import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.StringArgument;
@@ -63,7 +59,6 @@
public void execute() throws Exception {
PrintWriter out = getOutput().getPrintWriter();
- PrintWriter err = getError().getPrintWriter();
StringBuilder sb = new StringBuilder(Alias.getValue());
for (String arg : Args.getValues()) {
Modified: trunk/core/src/classpath/vm/gnu/java/security/action/GetEnvAction.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/java/security/action/GetEnvAction.java 2009-05-01 09:46:19 UTC (rev 5378)
+++ trunk/core/src/classpath/vm/gnu/java/security/action/GetEnvAction.java 2009-05-01 10:16:18 UTC (rev 5379)
@@ -22,7 +22,6 @@
import java.security.PrivilegedAction;
import java.util.Map;
-import java.util.Properties;
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2009-05-03 06:58:53
|
Revision: 5388
http://jnode.svn.sourceforge.net/jnode/?rev=5388&view=rev
Author: crawley
Date: 2009-05-03 06:58:50 +0000 (Sun, 03 May 2009)
Log Message:
-----------
Added new test.sh script + build-test.xml files (see issue) and moved
the cli / command testspecs to the cli project
Added Paths:
-----------
trunk/cli/build-tests.xml
trunk/cli/src/test/
trunk/cli/src/test/org/
trunk/cli/src/test/org/jnode/
trunk/cli/src/test/org/jnode/test/
trunk/cli/src/test/org/jnode/test/command/
trunk/cli/src/test/org/jnode/test/command/all-tests.xml
trunk/cli/src/test/org/jnode/test/command/common/
trunk/cli/src/test/org/jnode/test/command/common/all-common-tests.xml
trunk/cli/src/test/org/jnode/test/command/common/basename-command-tests.xml
trunk/cli/src/test/org/jnode/test/command/common/dirname-command-tests.xml
trunk/cli/src/test/org/jnode/test/command/common/posix-command-tests.xml
trunk/cli/src/test/org/jnode/test/command/file/
trunk/cli/src/test/org/jnode/test/command/file/all-file-tests.xml
trunk/cli/src/test/org/jnode/test/command/file/wc-command-tests.xml
trunk/shell/build-tests.xml
trunk/test.sh
Added: trunk/cli/build-tests.xml
===================================================================
--- trunk/cli/build-tests.xml (rev 0)
+++ trunk/cli/build-tests.xml 2009-05-03 06:58:50 UTC (rev 5388)
@@ -0,0 +1,24 @@
+<project name="JNode-Shell-Tests" default="all" basedir=".">
+
+ <import file="${basedir}/../all/build.xml"/>
+
+ <target name="help" description="output target descriptions">
+ <echo>
+The main targets (tests) for this build are as follows:
+all Runs all tests for this project
+help Output these messages
+ </echo>
+ </target>
+
+ <target name="all">
+ <java classpathref="cp-test" classname="org.jnode.test.shell.harness.TestHarness">
+ <arg value="-E"/>
+ <arg value="-s"/>
+ <arg value="${root.dir}"/>
+ <arg value="${basedir}/src/test/org/jnode/test/command/all-tests.xml"/>
+ </java>
+ </target>
+
+</project>
+
+
Added: trunk/cli/src/test/org/jnode/test/command/all-tests.xml
===================================================================
--- trunk/cli/src/test/org/jnode/test/command/all-tests.xml (rev 0)
+++ trunk/cli/src/test/org/jnode/test/command/all-tests.xml 2009-05-03 06:58:50 UTC (rev 5388)
@@ -0,0 +1,4 @@
+<testSet title="All command tests">
+ <include setName="common/all-common-tests.xml"/>
+ <include setName="file/all-file-tests.xml"/>
+</testSet>
Added: trunk/cli/src/test/org/jnode/test/command/common/all-common-tests.xml
===================================================================
--- trunk/cli/src/test/org/jnode/test/command/common/all-common-tests.xml (rev 0)
+++ trunk/cli/src/test/org/jnode/test/command/common/all-common-tests.xml 2009-05-03 06:58:50 UTC (rev 5388)
@@ -0,0 +1,5 @@
+<testSet title="All common command tests">
+ <include setName="posix-command-tests.xml"/>
+ <include setName="basename-command-tests.xml"/>
+ <include setName="dirname-command-tests.xml"/>
+</testSet>
Added: trunk/cli/src/test/org/jnode/test/command/common/basename-command-tests.xml
===================================================================
--- trunk/cli/src/test/org/jnode/test/command/common/basename-command-tests.xml (rev 0)
+++ trunk/cli/src/test/org/jnode/test/command/common/basename-command-tests.xml 2009-05-03 06:58:50 UTC (rev 5388)
@@ -0,0 +1,54 @@
+<testSet title="POSIX basename command tests">
+ <testSpec title="basename-1" command="basename"
+ runMode="AS_ALIAS" rc="0">
+ <arg>///</arg>
+ <output>/
+</output>
+ </testSpec>
+ <testSpec title="basename-2" command="basename"
+ runMode="AS_ALIAS" rc="0">
+ <arg>/foo</arg>
+ <output>foo
+</output>
+ </testSpec>
+ <testSpec title="basename-3" command="basename"
+ runMode="AS_ALIAS" rc="0">
+ <arg>/foo/</arg>
+ <output>foo
+</output>
+ </testSpec>
+ <testSpec title="basename-4" command="basename"
+ runMode="AS_ALIAS" rc="0">
+ <arg>/foo/bar</arg>
+ <output>bar
+</output>
+ </testSpec>
+ <testSpec title="basename-5" command="basename"
+ runMode="AS_ALIAS" rc="0">
+ <arg>/foo/bar.c</arg>
+ <arg>.c</arg>
+ <output>bar
+</output>
+ </testSpec>
+ <testSpec title="basename-6" command="basename"
+ runMode="AS_ALIAS" rc="0">
+ <arg>/foo/bar.h</arg>
+ <arg>.c</arg>
+ <output>bar.h
+</output>
+ </testSpec>
+ <testSpec title="basename-7" command="basename"
+ runMode="AS_ALIAS" rc="0">
+ <arg>foo/bar.h/</arg>
+ <arg>.h</arg>
+ <output>bar
+</output>
+ </testSpec>
+ <testSpec title="basename-8" command="basename"
+ runMode="AS_ALIAS" rc="0">
+ <arg>foo/bar.c</arg>
+ <arg>bar.c</arg>
+ <output>bar.c
+</output>
+ </testSpec>
+</testSet>
Added: trunk/cli/src/test/org/jnode/test/command/common/dirname-command-tests.xml
===================================================================
--- trunk/cli/src/test/org/jnode/test/command/common/dirname-command-tests.xml (rev 0)
+++ trunk/cli/src/test/org/jnode/test/command/common/dirname-command-tests.xml 2009-05-03 06:58:50 UTC (rev 5388)
@@ -0,0 +1,44 @@
+<testSet title="POSIX dirname command tests">
+ <testSpec title="dirname-1" command="dirname"
+ runMode="AS_ALIAS" rc="0">
+ <arg>///</arg>
+ <output>/
+</output>
+ </testSpec>
+ <testSpec title="dirname-2" command="dirname"
+ runMode="AS_ALIAS" rc="0">
+ <arg>//</arg>
+ <output>/
+</output>
+ </testSpec>
+ <testSpec title="dirname-3" command="dirname"
+ runMode="AS_ALIAS" rc="0">
+ <arg>/foo/</arg>
+ <output>/
+</output>
+ </testSpec>
+ <testSpec title="dirname-4" command="dirname"
+ runMode="AS_ALIAS" rc="0">
+ <arg>/foo/bar</arg>
+ <output>/foo
+</output>
+ </testSpec>
+ <testSpec title="dirname-5" command="dirname"
+ runMode="AS_ALIAS" rc="0">
+ <arg>/foo/bar/</arg>
+ <output>/foo
+</output>
+ </testSpec>
+ <testSpec title="dirname-6" command="dirname"
+ runMode="AS_ALIAS" rc="0">
+ <arg>foo/bar</arg>
+ <output>foo
+</output>
+ </testSpec>
+ <testSpec title="dirname-7" command="dirname"
+ runMode="AS_ALIAS" rc="0">
+ <arg>foo</arg>
+ <output>.
+</output>
+ </testSpec>
+</testSet>
Added: trunk/cli/src/test/org/jnode/test/command/common/posix-command-tests.xml
===================================================================
--- trunk/cli/src/test/org/jnode/test/command/common/posix-command-tests.xml (rev 0)
+++ trunk/cli/src/test/org/jnode/test/command/common/posix-command-tests.xml 2009-05-03 06:58:50 UTC (rev 5388)
@@ -0,0 +1,53 @@
+<testSet title="POSIX command tests">
+ <plugin id="org.jnode.command.common"/>
+ <testSpec title="true command" command="org.jnode.command.common.TrueCommand"
+ runMode="AS_ALIAS" rc="0"/>
+ <testSpec title="false command" command="org.jnode.command.common.FalseCommand"
+ runMode="AS_ALIAS" rc="1"/>
+ <testSpec title="expr 1 + 1" command="org.jnode.command.common.ExprCommand"
+ runMode="AS_ALIAS" rc="0">
+ <arg>1</arg>
+ <arg>+</arg>
+ <arg>1</arg>
+ <output>2
+</output>
+ </testSpec>
+ <testSpec title="expr 2 * 2" command="org.jnode.command.common.ExprCommand"
+ runMode="AS_ALIAS" rc="0">
+ <arg>2</arg>
+ <arg>*</arg>
+ <arg>2</arg>
+ <output>4
+</output>
+ </testSpec>
+ <testSpec title="expr 4 / 2" command="org.jnode.command.common.ExprCommand"
+ runMode="AS_ALIAS" rc="0">
+ <arg>4</arg>
+ <arg>/</arg>
+ <arg>2</arg>
+ <output>2
+</output>
+ </testSpec>
+ <testSpec title="expr 1 + 2 * 2" command="org.jnode.command.common.ExprCommand"
+ runMode="AS_ALIAS" rc="0">
+ <arg>1</arg>
+ <arg>+</arg>
+ <arg>2</arg>
+ <arg>*</arg>
+ <arg>2</arg>
+ <output>5
+</output>
+ </testSpec>
+ <testSpec title="expr ( 1 + 2 ) * 2" command="org.jnode.command.common.ExprCommand"
+ runMode="AS_ALIAS" rc="0">
+ <arg>(</arg>
+ <arg>1</arg>
+ <arg>+</arg>
+ <arg>2</arg>
+ <arg>)</arg>
+ <arg>*</arg>
+ <arg>2</arg>
+ <output>6
+</output>
+ </testSpec>
+</testSet>
\ No newline at end of file
Added: trunk/cli/src/test/org/jnode/test/command/file/all-file-tests.xml
===================================================================
--- trunk/cli/src/test/org/jnode/test/command/file/all-file-tests.xml (rev 0)
+++ trunk/cli/src/test/org/jnode/test/command/file/all-file-tests.xml 2009-05-03 06:58:50 UTC (rev 5388)
@@ -0,0 +1,3 @@
+<testSet title="All file command tests">
+ <include setName="wc-command-tests.xml"/>
+</testSet>
Added: trunk/cli/src/test/org/jnode/test/command/file/wc-command-tests.xml
===================================================================
--- trunk/cli/src/test/org/jnode/test/command/file/wc-command-tests.xml (rev 0)
+++ trunk/cli/src/test/org/jnode/test/command/file/wc-command-tests.xml 2009-05-03 06:58:50 UTC (rev 5388)
@@ -0,0 +1,78 @@
+<testSet title="POSIX wc command tests">
+ <plugin id="org.jnode.command.file"/>
+ <testSpec title="wc (1)" command="wc" runMode="AS_ALIAS" rc="0">
+ <input>123 456 789 0
+</input>
+ <output> 1 4 14
+</output>
+ </testSpec>
+ <testSpec title="wc (2)" command="wc" runMode="AS_ALIAS" rc="0">
+ <input>1234567890
+1234567890
+123 456 7890
+</input>
+ <output> 3 5 35
+</output>
+ </testSpec>
+ <testSpec title="wc -c (1)" command="wc" runMode="AS_ALIAS" rc="0">
+ <arg>-c</arg>
+ <input>1234567890
+</input>
+ <output>11
+</output>
+ </testSpec>
+ <testSpec title="wc -c (2)" command="wc" runMode="AS_ALIAS" rc="0">
+ <arg>-c</arg>
+ <input>1234567890
+1 2 3 4 5 6 7 8 9 0
+
+</input>
+ <output>32
+</output>
+ </testSpec>
+ <testSpec title="wc -m (1)" command="wc" runMode="AS_ALIAS" rc="0">
+ <arg>-m</arg>
+ <input>1234567890
+</input>
+ <output>11
+</output>
+ </testSpec>
+ <testSpec title="wc -m (2)" command="wc" runMode="AS_ALIAS" rc="0">
+ <arg>-m</arg>
+ <input>1234567890
+1 2 3 4 5 6 7 8 9 0
+
+</input>
+ <output>32
+</output>
+ </testSpec>
+ <testSpec title="wc -l" command="wc" runMode="AS_ALIAS" rc="0">
+ <arg>-l</arg>
+ <input>1
+2
+3
+4
+5
+</input>
+ <output> 5
+</output>
+ </testSpec>
+ <testSpec title="wc -w" command="wc" runMode="AS_ALIAS" rc="0">
+ <arg>-w</arg>
+ <input>1 2 3 4 5 6 7 8 9
+</input>
+ <output> 9
+</output>
+ </testSpec>
+ <testSpec title="wc -L" command="wc" runMode="AS_ALIAS" rc="0">
+ <arg>-L</arg>
+ <input>1234
+12345
+123456789
+123
+1
+</input>
+ <output> 9
+</output>
+ </testSpec>
+</testSet>
Added: trunk/shell/build-tests.xml
===================================================================
--- trunk/shell/build-tests.xml (rev 0)
+++ trunk/shell/build-tests.xml 2009-05-03 06:58:50 UTC (rev 5388)
@@ -0,0 +1,40 @@
+<project name="JNode-Shell-Tests" default="all" basedir=".">
+
+ <import file="${basedir}/../all/build.xml"/>
+
+ <target name="help" description="output target descriptions">
+ <echo>
+The main targets (tests) for this build are as follows:
+all Runs all tests for this project
+bjorne Runs the bjorne interpreter tests
+help Output these messages
+ </echo>
+ </target>
+
+ <target name="bjorne">
+ <java classpathref="cp-test" classname="org.jnode.test.shell.harness.TestHarness">
+ <arg value="-E"/>
+ <arg value="-s"/>
+ <arg value="${root.dir}"/>
+ <arg value="${basedir}/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml"/>
+ </java>
+ <java classpathref="cp-test" classname="org.jnode.test.shell.harness.TestHarness">
+ <arg value="-E"/>
+ <arg value="-s"/>
+ <arg value="${root.dir}"/>
+ <arg value="${basedir}/src/test/org/jnode/test/shell/bjorne/bjorne-builtin-tests.xml"/>
+ </java>
+ </target>
+ <target name="all">
+ <java classpathref="cp-test" classname="org.jnode.test.shell.harness.TestHarness">
+ <arg value="-E" />
+ <arg value="-s" />
+ <arg value="${root.dir}" />
+ <arg value="${basedir}/src/test/org/jnode/test/shell/all-tests.xml" />
+ </java>
+ </target>
+
+
+</project>
+
+
Added: trunk/test.sh
===================================================================
--- trunk/test.sh (rev 0)
+++ trunk/test.sh 2009-05-03 06:58:50 UTC (rev 5388)
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+dir=`dirname $0`
+
+if [ $# -eq 0 ] ; then
+ echo "usage: ./test.sh <project> [ <test> ... ]"
+ echo " where <project> is \"all\" or a JNode component project, and"
+ echo " the <test>s are targets in the respective \"build-tests.xml\" files"
+ exit
+fi
+
+if [ $1 = all ] ; then
+ PROJECTS=`find . -maxdepth 2 -name build-tests.xml -exec dirname {} \;`
+else
+ PROJECTS=$1
+fi
+shift
+
+for PROJECT in $PROJECTS ; do
+ java -Xmx768M -Xms256M -jar $dir/core/lib/ant-launcher.jar \
+ -lib $JAVA_HOME/lib -lib $dir/core/lib \
+ -f $dir/$PROJECT/build-tests.xml $*
+done
+
Property changes on: trunk/test.sh
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2009-05-03 07:06:38
|
Revision: 5389
http://jnode.svn.sourceforge.net/jnode/?rev=5389&view=rev
Author: crawley
Date: 2009-05-03 07:06:37 +0000 (Sun, 03 May 2009)
Log Message:
-----------
This commit changes some key "build.xml" files per issue #3007. If there
are problems, reverting this commit will fix it.
Modified Paths:
--------------
trunk/all/build.xml
trunk/cli/.classpath
trunk/cli/build.xml
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2009-05-03 06:58:50 UTC (rev 5388)
+++ trunk/all/build.xml 2009-05-03 07:06:37 UTC (rev 5389)
@@ -1,5 +1,8 @@
<project name="JNode" default="help" basedir=".">
- <!-- if task is used from this -->
+
+ <property name="root.dir" value="${basedir}/.."/>
+
+ <!-- if task is used from this -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<!-- before including jnode.xml, we must set this property -->
<condition property="memoryMaximumSize" value="1512m" else="768m">
@@ -8,7 +11,7 @@
<echo message="Setting memoryMaximumSize to ${memoryMaximumSize}"/>
<!-- Include antlib -->
- <typedef file="${basedir}/lib/jnode.xml"/>
+ <typedef file="${root.dir}/all/lib/jnode.xml"/>
<!-- JNode version -->
<property name="jnode-ver" value="0.2.9-dev"/>
@@ -18,7 +21,6 @@
<property name="java.source" value="1.6"/>
<property name="java.encoding" value="US-ASCII"/>
- <property name="root.dir" value="${basedir}/.."/>
<property name="build.dir" value="${basedir}/build"/>
<property name="reports.dir" value="${build.dir}/reports"/>
<property name="cdroms.dir" value="${build.dir}/cdroms"/>
@@ -99,10 +101,10 @@
<property name="xmlParserAPIs.jar" value="${root.dir}/builder/pmd/lib/xmlParserAPIs-2.6.2.jar"/>
<!-- lists of plugins to use while booting -->
- <property name="default-plugin-list" value="${basedir}/conf/default-plugin-list.xml"/>
- <property name="full-plugin-list" value="${basedir}/conf/full-plugin-list.xml"/>
- <property name="install-plugin-list" value="${basedir}/conf/install-plugin-list.xml"/>
- <property name="system-plugin-list" value="${basedir}/conf/system-plugin-list.xml"/>
+ <property name="default-plugin-list" value="${root.dir}/all/conf/default-plugin-list.xml"/>
+ <property name="full-plugin-list" value="${root.dir}/all/conf/full-plugin-list.xml"/>
+ <property name="install-plugin-list" value="${root.dir}/all/conf/install-plugin-list.xml"/>
+ <property name="system-plugin-list" value="${root.dir}/all/conf/system-plugin-list.xml"/>
<property name="sources.dist.tar.gz" value="${build.dir}/jnodesources-${jnode-ver}.tar.gz"/>
<property name="jnode-x86.iso" value="${cdroms.dir}/jnode-x86.iso"/>
<property name="jnode-x86-lite.iso" value="${cdroms.dir}/jnode-x86-lite.iso"/>
@@ -120,7 +122,7 @@
<pathelement location="${asm-util.jar}"/>
<pathelement location="${cglib.jar}"/>
<pathelement location="${log4j.jar}"/>
- <pathelement location="${basedir}/conf"/>
+ <pathelement location="${root.dir}/all/conf"/>
<pathelement location="${beanshell.jar}"/>
<pathelement location="${js.jar}"/>
<pathelement location="${oncrpc.jar}"/>
@@ -150,6 +152,19 @@
<pathelement location="${bcel-5.1.jar}"/>
<path refid="cp"/>
</path>
+
+ <path id="cp-test">
+ <pathelement location="${root.dir}/core/build/classes"/>
+ <pathelement location="${root.dir}/distr/build/classes"/>
+ <pathelement location="${root.dir}/fs/build/classes"/>
+ <pathelement location="${root.dir}/shell/build/classes"/>
+ <pathelement location="${root.dir}/net/build/classes"/>
+ <pathelement location="${root.dir}/gui/build/classes"/>
+ <pathelement location="${root.dir}/cli/build/classes"/>
+ <pathelement location="${root.dir}/textui/build/classes"/>
+ <pathelement location="${root.dir}/shell/lib/nanoxml-2.2.3.jar"/>
+ <path refid="cp"/>
+ </path>
<filterset id="descriptors-filter">
@@ -423,10 +438,10 @@
<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="${root.dir}/all/conf/system-plugin-list.xml">
<insert userApplicationsDir="${user.applications.dir}"/>
- <fileset dir="${basedir}/conf">
+ <fileset dir="${root.dir}/all/conf">
<exclude name="system-plugin-list.xml"/>
<include name="*plugin-list.xml"/>
</fileset>
@@ -439,7 +454,7 @@
<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="${root.dir}/all/conf/system-plugin-list.xml">
<fileset dir="${custom.plugin-list.dir}">
<include name="*plugin-list.xml"/>
</fileset>
Modified: trunk/cli/.classpath
===================================================================
--- trunk/cli/.classpath 2009-05-03 06:58:50 UTC (rev 5388)
+++ trunk/cli/.classpath 2009-05-03 07:06:37 UTC (rev 5389)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/commands"/>
+ <classpathentry kind="src" path="src/test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/shell"/>
<classpathentry combineaccessrules="false" kind="src" path="/core"/>
Modified: trunk/cli/build.xml
===================================================================
--- trunk/cli/build.xml 2009-05-03 06:58:50 UTC (rev 5388)
+++ trunk/cli/build.xml 2009-05-03 07:06:37 UTC (rev 5389)
@@ -21,6 +21,10 @@
<target name="prepare">
<mkdir dir="${my-classes.dir}"/>
<jnode.copy-descriptors/>
+ <copy todir="${my-classes.dir}">
+ <fileset dir="${my-src.dir}/commands" excludes="**/*.java,**/package.html"/>
+ <fileset dir="${my-src.dir}/test" excludes="**/*.java,**/package.html"/>
+ </copy>
</target>
<!-- Compile subproject -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|