|
From: <ls...@us...> - 2008-08-24 11:38:16
|
Revision: 4492
http://jnode.svn.sourceforge.net/jnode/?rev=4492&view=rev
Author: lsantha
Date: 2008-08-24 11:38:12 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
Code style fixes.
Modified Paths:
--------------
trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java
trunk/distr/src/emu/org/jnode/emu/Emu.java
trunk/fs/src/fs/org/jnode/fs/ext2/command/FormatExt2Command.java
trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java
Modified: trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java 2008-08-24 10:02:34 UTC (rev 4491)
+++ trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java 2008-08-24 11:38:12 UTC (rev 4492)
@@ -79,7 +79,7 @@
try {
if (readProperties()) {
- for(String file : classesFiles){
+ for (String file : classesFiles) {
File classFile = new File(baseDir, file);
processFile(classFile);
}
@@ -206,7 +206,7 @@
if (classFile.lastModified() < startTime) {
return;
}
-
+
String annotations = getAnnotations(classFile);
if (annotations == null) {
return;
Modified: trunk/distr/src/emu/org/jnode/emu/Emu.java
===================================================================
--- trunk/distr/src/emu/org/jnode/emu/Emu.java 2008-08-24 10:02:34 UTC (rev 4491)
+++ trunk/distr/src/emu/org/jnode/emu/Emu.java 2008-08-24 11:38:12 UTC (rev 4492)
@@ -10,46 +10,42 @@
import javax.naming.NameAlreadyBoundException;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
-
-import org.apache.log4j.Priority;
import org.jnode.naming.InitialNaming;
import org.jnode.naming.NameSpace;
import org.jnode.nanoxml.XMLElement;
-import org.jnode.plugin.ConfigurationElement;
import org.jnode.shell.ShellManager;
-import org.jnode.shell.syntax.PluginSyntaxSpecAdapter;
+import org.jnode.shell.alias.AliasManager;
+import org.jnode.shell.alias.def.DefaultAliasManager;
+import org.jnode.shell.def.DefaultShellManager;
+import org.jnode.shell.help.Help;
+import org.jnode.shell.help.def.DefaultHelp;
+import org.jnode.shell.syntax.DefaultSyntaxManager;
import org.jnode.shell.syntax.SyntaxBundle;
import org.jnode.shell.syntax.SyntaxManager;
-import org.jnode.shell.syntax.DefaultSyntaxManager;
import org.jnode.shell.syntax.SyntaxSpecAdapter;
import org.jnode.shell.syntax.SyntaxSpecLoader;
import org.jnode.shell.syntax.XMLSyntaxSpecAdapter;
-import org.jnode.shell.alias.AliasManager;
-import org.jnode.shell.alias.def.DefaultAliasManager;
-import org.jnode.shell.def.DefaultShellManager;
-import org.jnode.shell.help.Help;
-import org.jnode.shell.help.def.DefaultHelp;
/**
* @author Levente S\u00e1ntha
* @author Stephen Crawley
*/
public abstract class Emu {
- private static final String[] ALL_PROJECTS = new String[] {
+ private static final String[] ALL_PROJECTS = new String[]{
"core", "distr", "fs", "gui", "net", "shell", "sound", "textui"
};
-
- private static final String[] PLUGIN_NAMES = new String[] {
+
+ private static final String[] PLUGIN_NAMES = new String[]{
"org.jnode.shell.command",
"org.jnode.shell.command.driver.console",
"org.jnode.apps.editor",
"org.jnode.apps.edit",
"org.jnode.apps.console",
};
-
+
/**
* Initialize a minimal subset of JNode services to allow us to run JNode commands.
- *
+ *
* @param root the notional JNode sandbox root directory or <code>null</code>.
* @throws EmuException
*/
@@ -81,21 +77,21 @@
return space.keySet();
}
});
-
+
try {
- InitialNaming.bind(DeviceManager.NAME, DeviceManager.INSTANCE);
- AliasManager aliasMgr =
- new DefaultAliasManager(new DummyExtensionPoint()).createAliasManager();
- SyntaxManager syntaxMgr =
- new DefaultSyntaxManager(new DummyExtensionPoint()).createSyntaxManager();
- for (String pluginName : PLUGIN_NAMES) {
- configurePluginCommands(root, pluginName, aliasMgr, syntaxMgr);
- }
- System.setProperty("jnode.invoker", "default");
- InitialNaming.bind(AliasManager.NAME, aliasMgr);
- InitialNaming.bind(ShellManager.NAME, new DefaultShellManager());
- InitialNaming.bind(SyntaxManager.NAME, syntaxMgr);
- InitialNaming.bind(Help.NAME, new DefaultHelp());
+ InitialNaming.bind(DeviceManager.NAME, DeviceManager.INSTANCE);
+ AliasManager aliasMgr =
+ new DefaultAliasManager(new DummyExtensionPoint()).createAliasManager();
+ SyntaxManager syntaxMgr =
+ new DefaultSyntaxManager(new DummyExtensionPoint()).createSyntaxManager();
+ for (String pluginName : PLUGIN_NAMES) {
+ configurePluginCommands(root, pluginName, aliasMgr, syntaxMgr);
+ }
+ System.setProperty("jnode.invoker", "default");
+ InitialNaming.bind(AliasManager.NAME, aliasMgr);
+ InitialNaming.bind(ShellManager.NAME, new DefaultShellManager());
+ InitialNaming.bind(SyntaxManager.NAME, syntaxMgr);
+ InitialNaming.bind(Help.NAME, new DefaultHelp());
} catch (NamingException ex) {
throw new EmuException("Problem setting up InitialNaming bindings", ex);
}
@@ -104,14 +100,15 @@
/**
* Configure any command classes specified by a given plugin's descriptor
- * @param root the root directory for the JNode sandbox.
+ *
+ * @param root the root directory for the JNode sandbox.
* @param pluginName the plugin to be processed
- * @param aliasMgr the alias manager to be populated
- * @param syntaxMgr the syntax manager to be populated
+ * @param aliasMgr the alias manager to be populated
+ * @param syntaxMgr the syntax manager to be populated
* @throws EmuException
*/
private static void configurePluginCommands(File root, String pluginName, AliasManager aliasMgr,
- SyntaxManager syntaxMgr) throws EmuException {
+ SyntaxManager syntaxMgr) throws EmuException {
XMLElement pluginDescriptor = loadPluginDescriptor(root, pluginName);
extractAliases(pluginDescriptor, aliasMgr);
extractSyntaxBundles(pluginDescriptor, syntaxMgr);
@@ -119,11 +116,12 @@
/**
* Populate the supplied syntax manager with syntax entries from a plugin descriptor.
+ *
* @param pluginDescriptor the plugin descriptor's root XML element
- * @param syntaxMgr the syntax manager to be populated.
+ * @param syntaxMgr the syntax manager to be populated.
* @throws EmuException
*/
- private static void extractSyntaxBundles(XMLElement pluginDescriptor, SyntaxManager syntaxMgr)
+ private static void extractSyntaxBundles(XMLElement pluginDescriptor, SyntaxManager syntaxMgr)
throws EmuException {
XMLElement syntaxesDescriptor = findExtension(pluginDescriptor, SyntaxManager.SYNTAXES_EP_NAME);
if (syntaxesDescriptor == null) {
@@ -148,8 +146,9 @@
/**
* Populate the supplied alias manager with aliases from a plugin descriptor.
+ *
* @param pluginDescriptor the plugin descriptor's root XML element
- * @param aliasMgr the alias manager to be populated.
+ * @param aliasMgr the alias manager to be populated.
* @throws EmuException
*/
private static void extractAliases(XMLElement pluginDescriptor, AliasManager aliasMgr) {
@@ -168,14 +167,15 @@
/**
* Locate the descriptor for a given extension point.
+ *
* @param pluginDescriptor the plugin descriptor
- * @param epName the extension point's name
+ * @param epName the extension point's name
* @return
*/
private static XMLElement findExtension(XMLElement pluginDescriptor, String epName) {
for (XMLElement child : pluginDescriptor.getChildren()) {
if (child.getName().equals("extension") &&
- epName.equals(child.getStringAttribute("point"))) {
+ epName.equals(child.getStringAttribute("point"))) {
return child;
}
}
@@ -185,12 +185,13 @@
/**
* Locate and load a plugin descriptor. We search the "descriptors" directory of
* each of the projects listed in ALL_PROJECTS
- * @param root the notional root directory for the user's JNode sandbox.
+ *
+ * @param root the notional root directory for the user's JNode sandbox.
* @param pluginName the name of the plugin we're trying to locate
* @return the loaded plugin descriptor or <code>null</code>
* @throws EmuException
*/
- private static XMLElement loadPluginDescriptor(File root, String pluginName)
+ private static XMLElement loadPluginDescriptor(File root, String pluginName)
throws EmuException {
File file = null;
for (String projectName : ALL_PROJECTS) {
@@ -200,8 +201,8 @@
}
}
if (!file.exists()) {
- throw new EmuException("Cannot find plugin descriptor file for '" +
- pluginName + "': " + file.getAbsolutePath());
+ throw new EmuException("Cannot find plugin descriptor file for '" +
+ pluginName + "': " + file.getAbsolutePath());
}
BufferedReader br = null;
try {
Modified: trunk/fs/src/fs/org/jnode/fs/ext2/command/FormatExt2Command.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ext2/command/FormatExt2Command.java 2008-08-24 10:02:34 UTC (rev 4491)
+++ trunk/fs/src/fs/org/jnode/fs/ext2/command/FormatExt2Command.java 2008-08-24 11:38:12 UTC (rev 4492)
@@ -23,12 +23,11 @@
import java.util.HashMap;
import java.util.Map;
-
import org.jnode.fs.command.AbstractFormatCommand;
import org.jnode.fs.ext2.BlockSize;
import org.jnode.fs.ext2.Ext2FileSystem;
-import org.jnode.fs.ext2.Ext2FileSystemFormatter;
-import org.jnode.shell.syntax.Argument;
+import org.jnode.fs.ext2.Ext2FileSystemFormatter;
+import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.MappedArgument;
/**
@@ -39,14 +38,16 @@
private static class BlockSizeArgument extends MappedArgument<BlockSize> {
private static final Map<String, BlockSize> MAP = new HashMap<String, BlockSize>();
+
static {
MAP.put("1k", BlockSize._1Kb);
MAP.put("2k", BlockSize._2Kb);
MAP.put("4k", BlockSize._4Kb);
}
+
public BlockSizeArgument() {
super("blockSize", Argument.OPTIONAL, new BlockSize[0],
- MAP, true, "block size for EXT2 filesystem (default 4k)");
+ MAP, true, "block size for EXT2 filesystem (default 4k)");
}
@Override
@@ -68,10 +69,10 @@
@Override
protected Ext2FileSystemFormatter getFormatter() {
- if(ARG_BLOCK_SIZE.isSet()){
- return new Ext2FileSystemFormatter(ARG_BLOCK_SIZE.getValue());
- } else {
- return new Ext2FileSystemFormatter(BlockSize._4Kb);
- }
+ if (ARG_BLOCK_SIZE.isSet()) {
+ return new Ext2FileSystemFormatter(ARG_BLOCK_SIZE.getValue());
+ } else {
+ return new Ext2FileSystemFormatter(BlockSize._4Kb);
+ }
}
}
Modified: trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java 2008-08-24 10:02:34 UTC (rev 4491)
+++ trunk/shell/src/shell/org/jnode/shell/help/def/DefaultHelp.java 2008-08-24 11:38:12 UTC (rev 4492)
@@ -18,14 +18,13 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package org.jnode.shell.help.def;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeSet;
-
import org.jnode.shell.help.Argument;
import org.jnode.shell.help.Help;
import org.jnode.shell.help.Parameter;
@@ -44,7 +43,7 @@
public static final String RESOURCE_NAME = "messages.properties";
private static final int NOMINAL_WIDTH = 75;
/* start with 80 spaces ... */
- private static String spaces =
+ private static String spaces =
" ";
/**
@@ -55,7 +54,8 @@
/**
* Shows the complete help for a command.
- * @see Help#help(org.jnode.shell.help.Help.Info, String)
+ *
+ * @see Help#help(org.jnode.shell.help.Help.Info, String)
*/
public void help(Info info, String command, PrintStream out) {
final Syntax[] syntaxes = info.getSyntaxes();
@@ -73,8 +73,8 @@
usage(syntaxes, bundle, out);
if (bundle.getDescription() != null) {
out.println("\n" + Help.getLocalizedHelp("help.description") + ":");
- format(out, new Cell[]{new Cell(4, NOMINAL_WIDTH - 4)},
- new String[]{bundle.getDescription()});
+ format(out, new Cell[]{new Cell(4, NOMINAL_WIDTH - 4)},
+ new String[]{bundle.getDescription()});
}
Map<String, TreeSet<String>> flagMap = buildFlagMap(syntaxes);
boolean first = true;
@@ -101,14 +101,14 @@
private Map<String, TreeSet<String>> buildFlagMap(SyntaxBundle syntaxes) {
HashMap<String, TreeSet<String>> res = new HashMap<String, TreeSet<String>>();
- for (org.jnode.shell.syntax.Syntax syntax: syntaxes.getSyntaxes()) {
+ for (org.jnode.shell.syntax.Syntax syntax : syntaxes.getSyntaxes()) {
buildFlagMap(syntax, res);
}
return res;
}
- private void buildFlagMap(org.jnode.shell.syntax.Syntax syntax,
- HashMap<String, TreeSet<String>> res) {
+ private void buildFlagMap(org.jnode.shell.syntax.Syntax syntax,
+ HashMap<String, TreeSet<String>> res) {
if (syntax instanceof OptionSyntax) {
OptionSyntax os = (OptionSyntax) syntax;
String key = os.getArgName();
@@ -140,7 +140,7 @@
if (syntax.getDescription() != null) {
out.println("\n" + Help.getLocalizedHelp("help.description") + ":");
format(out, new Cell[]{new Cell(4, NOMINAL_WIDTH - 4)},
- new String[]{syntax.getDescription()});
+ new String[]{syntax.getDescription()});
}
final Parameter[] params = syntax.getParams();
if (params.length != 0) {
@@ -180,8 +180,8 @@
int usageLength = usageText.length();
int commandLength = command.length();
Cell[] cells =
- new Cell[] {new Cell(0, usageLength), new Cell(1, commandLength),
- new Cell(1, NOMINAL_WIDTH - 2 - usageLength - commandLength)};
+ new Cell[]{new Cell(0, usageLength), new Cell(1, commandLength),
+ new Cell(1, NOMINAL_WIDTH - 2 - usageLength - commandLength)};
String[] texts = new String[]{usageText, command, null};
String[] texts2 = new String[]{"", "", null};
org.jnode.shell.syntax.Syntax[] syntaxes = syntaxBundle.getSyntaxes();
@@ -202,33 +202,33 @@
}
public void describeParameter(Parameter param, PrintStream out) {
- format(out, new Cell[]{new Cell(2, 18), new Cell(2, NOMINAL_WIDTH - 22)},
- new String[]{param.getName(), param.getDescription()});
+ format(out, new Cell[]{new Cell(2, 18), new Cell(2, NOMINAL_WIDTH - 22)},
+ new String[]{param.getName(), param.getDescription()});
}
public void describeArgument(Argument arg, PrintStream out) {
format(out, new Cell[]{new Cell(4, 16), new Cell(2, NOMINAL_WIDTH - 22)},
- new String[]{arg.getName(), arg.getDescription()});
+ new String[]{arg.getName(), arg.getDescription()});
}
@Override
public void describeArgument(org.jnode.shell.syntax.Argument<?> arg, PrintStream out) {
String description = "(" + arg.getTypeDescription() + ") " + arg.getDescription();
format(out, new Cell[]{new Cell(4, 16), new Cell(2, NOMINAL_WIDTH - 22)},
- new String[]{"<" + arg.getLabel() + ">", description});
+ new String[]{"<" + arg.getLabel() + ">", description});
}
@Override
public void describeOption(FlagArgument arg, TreeSet<String> flagTokens, PrintStream out) {
StringBuffer sb = new StringBuffer();
- for (String flagToken: flagTokens) {
+ for (String flagToken : flagTokens) {
if (sb.length() > 0) {
sb.append(" | ");
}
sb.append(flagToken);
}
format(out, new Cell[]{new Cell(4, 16), new Cell(2, NOMINAL_WIDTH - 22)},
- new String[]{sb.toString(), arg.getDescription()});
+ new String[]{sb.toString(), arg.getDescription()});
}
protected void format(PrintStream out, Cell[] cells, String[] texts) {
@@ -265,6 +265,7 @@
/**
* Get a String consisting of 'count' spaces.
+ *
* @param count the number of spaces
* @return the string
*/
@@ -299,8 +300,9 @@
/**
* Construct a Cell with a leading margin and a text width.
+ *
* @param margin the number of leading spaces for the Cell
- * @param width the width of the text part of the Cell
+ * @param width the width of the text part of the Cell
*/
protected Cell(int margin, int width) {
this.margin = margin;
@@ -311,7 +313,7 @@
}
/**
- * Heuristically, split of a head substring of 'text' to fit within this Cell's width. We try
+ * Heuristically, split of a head substring of 'text' to fit within this Cell's width. We try
* to split at a space character, but if this will make the text too ragged, we simply chop.
*/
protected String fit(String text) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|