out.close();
log.debug("done");
return;
}
RootVFS rootfs = null;
RegistryContext ctx = new RegistryContext();
try {
rootfs = (RootVFS) ctx.lookup("java:/CP2/VFS");
} catch(ClassCastException ex) {
error("VFS bound at java:/CP2/VFS is not RootVFS");
return;
} catch(NameNotFoundException ex) {
error("Root VFS not bound (should be at: java:/CP2/VFS)");
return;
}
if(params.length == 0) {
Iterator it = rootfs.listMounts().entrySet().iterator();
while(it.hasNext()) {
Map.Entry ent = (Map.Entry) it.next();
out.println(ent.getKey() + "\t\t" + ent.getValue());
}
out.flush();
return;
}
String path = params[0];
String jndi = params[1];
VFS vfs = null;
try {
vfs = (VFS) ctx.lookup(jndi);
} catch(NameNotFoundException ex) {
error("No VFS bound at: " + jndi);
return;
}
if(rootfs instanceof RootVFS) {
rootfs.mount(path, vfs);
} else {
error("Root VFS does not implement RootVFS - doesn't support mounting");
return;
}