GridFileSystem examples

WARNING - TOPIC NOT WRITTEN - TOPIC ID: 1746

This topic has not yet been written. The content below is from the topic description.
Here is a quick code snippet demonstrating usage:   Cache data = cacheManager.getCache(“distributed�); Cache metadata = cacheManager.getCache(“replicated�);   GridFilesystem fs = new GridFilesystem(data, metadata);   // create directories File file=fs.getFile("/tmp/testfile/stuff"); fs.mkdirs(); // creates directories /tmp/testfile/stuff   // List all files and directories under "/usr/local" file=fs.getFile("/usr/local"); File[] files=file.listFiles();   // Create a new file file=fs.getFile("/tmp/testfile/stuff/README.txt"); file.createNewFile();   Copying stuff to the grid file system:   InputStream in=new FileInputStream("/tmp/my-movies/dvd-image.iso"); OutputStream out=fs.getOutput("/grid-movies/dvd-image.iso"); byte[] buffer=new byte[20000]; int len; while((len=in.read(buffer, 0, buffer.length)) != -1) out.write(buffer, 0, len); in.close(); out.close();   Reading stuff from the grid:   InputStream in=in.getInput("/grid-movies/dvd-image.iso"); OutputStream out=new FileOutputStream("/tmp/my-movies/dvd-image.iso"); byte[] buffer=new byte[20000]; int len; while((len=in.read(buffer, 0, buffer.length)) != -1) out.write(buffer, 0, len); in.close(); out.close(); WebDAV demo Infinispan 4.1.0 also ships with a demo WebDAV application that makes use of the grid file system APIs.  This demo app is packaged as a WAR file which can be deployed in a servlet container, such as JBoss AS or Tomcat, and exposes the grid as a file system over WebDAV.  This could then be mounted as a remote drive on your operating system.   Here is a short video clip showcasing this demo.