|
From: <cr...@us...> - 2008-06-07 11:48:37
|
Revision: 4209
http://jnode.svn.sourceforge.net/jnode/?rev=4209&view=rev
Author: crawley
Date: 2008-06-07 04:48:31 -0700 (Sat, 07 Jun 2008)
Log Message:
-----------
style changes
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/jifs/ExtFSEntry.java
trunk/fs/src/fs/org/jnode/fs/jifs/JIFSDirectory.java
trunk/fs/src/fs/org/jnode/fs/jifs/JIFSFile.java
trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystem.java
trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystemType.java
trunk/fs/src/fs/org/jnode/fs/jifs/command/CreateJIFSCommand.java
trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSExtension.java
trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSPlugin.java
trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDpluginJars.java
trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDplugins.java
trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDrootDir.java
trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDthreads.java
trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFdevices.java
trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFfilesystems.java
trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFfragmentJar.java
trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFmemory.java
trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFplugin.java
trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFpluginJar.java
trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFthread.java
trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFuptime.java
trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFversion.java
trunk/fs/src/fs/org/jnode/fs/nfs/command/NFSHostNameArgument.java
trunk/fs/src/fs/org/jnode/fs/nfs/command/NFSMountCommand.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2Device.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2Directory.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2Driver.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2Entry.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2File.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystem.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystemType.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2Object.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2RootEntry.java
trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/TableEntry.java
trunk/fs/src/fs/org/jnode/fs/ntfs/AttributeListAttribute.java
trunk/fs/src/fs/org/jnode/fs/ntfs/AttributeListAttributeNonRes.java
trunk/fs/src/fs/org/jnode/fs/ntfs/AttributeListAttributeRes.java
trunk/fs/src/fs/org/jnode/fs/ntfs/AttributeListBlock.java
trunk/fs/src/fs/org/jnode/fs/ntfs/AttributeListEntry.java
trunk/fs/src/fs/org/jnode/fs/ntfs/BootRecord.java
trunk/fs/src/fs/org/jnode/fs/ntfs/DataRun.java
trunk/fs/src/fs/org/jnode/fs/ntfs/FileNameAttribute.java
trunk/fs/src/fs/org/jnode/fs/ntfs/FileRecord.java
trunk/fs/src/fs/org/jnode/fs/ntfs/IndexAllocationAttribute.java
trunk/fs/src/fs/org/jnode/fs/ntfs/IndexBlock.java
trunk/fs/src/fs/org/jnode/fs/ntfs/IndexEntry.java
trunk/fs/src/fs/org/jnode/fs/ntfs/IndexEntryIterator.java
trunk/fs/src/fs/org/jnode/fs/ntfs/IndexHeader.java
trunk/fs/src/fs/org/jnode/fs/ntfs/IndexRoot.java
trunk/fs/src/fs/org/jnode/fs/ntfs/IndexRootAttribute.java
trunk/fs/src/fs/org/jnode/fs/ntfs/MasterFileTable.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSAttribute.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSDirectory.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSEntry.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFile.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystem.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystemType.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSIndex.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSNonResidentAttribute.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSRecord.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSResidentAttribute.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSStructure.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSUTIL.java
trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSVolume.java
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/ExtFSEntry.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/ExtFSEntry.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/ExtFSEntry.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -21,14 +21,14 @@
package org.jnode.fs.jifs;
+import org.jnode.fs.FSDirectory;
import org.jnode.fs.FSEntry;
-import org.jnode.fs.FSDirectory;
/**
* @author Andreas H\u00e4nel
*/
public interface ExtFSEntry extends FSEntry {
- public void setParent(FSDirectory parent);
-
+ public void setParent(FSDirectory parent);
+
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/JIFSDirectory.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/JIFSDirectory.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/JIFSDirectory.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -47,9 +47,9 @@
public JIFSDirectory() {
entries = new HashMap<String, FSEntry>();
}
-
+
public JIFSDirectory(String name) {
- this();
+ this();
label = name;
}
@@ -61,9 +61,9 @@
public void refresh() {
return;
}
-
+
protected void clear() {
- entries.clear();
+ entries.clear();
}
public void addFSE(FSEntry entry) {
@@ -74,7 +74,7 @@
* Flush the contents of this directory to the persistent storage
*/
public void flush() throws IOException {
- //TODO -> extended FSEntry maybe have to be flushed
+ // TODO -> extended FSEntry maybe have to be flushed
}
public FSEntry addDirectory(String name) {
@@ -131,7 +131,7 @@
}
public void setName(String name) {
- this.label=name;
+ this.label = name;
}
public boolean isDirectory() {
@@ -145,11 +145,11 @@
public FSDirectory getParent() {
return parent;
}
-
- public void setParent(FSDirectory parent){
- this.parent=parent;
- }
+ public void setParent(FSDirectory parent) {
+ this.parent = parent;
+ }
+
public String getName() {
return label;
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/JIFSFile.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/JIFSFile.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/JIFSFile.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -40,134 +40,135 @@
*/
public class JIFSFile implements ExtFSEntry, FSFile {
- protected String name;
- protected StringBuffer data = new StringBuffer();
- protected boolean isvalid = true;
-
- private FSDirectory parent = null;
-
- public JIFSFile() {
- refresh();
- }
-
- public JIFSFile(String name) {
- this.name = name;
- }
-
- public JIFSFile(String name, FSDirectory parent) {
- this(name);
- this.parent = parent;
- refresh();
- }
+ protected String name;
+ protected StringBuffer data = new StringBuffer();
+ protected boolean isvalid = true;
- /**
- * Flush the contents of this file to the persistent storage.<br>
- * Does nothing, because the JIFSFile is a virtual File.
- */
- public void flush() throws IOException {
- }
+ private FSDirectory parent = null;
- public long getLength(){
- return data.length();
- }
-
- protected void cleardata(){
- data.delete(0,data.length());
- }
-
- protected void addString(String add){
- data.append(add);
- }
-
- protected void addStringln(String add){
- addString(add);
- addStringln();
- }
-
- protected void addStringln(){
- addString("\n");
- }
-
- public void refresh(){
- cleardata();
- addString("JIFSFile\nFilename :"+name+"\n");
- }
-
- //public void read(long fileOffset, byte[] dest, int off, int len){
- public void read(long fileOffset, ByteBuffer destBuf){
- refresh();
- byte[] readdata = data.toString().getBytes();
- destBuf.put(readdata, (int)fileOffset, destBuf.remaining());
- }
-
- //public void write(long fileOffset, byte[] src, int off, int len) throws IOException{
- public void write(long fileOffset, ByteBuffer src) throws IOException{
- throw new IOException("can not write to JNIFSFile..");
- }
-
- public void setLength(long length){
- return;
- }
+ public JIFSFile() {
+ refresh();
+ }
- public boolean isValid(){
- return isvalid;
- }
-
- public FileSystem getFileSystem(){
- //TODO
- return null;
- }
-
- public boolean isDirty(){
- return false;
- }
-
- public FSAccessRights getAccessRights(){
- return null;
- }
-
- public FSDirectory getDirectory(){
- return null;
- }
-
- public FSFile getFile(){
- return this;
- }
-
- public void setLastModified(long l){
- return;
- }
-
- public long getLastModified(){
- return System.currentTimeMillis();
- }
-
- public void setName(String name){
- this.name=name;
- }
-
- public boolean isDirectory(){
- return false;
- }
-
- public boolean isFile(){
- return true;
- }
-
- public FSDirectory getParent(){
- return parent;
- }
-
- public void setParent(FSDirectory parent){
- this.parent=parent;
- }
-
- public String getName(){
- return name;
- }
-
- public Iterator<FSEntry> iterator(){
- return new JIFSDirIterator(new HashSet<FSEntry>());
- }
+ public JIFSFile(String name) {
+ this.name = name;
+ }
+ public JIFSFile(String name, FSDirectory parent) {
+ this(name);
+ this.parent = parent;
+ refresh();
+ }
+
+ /**
+ * Flush the contents of this file to the persistent storage.<br>
+ * Does nothing, because the JIFSFile is a virtual File.
+ */
+ public void flush() throws IOException {
+ }
+
+ public long getLength() {
+ return data.length();
+ }
+
+ protected void cleardata() {
+ data.delete(0, data.length());
+ }
+
+ protected void addString(String add) {
+ data.append(add);
+ }
+
+ protected void addStringln(String add) {
+ addString(add);
+ addStringln();
+ }
+
+ protected void addStringln() {
+ addString("\n");
+ }
+
+ public void refresh() {
+ cleardata();
+ addString("JIFSFile\nFilename :" + name + "\n");
+ }
+
+ // public void read(long fileOffset, byte[] dest, int off, int len){
+ public void read(long fileOffset, ByteBuffer destBuf) {
+ refresh();
+ byte[] readdata = data.toString().getBytes();
+ destBuf.put(readdata, (int) fileOffset, destBuf.remaining());
+ }
+
+ // public void write(long fileOffset, byte[] src, int off, int len) throws
+ // IOException{
+ public void write(long fileOffset, ByteBuffer src) throws IOException {
+ throw new IOException("can not write to JNIFSFile..");
+ }
+
+ public void setLength(long length) {
+ return;
+ }
+
+ public boolean isValid() {
+ return isvalid;
+ }
+
+ public FileSystem getFileSystem() {
+ // TODO
+ return null;
+ }
+
+ public boolean isDirty() {
+ return false;
+ }
+
+ public FSAccessRights getAccessRights() {
+ return null;
+ }
+
+ public FSDirectory getDirectory() {
+ return null;
+ }
+
+ public FSFile getFile() {
+ return this;
+ }
+
+ public void setLastModified(long l) {
+ return;
+ }
+
+ public long getLastModified() {
+ return System.currentTimeMillis();
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isDirectory() {
+ return false;
+ }
+
+ public boolean isFile() {
+ return true;
+ }
+
+ public FSDirectory getParent() {
+ return parent;
+ }
+
+ public void setParent(FSDirectory parent) {
+ this.parent = parent;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Iterator<FSEntry> iterator() {
+ return new JIFSDirIterator(new HashSet<FSEntry>());
+ }
+
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystem.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystem.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystem.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -30,115 +30,107 @@
import org.jnode.fs.FileSystem;
import org.jnode.fs.FileSystemException;
import org.jnode.fs.jifs.directories.JIFSDrootDir;
-import org.jnode.fs.nfs.nfs2.NFS2FileSystemType;
/**
* @author Andreas H\u00e4nel
*/
public class JIFileSystem implements FileSystem<JIFSDirectory> {
- private JIFSDirectory rootDir = null;
- private Device device;
+ private JIFSDirectory rootDir = null;
+ private Device device;
private final JIFileSystemType type;
/**
- * Constructor for JIFileSystem in specified readOnly mode
- */
- public JIFileSystem(Device device, boolean readOnly, JIFileSystemType type) throws FileSystemException {
- if (readOnly==false){
- throw new FileSystemException("JIFS can not be created as writable...");
- }
- this.device = device;
+ * Constructor for JIFileSystem in specified readOnly mode
+ */
+ public JIFileSystem(Device device, boolean readOnly, JIFileSystemType type)
+ throws FileSystemException {
+ if (readOnly == false) {
+ throw new FileSystemException("JIFS can not be created as writable...");
+ }
+ this.device = device;
this.type = type;
- //try {
- //rootDir = new JIFSDirectory(this.device.getId(), true);
- rootDir = new JIFSDrootDir(device.getId());
- //} catch ( IOException e){
- // e.printStackTrace();
- //}
- }
+ rootDir = new JIFSDrootDir(device.getId());
+ }
- final public JIFileSystemType getType() {
- return type;
- }
+ public final JIFileSystemType getType() {
+ return type;
+ }
- /**
- * Is the filesystem mounted in readonly mode ?
- */
- public boolean isReadOnly()
- {
- return true; // always readOnly
- }
+ /**
+ * Is the filesystem mounted in readonly mode ?
+ */
+ public boolean isReadOnly() {
+ return true; // always readOnly
+ }
+ public void close() {
+ return;
+ }
- public void close(){
- return;
- }
-
public boolean isClosed() {
return false;
}
- public Device getDevice(){
- return device;
- }
+ public Device getDevice() {
+ return device;
+ }
- /**
- * Flush all changed structures to the device. Since JIFS is readonly, this method does nothing.
- *
- * @throws IOException
- */
- public void flush() throws IOException {
- return;
- }
+ /**
+ * Flush all changed structures to the device. Since JIFS is readonly, this
+ * method does nothing.
+ *
+ * @throws IOException
+ */
+ public void flush() throws IOException {
+ return;
+ }
- /**
- * Gets the root entry of this filesystem. This is usually a director, but
- * this is not required.
- *
- * @return rootDir
- */
- public JIFSDirectory getRootEntry() {
- return rootDir;
- }
+ /**
+ * Gets the root entry of this filesystem. This is usually a director, but
+ * this is not required.
+ *
+ * @return rootDir
+ */
+ public JIFSDirectory getRootEntry() {
+ return rootDir;
+ }
- /**
- * Gets the file for the given entry.
- *
- * @return null
- * @param entry
- */
- public synchronized JIFSFile getFile(FSEntry entry) {
- return null;
- }
+ /**
+ * Gets the file for the given entry.
+ *
+ * @return null
+ * @param entry
+ */
+ public synchronized JIFSFile getFile(FSEntry entry) {
+ return null;
+ }
+ protected FSFile createFile(FSEntry entry) throws IOException {
+ return null;
+ }
- protected FSFile createFile(FSEntry entry) throws IOException {
- return null;
- }
+ protected FSDirectory createDirectory(FSEntry entry) throws IOException {
+ return null;
+ }
- protected FSDirectory createDirectory(FSEntry entry) throws IOException {
- return null;
- }
+ protected FSEntry createRootEntry() throws IOException {
+ return null;
+ }
- protected FSEntry createRootEntry() throws IOException {
- return null;
- }
+ public long getFreeSpace() {
+ // TODO implement me
+ return 0;
+ }
+ public long getTotalSpace() {
+ // TODO implement me
+ return 0;
+ }
- public long getFreeSpace() {
- // TODO implement me
- return 0;
- }
+ public long getUsableSpace() {
+ // TODO implement me
+ return 0;
+ }
- public long getTotalSpace() {
- // TODO implement me
- return 0;
- }
-
- public long getUsableSpace() {
- // TODO implement me
- return 0;
- }
-
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystemType.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystemType.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystemType.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -19,7 +19,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
- package org.jnode.fs.jifs;
+package org.jnode.fs.jifs;
import org.apache.log4j.Logger;
import org.jnode.driver.Device;
@@ -34,8 +34,8 @@
public static final String VIRTUAL_DEVICE_NAME = "jifs";
- /** Logger*/
- private static final Logger log = Logger.getLogger(JIFileSystemType.class);
+ /** Logger */
+ private static final Logger log = Logger.getLogger(JIFileSystemType.class);
/**
* Gets the unique name of this file system type.
@@ -44,19 +44,19 @@
return "JIFS";
}
- /**
- * Create a filesystem for a given device.
- *
- * @param device
- * @param readOnly
- * @return JIFileSystem(device,readOnly)
- * @throws FileSystemException
- */
- public JIFileSystem create(Device device, boolean readOnly) throws FileSystemException {
- JIFileSystem ret = new JIFileSystem(device, readOnly, this);
- if (ret== null){
- log.error("got NULL from the JIFileSystem...");
- }
- return ret;
- }
+ /**
+ * Create a filesystem for a given device.
+ *
+ * @param device
+ * @param readOnly
+ * @return JIFileSystem(device,readOnly)
+ * @throws FileSystemException
+ */
+ public JIFileSystem create(Device device, boolean readOnly) throws FileSystemException {
+ JIFileSystem ret = new JIFileSystem(device, readOnly, this);
+ if (ret == null) {
+ log.error("got NULL from the JIFileSystem...");
+ }
+ return ret;
+ }
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/command/CreateJIFSCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/command/CreateJIFSCommand.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/command/CreateJIFSCommand.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -26,7 +26,6 @@
import javax.naming.NameNotFoundException;
-import org.apache.log4j.Logger;
import org.jnode.naming.InitialNaming;
import org.jnode.plugin.Plugin;
import org.jnode.plugin.PluginManager;
@@ -38,52 +37,50 @@
import org.jnode.shell.help.Syntax;
import org.jnode.shell.help.argument.OptionArgument;
-//todo fix class name
+// TODO fix class name
+// TODO this class is actually just PluginCommand specialized for JIFS ...
/**
* Just mounts initial JIFS on /Jifs
*
* @author Andreas H\u00e4nel
*/
-public class CreateJIFSCommand extends AbstractCommand{
+public class CreateJIFSCommand extends AbstractCommand {
- private static final Logger log = Logger.getLogger(CreateJIFSCommand.class);
-
- static final OptionArgument ACTION = new OptionArgument("action",
- "Action to perform", new OptionArgument.Option[] {
- new OptionArgument.Option("start", "start the jifs"),
- new OptionArgument.Option("stop", "stop the jifs"),
- new OptionArgument.Option("restart", "restart the jifs"),
- });
-
+ static final OptionArgument ACTION =
+ new OptionArgument("action", "Action to perform", new OptionArgument.Option[] {
+ new OptionArgument.Option("start", "start the jifs"),
+ new OptionArgument.Option("stop", "stop the jifs"),
+ new OptionArgument.Option("restart", "restart the jifs")});
+
static final Parameter PARAM_ACTION = new Parameter(ACTION, Parameter.MANDATORY);
-
- public static Help.Info HELP_INFO = new Help.Info("jifs",
- new Syntax[] { new Syntax(
- "JIFS - Jnode Information FileSystem",
- new Parameter[] { PARAM_ACTION })});
- public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err) throws Exception {
- ParsedArguments cmdLine = HELP_INFO.parse(commandLine);
- String Act = ACTION.getValue(cmdLine);
-
- try{
- final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME);
- final Plugin p = mgr.getRegistry().getPluginDescriptor("org.jnode.fs.jifs.def").getPlugin();
- if (new String("start").equals(Act)){
- p.start();
- }
- if (new String("stop").equals(Act)){
- p.stop();
- }
- if (new String("restart").equals(Act)){
- p.stop();
- p.start();
- }
- } catch (NameNotFoundException N){
- System.err.println(N);
- }
+ public static Help.Info HELP_INFO =
+ new Help.Info("jifs", new Syntax[] {new Syntax("JIFS - Jnode Information FileSystem",
+ new Parameter[] {PARAM_ACTION})});
- }
-
-
+ public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err)
+ throws Exception {
+ ParsedArguments cmdLine = HELP_INFO.parse(commandLine);
+ String Act = ACTION.getValue(cmdLine);
+
+ try {
+ final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME);
+ final Plugin p =
+ mgr.getRegistry().getPluginDescriptor("org.jnode.fs.jifs.def").getPlugin();
+ if (new String("start").equals(Act)) {
+ p.start();
+ }
+ if (new String("stop").equals(Act)) {
+ p.stop();
+ }
+ if (new String("restart").equals(Act)) {
+ p.stop();
+ p.start();
+ }
+ } catch (NameNotFoundException N) {
+ System.err.println(N);
+ }
+
+ }
+
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSExtension.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSExtension.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSExtension.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -46,101 +46,101 @@
* @author Andreas H\u00e4nel
*/
final class JIFSExtension implements ExtensionPointListener {
-
- /** My logger */
- private static final Logger log = Logger.getLogger(JIFSExtension.class);
- /** The org.jnode.fs.jifs.def.info extension point */
- private final ExtensionPoint infoEP;
- private JIFSDirectory extdir;
-
- protected JIFSExtension(ExtensionPoint infoEP){
- if (infoEP == null) {
- throw new IllegalArgumentException("The info extension-point cannot be null.");
- }
- this.infoEP = infoEP;
- try {
- FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
- final DeviceManager dm = DeviceUtils.getDeviceManager();
- VirtualDevice dev = (VirtualDevice) dm.getDevice(JIFileSystemType.VIRTUAL_DEVICE_NAME);
- JIFSDirectory rootdir = (JIFSDirectory)fSS.getFileSystem(dev).getRootEntry();
- extdir = (JIFSDirectory)rootdir.getEntry("extended").getDirectory();
- } catch (NameNotFoundException e){
- log.error("filesystemservice / filesystemtype not found");
- } catch (DeviceNotFoundException ex){
- log.info("no jifs present");
- } catch (IOException ex){
- log.error(ex);
+ /** My logger */
+ private static final Logger log = Logger.getLogger(JIFSExtension.class);
+
+ /** The org.jnode.fs.jifs.def.info extension point */
+ private final ExtensionPoint infoEP;
+ private JIFSDirectory extdir;
+
+ protected JIFSExtension(ExtensionPoint infoEP) {
+
+ if (infoEP == null) {
+ throw new IllegalArgumentException("The info extension-point cannot be null.");
}
+ this.infoEP = infoEP;
+ try {
+ FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
+ final DeviceManager dm = DeviceUtils.getDeviceManager();
+ VirtualDevice dev = (VirtualDevice) dm.getDevice(JIFileSystemType.VIRTUAL_DEVICE_NAME);
+ JIFSDirectory rootdir = (JIFSDirectory) fSS.getFileSystem(dev).getRootEntry();
+ extdir = (JIFSDirectory) rootdir.getEntry("extended").getDirectory();
+ } catch (NameNotFoundException e) {
+ log.error("filesystemservice / filesystemtype not found");
+ } catch (DeviceNotFoundException ex) {
+ log.info("no jifs present");
+ } catch (IOException ex) {
+ log.error(ex);
+ }
refresh();
- }
-
-
- /**
- * An extension has been added to an extension point
- * @param point
- * @param extension
- */
- public void extensionAdded(ExtensionPoint point, Extension extension){
- refresh();
- }
+ }
- /**
- * An extension has been removed from an extension point
- * @param point
- * @param extension
- */
- public void extensionRemoved(ExtensionPoint point, Extension extension){
- refresh();
- }
-
- private void refresh(){
- if (extdir==null){return;}
- extdir.refresh();
- final Extension[] extensions = infoEP.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- final Extension ext = extensions[i];
- final ConfigurationElement[] elements = ext.getConfigurationElements();
- for (int j = 0; j < elements.length; j++) {
- addEntry(elements[j]);
- }
- }
- }
-
-
- private void addEntry(ConfigurationElement element){
- final String className = element.getAttribute("class");
- final String entryName = element.getAttribute("name");
- if (className != null) {
- try {
- final ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Class<?> c = cl.loadClass(className);
- Object o = c.newInstance();
- ExtFSEntry entry = (ExtFSEntry)o;
- if (entry.getName()==null){
- if (entryName!=null){
- entry.setName(entryName);
- } else {
- entry.setName(className);
- }
- }
- entry.setParent(extdir);
- FSEntry add = entry;
- extdir.addFSE(add);
- } catch (ClassCastException ex) {
- log.error(
- "Given class "
- + className
- + " does not implement .");
- } catch (ClassNotFoundException ex) {
- log.error("Cannot load " + className);
- } catch (IllegalAccessException ex) {
- log.error("No access to " + className);
- } catch (InstantiationException ex) {
- log.error(ex);
- } catch (IOException ex){
- log.error("could not set name of file: "+ entryName );
- }
- }
- }
+ /**
+ * An extension has been added to an extension point
+ *
+ * @param point
+ * @param extension
+ */
+ public void extensionAdded(ExtensionPoint point, Extension extension) {
+ refresh();
+ }
+
+ /**
+ * An extension has been removed from an extension point
+ *
+ * @param point
+ * @param extension
+ */
+ public void extensionRemoved(ExtensionPoint point, Extension extension) {
+ refresh();
+ }
+
+ private void refresh() {
+ if (extdir == null) {
+ return;
+ }
+ extdir.refresh();
+ final Extension[] extensions = infoEP.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ final Extension ext = extensions[i];
+ final ConfigurationElement[] elements = ext.getConfigurationElements();
+ for (int j = 0; j < elements.length; j++) {
+ addEntry(elements[j]);
+ }
+ }
+ }
+
+ private void addEntry(ConfigurationElement element) {
+ final String className = element.getAttribute("class");
+ final String entryName = element.getAttribute("name");
+ if (className != null) {
+ try {
+ final ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Class<?> c = cl.loadClass(className);
+ Object o = c.newInstance();
+ ExtFSEntry entry = (ExtFSEntry) o;
+ if (entry.getName() == null) {
+ if (entryName != null) {
+ entry.setName(entryName);
+ } else {
+ entry.setName(className);
+ }
+ }
+ entry.setParent(extdir);
+ FSEntry add = entry;
+ extdir.addFSE(add);
+ } catch (ClassCastException ex) {
+ log.error("Given class " + className + " does not implement .");
+ } catch (ClassNotFoundException ex) {
+ log.error("Cannot load " + className);
+ } catch (IllegalAccessException ex) {
+ log.error("No access to " + className);
+ } catch (InstantiationException ex) {
+ log.error(ex);
+ } catch (IOException ex) {
+ log.error("could not set name of file: " + entryName);
+ }
+ }
+ }
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSPlugin.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSPlugin.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/def/JIFSPlugin.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -21,18 +21,20 @@
package org.jnode.fs.jifs.def;
+import java.io.IOException;
+
+import javax.naming.NameNotFoundException;
+
import org.apache.log4j.Logger;
import org.jnode.driver.DeviceAlreadyRegisteredException;
+import org.jnode.driver.DeviceException;
import org.jnode.driver.DeviceManager;
import org.jnode.driver.DeviceNotFoundException;
import org.jnode.driver.DeviceUtils;
import org.jnode.driver.DriverException;
-import org.jnode.driver.DeviceException;
import org.jnode.driver.virtual.VirtualDevice;
import org.jnode.driver.virtual.VirtualDeviceFactory;
-import org.jnode.fs.FileSystem;
import org.jnode.fs.FileSystemException;
-import org.jnode.fs.FileSystemType;
import org.jnode.fs.jifs.JIFileSystem;
import org.jnode.fs.jifs.JIFileSystemType;
import org.jnode.fs.service.FileSystemService;
@@ -42,9 +44,6 @@
import org.jnode.plugin.PluginDescriptor;
import org.jnode.plugin.PluginException;
-import javax.naming.NameNotFoundException;
-import java.io.IOException;
-
/**
* @author Andreas H\u00e4nel
*/
@@ -72,7 +71,8 @@
try {
JIFileSystemType type = null;
try {
- VirtualDevice dev = VirtualDeviceFactory.createDevice(JIFileSystemType.VIRTUAL_DEVICE_NAME);
+ VirtualDevice dev =
+ VirtualDeviceFactory.createDevice(JIFileSystemType.VIRTUAL_DEVICE_NAME);
log.info(dev.getId() + " registered");
final FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
type = fSS.getFileSystemType(JIFileSystemType.ID);
@@ -82,15 +82,14 @@
final String mountPath = "jifs";
fSS.mount(mountPath, fs, null);
- log.info("Mounted " + type.getName() + " on "
- + mountPath);
+ log.info("Mounted " + type.getName() + " on " + mountPath);
final ExtensionPoint infoEP = getDescriptor().getExtensionPoint("info");
jifsExtension = new JIFSExtension(infoEP);
} catch (DeviceAlreadyRegisteredException ex) {
log.error("jifs is currently running.");
} catch (FileSystemException ex) {
- log.error("Cannot mount " + (type != null ? type.getName() : "")
- + " filesystem ", ex);
+ log.error("Cannot mount " + (type != null ? type.getName() : "") + " filesystem ",
+ ex);
} catch (DeviceException e) {
log.debug("Got DriverException, maybe jifs is running.");
} catch (IOException ex) {
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDpluginJars.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDpluginJars.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDpluginJars.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -1,38 +1,38 @@
package org.jnode.fs.jifs.directories;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.naming.NameNotFoundException;
+
+import org.jnode.fs.FSDirectory;
+import org.jnode.fs.FSEntry;
import org.jnode.fs.jifs.JIFSDirectory;
+import org.jnode.fs.jifs.files.JIFSFfragmentJar;
import org.jnode.fs.jifs.files.JIFSFpluginJar;
-import org.jnode.fs.jifs.files.JIFSFfragmentJar;
-import org.jnode.fs.FSDirectory;
-import org.jnode.fs.FSEntry;
+import org.jnode.naming.InitialNaming;
+import org.jnode.plugin.PluginDescriptor;
import org.jnode.plugin.PluginManager;
-import org.jnode.plugin.PluginDescriptor;
import org.jnode.plugin.model.PluginDescriptorModel;
-import org.jnode.naming.InitialNaming;
-import javax.naming.NameNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
/**
- *
* @author Levente S\u00e1ntha
*/
public class JIFSDpluginJars extends JIFSDirectory {
- public JIFSDpluginJars()throws IOException {
+ public JIFSDpluginJars() throws IOException {
super("lib");
refresh();
}
- public JIFSDpluginJars(FSDirectory parent)throws IOException{
+ public JIFSDpluginJars(FSDirectory parent) throws IOException {
this();
setParent(parent);
}
- public void refresh(){
+ public void refresh() {
// this has to be improved
// just add new ones and delete old ones
// now it does delete all files and (re)create all ones
@@ -43,9 +43,9 @@
for (PluginDescriptor descr : mgr.getRegistry()) {
String id = descr.getId();
rows.add(id);
- List fragments = ((PluginDescriptorModel) descr).fragments();
- if(fragments.size() > 0){
- for(Object o : fragments){
+ List<?> fragments = ((PluginDescriptorModel) descr).fragments();
+ if (fragments.size() > 0) {
+ for (Object o : fragments) {
PluginDescriptor pd = (PluginDescriptor) o;
rows.add(pd.getId() + "\b" + id);
}
@@ -54,18 +54,19 @@
Collections.sort(rows);
for (String row : rows) {
int index = row.indexOf('\b');
- if(index > 0){
- addFSE(new JIFSFfragmentJar(row.substring(index + 1), row.substring(0, index), this));
+ if (index > 0) {
+ addFSE(new JIFSFfragmentJar(row.substring(index + 1), row.substring(0, index),
+ this));
} else {
addFSE(new JIFSFpluginJar(row, this));
}
}
- } catch (NameNotFoundException N){
+ } catch (NameNotFoundException N) {
System.err.println(N);
}
}
- public FSEntry getEntry(String name){
+ public FSEntry getEntry(String name) {
return super.getEntry(name);
}
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDplugins.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDplugins.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDplugins.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -43,39 +43,39 @@
* @author Andreas H\u00e4nel
*/
public class JIFSDplugins extends JIFSDirectory {
-
- public JIFSDplugins()throws IOException{
- super("plugins");
- refresh();
- }
-
- public JIFSDplugins(FSDirectory parent)throws IOException{
- this();
- setParent(parent);
- }
-
- public void refresh(){
- // this has to be improved
- // just add new ones and delete old ones
- // now it does delete all files and (re)create all ones
- super.clear();
- final ArrayList<String> rows = new ArrayList<String>();
- try {
- final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME);
- for (PluginDescriptor descr : mgr.getRegistry()) {
- rows.add(descr.getId());
- }
- Collections.sort(rows);
- for (Object row : rows) {
- final JIFSFile F = new JIFSFplugin(row.toString(), this);
- addFSE(F);
- }
- } catch (NameNotFoundException N){
- System.err.println(N);
- }
- }
-
- public FSEntry getEntry(String name){
- return super.getEntry(name);
- }
+
+ public JIFSDplugins() throws IOException {
+ super("plugins");
+ refresh();
+ }
+
+ public JIFSDplugins(FSDirectory parent) throws IOException {
+ this();
+ setParent(parent);
+ }
+
+ public void refresh() {
+ // this has to be improved
+ // just add new ones and delete old ones
+ // now it does delete all files and (re)create all ones
+ super.clear();
+ final ArrayList<String> rows = new ArrayList<String>();
+ try {
+ final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME);
+ for (PluginDescriptor descr : mgr.getRegistry()) {
+ rows.add(descr.getId());
+ }
+ Collections.sort(rows);
+ for (Object row : rows) {
+ final JIFSFile F = new JIFSFplugin(row.toString(), this);
+ addFSE(F);
+ }
+ } catch (NameNotFoundException N) {
+ System.err.println(N);
+ }
+ }
+
+ public FSEntry getEntry(String name) {
+ return super.getEntry(name);
+ }
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDrootDir.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDrootDir.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDrootDir.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -33,13 +33,13 @@
public class JIFSDrootDir extends JIFSDirectory {
- private boolean inited;
-
+ private boolean inited;
+
public JIFSDrootDir(String name) {
super(name);
inited = false;
}
-
+
private void setup() throws IOException {
// file
addFSE(new JIFSFuptime(this));
@@ -50,27 +50,27 @@
addFSE(new JIFSDthreads(this));
addFSE(new JIFSDplugins(this));
addFSE(new JIFSDpluginJars(this));
- addFSE(new JIFSDirectory("extended",this));
+ addFSE(new JIFSDirectory("extended", this));
}
private void checkInit() {
- if (!inited) {
- try {
- setup();
- } catch (IOException e) {
- e.printStackTrace();
- }
- inited = true;
- }
+ if (!inited) {
+ try {
+ setup();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ inited = true;
+ }
}
-
+
public Iterator<FSEntry> iterator() {
- checkInit();
- return super.iterator();
+ checkInit();
+ return super.iterator();
}
public FSEntry getEntry(String name) {
- checkInit();
- return super.getEntry(name);
+ checkInit();
+ return super.getEntry(name);
}
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDthreads.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDthreads.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/directories/JIFSDthreads.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -25,74 +25,76 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
+import org.jnode.fs.FSDirectory;
import org.jnode.fs.FSEntry;
-import org.jnode.fs.jifs.*;
-import org.jnode.fs.jifs.files.*;
-import org.jnode.fs.FSDirectory;
+import org.jnode.fs.jifs.JIFSDirectory;
+import org.jnode.fs.jifs.JIFSFile;
+import org.jnode.fs.jifs.files.JIFSFthread;
/**
- * Directory containing one file for each java.lang.thread. Based on the thread command.
+ * Directory containing one file for each java.lang.thread. Based on the thread
+ * command.
*
* @author Andreas H\u00e4nel
*/
public class JIFSDthreads extends JIFSDirectory {
-
- public JIFSDthreads()throws IOException{
- super("threads");
- refresh();
- }
-
- public JIFSDthreads(FSDirectory parent)throws IOException{
- this();
- setParent(parent);
- }
-
- public void refresh(){
- super.clear();
- ThreadGroup grp = Thread.currentThread().getThreadGroup();
- while (grp.getParent() != null) {
- grp = grp.getParent();
- }
- addGroup(grp);
- }
-
- private void addGroup(final ThreadGroup grp) {
- final int max = grp.activeCount() * 2;
- final Thread[] ts = new Thread[max];
- AccessController.doPrivileged(new PrivilegedAction() {
+ public JIFSDthreads() throws IOException {
+ super("threads");
+ refresh();
+ }
+
+ public JIFSDthreads(FSDirectory parent) throws IOException {
+ this();
+ setParent(parent);
+ }
+
+ public void refresh() {
+ super.clear();
+ ThreadGroup grp = Thread.currentThread().getThreadGroup();
+ while (grp.getParent() != null) {
+ grp = grp.getParent();
+ }
+ addGroup(grp);
+ }
+
+ private void addGroup(final ThreadGroup grp) {
+
+ final int max = grp.activeCount() * 2;
+ final Thread[] ts = new Thread[max];
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
- grp.enumerate(ts,false);
+ grp.enumerate(ts, false);
return null;
}
});
- for (int i = 0; i < max; i++) {
- final Thread t = ts[i];
- if (t != null) {
- JIFSFile F = new JIFSFthread(t.getName(),t, this);
- addFSE(F);
- }
- }
-
- final int gmax = grp.activeGroupCount() * 2;
- final ThreadGroup[] tgs = new ThreadGroup[gmax];
+ for (int i = 0; i < max; i++) {
+ final Thread t = ts[i];
+ if (t != null) {
+ JIFSFile F = new JIFSFthread(t.getName(), t, this);
+ addFSE(F);
+ }
+ }
- AccessController.doPrivileged(new PrivilegedAction() {
+ final int gmax = grp.activeGroupCount() * 2;
+ final ThreadGroup[] tgs = new ThreadGroup[gmax];
+
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
grp.enumerate(tgs, false);
return null;
}
});
- for (int i = 0; i < gmax; i++) {
- final ThreadGroup tg = tgs[i];
- if (tg != null) {
- addGroup(tg);
- }
- }
- }
-
- public FSEntry getEntry(String name){
- return super.getEntry(name);
- }
+ for (int i = 0; i < gmax; i++) {
+ final ThreadGroup tg = tgs[i];
+ if (tg != null) {
+ addGroup(tg);
+ }
+ }
+ }
+
+ public FSEntry getEntry(String name) {
+ return super.getEntry(name);
+ }
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFdevices.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFdevices.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFdevices.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -34,48 +34,43 @@
*
* @author Andreas H\u00e4nel
*/
-public class JIFSFdevices extends JIFSFile{
+public class JIFSFdevices extends JIFSFile {
-
- public JIFSFdevices() {
- super("devices");
- }
-
- public JIFSFdevices(FSDirectory parent) {
- this();
- setParent(parent);
- }
-
- public void refresh(){
- super.refresh();
- final TreeMap<String, Device> tm = new TreeMap<String, Device>();
- try{
- final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
- for (Device dev : dm.getDevices()) {
- tm.put(dev.getId(), dev);
- }
- } catch (javax.naming.NameNotFoundException E) {
- System.err.println("could not find DeviceManager");
- }
- for (Device dev : tm.values()) {
- addStringln();
- addString(dev.getId());
- final String drvClassName = dev.getDriverClassName();
- if (dev.isStarted()) {
- addString("\tstarted");
- } else {
- addString("\tstopped");
- }
- if (drvClassName != null) {
- addString("\ndriver: " + drvClassName);
- } else {
- addString("\ndriver: none");
- }
- addStringln();
- }
+ public JIFSFdevices() {
+ super("devices");
+ }
- }
+ public JIFSFdevices(FSDirectory parent) {
+ this();
+ setParent(parent);
+ }
-
-
+ public void refresh() {
+ super.refresh();
+ final TreeMap<String, Device> tm = new TreeMap<String, Device>();
+ try {
+ final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
+ for (Device dev : dm.getDevices()) {
+ tm.put(dev.getId(), dev);
+ }
+ } catch (javax.naming.NameNotFoundException E) {
+ System.err.println("could not find DeviceManager");
+ }
+ for (Device dev : tm.values()) {
+ addStringln();
+ addString(dev.getId());
+ final String drvClassName = dev.getDriverClassName();
+ if (dev.isStarted()) {
+ addString("\tstarted");
+ } else {
+ addString("\tstopped");
+ }
+ if (drvClassName != null) {
+ addString("\ndriver: " + drvClassName);
+ } else {
+ addString("\ndriver: none");
+ }
+ addStringln();
+ }
+ }
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFfilesystems.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFfilesystems.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFfilesystems.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -30,32 +30,32 @@
import org.jnode.naming.InitialNaming;
/**
- *
+ *
* @author Andreas H\u00e4nel
*/
-public class JIFSFfilesystems extends JIFSFile{
-
- public JIFSFfilesystems(){
- super("fs");
- }
-
- public JIFSFfilesystems(FSDirectory parent){
- this();
- setParent(parent);
- }
-
- public void refresh(){
- super.refresh();
- try {
- FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
- addStringln("Registered Filesystems:");
- for (FileSystemType current : fSS.fileSystemTypes()) {
- addStringln("\t"+current.getName());
-
+public class JIFSFfilesystems extends JIFSFile {
+
+ public JIFSFfilesystems() {
+ super("fs");
+ }
+
+ public JIFSFfilesystems(FSDirectory parent) {
+ this();
+ setParent(parent);
+ }
+
+ public void refresh() {
+ super.refresh();
+ try {
+ FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
+ addStringln("Registered Filesystems:");
+ for (FileSystemType<?> current : fSS.fileSystemTypes()) {
+ addStringln("\t" + current.getName());
+
}
- } catch (NameNotFoundException e){
- System.err.print(e);
- }
- }
-
+ } catch (NameNotFoundException e) {
+ System.err.print(e);
+ }
+ }
+
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFfragmentJar.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFfragmentJar.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFfragmentJar.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -9,19 +9,17 @@
/**
* File, which contains information about the plugin with the same name.
- *
+ *
* @author Levente S\u00e1ntha
*/
public class JIFSFfragmentJar extends JIFSFpluginJar {
private String pluginId;
private String fragmentId;
+
public JIFSFfragmentJar() {
return;
}
- /**
- *
- */
public JIFSFfragmentJar(String pluginId, String fragmentId, FSDirectory parent) {
super(fragmentId, parent);
this.pluginId = pluginId;
@@ -29,14 +27,15 @@
refresh();
}
- public void refresh(){
- try{
+ public void refresh() {
+ try {
final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME);
- PluginDescriptorModel pdm = (PluginDescriptorModel) mgr.getRegistry().getPluginDescriptor(pluginId);
- if(pdm != null){
+ PluginDescriptorModel pdm =
+ (PluginDescriptorModel) mgr.getRegistry().getPluginDescriptor(pluginId);
+ if (pdm != null) {
isvalid = false;
- for(PluginDescriptorModel fdm : pdm.fragments()){
- if(fdm.getId().equals(fragmentId)){
+ for (PluginDescriptorModel fdm : pdm.fragments()) {
+ if (fdm.getId().equals(fragmentId)) {
buffer = fdm.getJarFile().getBuffer();
isvalid = buffer != null;
}
@@ -44,7 +43,7 @@
} else {
isvalid = false;
}
- } catch (NameNotFoundException e){
+ } catch (NameNotFoundException e) {
System.err.println(e);
}
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFmemory.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFmemory.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFmemory.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -30,25 +30,23 @@
*
* @author Andreas H\u00e4nel
*/
-public class JIFSFmemory extends JIFSFile{
+public class JIFSFmemory extends JIFSFile {
- public JIFSFmemory() {
- super("meminfo");
- }
-
- public JIFSFmemory(FSDirectory parent) {
- this();
- setParent(parent);
- }
-
- public void refresh(){
- super.refresh();
- final Runtime rt = Runtime.getRuntime();
- addStringln("Memory size: \n\t" + NumberUtils.toBinaryByte(rt.totalMemory()));
- addStringln("Used memory: \n\t" + NumberUtils.toBinaryByte((rt.totalMemory()-rt.freeMemory())));
- addStringln("Free memory: \n\t" + NumberUtils.toBinaryByte(rt.freeMemory()));
-
- }
+ public JIFSFmemory() {
+ super("meminfo");
+ }
-
+ public JIFSFmemory(FSDirectory parent) {
+ this();
+ setParent(parent);
+ }
+
+ public void refresh() {
+ super.refresh();
+ final Runtime rt = Runtime.getRuntime();
+ addStringln("Memory size: \n\t" + NumberUtils.toBinaryByte(rt.totalMemory()));
+ addStringln("Used memory: \n\t" +
+ NumberUtils.toBinaryByte((rt.totalMemory() - rt.freeMemory())));
+ addStringln("Free memory: \n\t" + NumberUtils.toBinaryByte(rt.freeMemory()));
+ }
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFplugin.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFplugin.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFplugin.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -33,67 +33,62 @@
/**
* File, which contains information about the plugin with the same name.
- *
+ *
* @author Andreas H\u00e4nel
*/
-public class JIFSFplugin extends JIFSFile{
+public class JIFSFplugin extends JIFSFile {
- public JIFSFplugin() {
- return;
- }
+ public JIFSFplugin() {
+ return;
+ }
- /**
- * Creates a file, which contains information about a Plugin.
- *
- *@param name
- * Name of this file <u>and</u> name of the plugin, whose information is stored in this file.
- *@param parent
- * Parent FSEntry, in this case it is an instance of JIFSDplugins.
- */
- public JIFSFplugin(String name, FSDirectory parent) {
- super(name,parent);
- refresh();
- }
+ /**
+ * Creates a file, which contains information about a Plugin.
+ *
+ * @param name Name of this file <u>and</u> name of the plugin, whose
+ * information is stored in this file.
+ * @param parent Parent FSEntry, in this case it is an instance of
+ * JIFSDplugins.
+ */
+ public JIFSFplugin(String name, FSDirectory parent) {
+ super(name, parent);
+ refresh();
+ }
- public void refresh(){
- super.refresh();
- try{
- final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME);
- final PluginDescriptor descr = mgr.getRegistry().getPluginDescriptor(name);
- if (descr != null) {
- addStringln("Name:");
- addStringln("\t"+descr.getId());
- addStringln("Provider:");
- addStringln("\t"+descr.getProviderName());
- addStringln("State :");
+ public void refresh() {
+ super.refresh();
+ try {
+ final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME);
+ final PluginDescriptor descr = mgr.getRegistry().getPluginDescriptor(name);
+ if (descr != null) {
+ addStringln("Name:");
+ addStringln("\t" + descr.getId());
+ addStringln("Provider:");
+ addStringln("\t" + descr.getProviderName());
+ addStringln("State :");
- try {
- if (descr.getPlugin().isActive()) {
- addStringln("\tactive");
- } else {
- addStringln("\tinactive");
- }
- } catch (PluginException PE){
- System.err.println(PE);
- }
+ try {
+ if (descr.getPlugin().isActive()) {
+ addStringln("\tactive");
+ } else {
+ addStringln("\tinactive");
+ }
+ } catch (PluginException PE) {
+ System.err.println(PE);
+ }
- addStringln("Prerequisites:");
- PluginPrerequisite[] allPreqs = descr.getPrerequisites();
- PluginPrerequisite current;
- for (int i =0 ; i<allPreqs.length; i++){
- current = allPreqs[i];
- addStringln("\t"+current.getPluginId()+"\t\t"+current.getPluginVersion());
- }
-
-
- } else {
- isvalid = false;
- }
- } catch (NameNotFoundException N){
- System.err.println(N);
- }
- }
-
-
-
+ addStringln("Prerequisites:");
+ PluginPrerequisite[] allPreqs = descr.getPrerequisites();
+ PluginPrerequisite current;
+ for (int i = 0; i < allPreqs.length; i++) {
+ current = allPreqs[i];
+ addStringln("\t" + current.getPluginId() + "\t\t" + current.getPluginVersion());
+ }
+ } else {
+ isvalid = false;
+ }
+ } catch (NameNotFoundException N) {
+ System.err.println(N);
+ }
+ }
}
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFpluginJar.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFpluginJar.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFpluginJar.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -1,53 +1,54 @@
package org.jnode.fs.jifs.files;
+import java.nio.ByteBuffer;
+
+import javax.naming.NameNotFoundException;
+
+import org.jnode.fs.FSDirectory;
import org.jnode.fs.jifs.JIFSFile;
-import org.jnode.fs.FSDirectory;
+import org.jnode.naming.InitialNaming;
import org.jnode.plugin.PluginManager;
import org.jnode.plugin.model.PluginDescriptorModel;
-import org.jnode.naming.InitialNaming;
-import javax.naming.NameNotFoundException;
-import java.nio.ByteBuffer;
-
/**
- *
* @author Levente S\u00e1ntha
*/
public class JIFSFpluginJar extends JIFSFile {
private String id;
protected ByteBuffer buffer;
+
public JIFSFpluginJar() {
return;
}
- /**
- *
- */
public JIFSFpluginJar(String id, FSDirectory parent) {
super(id + ".jar", parent);
this.id = id;
refresh();
}
- public void refresh(){
- try{
+ public void refresh() {
+ try {
final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME);
- PluginDescriptorModel pdm = (PluginDescriptorModel) mgr.getRegistry().getPluginDescriptor(id);
- if(pdm != null){
+ PluginDescriptorModel pdm =
+ (PluginDescriptorModel) mgr.getRegistry().getPluginDescriptor(id);
+ if (pdm != null) {
buffer = pdm.getJarFile().getBuffer();
isvalid = buffer != null;
} else {
isvalid = false;
}
- } catch (NameNotFoundException e){
+ } catch (NameNotFoundException e) {
System.err.println(e);
}
}
- public void read(long fileOffset, ByteBuffer destBuf){
+ public void read(long fileOffset, ByteBuffer destBuf) {
refresh();
- if(buffer == null) return;
+ if (buffer == null) {
+ return;
+ }
ByteBuffer buf = buffer;
buf.position((int) fileOffset);
buf = (ByteBuffer) buf.slice().limit(destBuf.remaining());
@@ -56,7 +57,9 @@
public long getLength() {
refresh();
- if(buffer == null) return 0;
+ if (buffer == null) {
+ return 0;
+ }
ByteBuffer buf = buffer;
buf.position(0);
return buf.remaining();
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFthread.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFthread.java 2008-06-07 10:22:01 UTC (rev 4208)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/files/JIFSFthread.java 2008-06-07 11:48:31 UTC (rev 4209)
@@ -29,56 +29,44 @@
*
* @author Andreas H\u00e4nel
*/
-public class JIFSFthread extends JIFSFile{
+public class JIFSFthread extends JIFSFile {
- private Thread t;
-
- public JIFSFthread() {
- return;
- }
-
-/**
- * Creates the file, which contains information about the given Thread.
- *
- * @param String name
- * Filename.
- * @param Thread t
- * The Thread, whose information is presented via this file.
- * @param parent
- * Parent FSEntry, in this case it is an instance of JIFSDplugins.
- */
- public JIFSFthread(String name, Thread t, FSDirectory parent) {
- super(name,parent);
- this.t = t;
- refresh();
- }
-
- public void refresh(){
- if (t == null) {
- isvalid=false;
- return;
- }
- super.refresh();
- addStringln("ID:");
- addStringln("\t"+t.getId());
- addStringln("Name:");
- addStringln("\t"+t.getName());
- addStringln("Priority:");
- int i = new Integer((60 / (Thread.MAX_PRIORITY - Thread.MIN_PRIORITY)) * t.getPriority()).intValue();
- String hashes="";
- String blanks="";
- int j = 60-i;
- while (i>0){
- hashes += "#";
- i--;
- }
- while (j>0){
- blanks += " ";
- j--;
- }
- addStringln("\tLOW["+hashes+blanks+"]HIGH");
- }
+ private Thread t;
-
+ public JIFSFthread() {
+ return;
+ }
+ /**
+ * Creates the file, which contains information about the given Thread.
+ *
+ * @param String name Filename.
+ * @param Thread t The Thread, whose information is presented via this file.
+ * @param parent Parent FSEntry, in this case it is an instance of
+ * JIFSDplugins.
+ */
+ public JIFSFthread(String name, Thread t, FSDirectory parent) {
+ super(name, pa...
[truncated message content] |