Clover coverage report -
Coverage timestamp: Fri Nov 19 2004 13:41:51 PST
file stats: LOC: 62   Methods: 4
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SlideContext.java 0% 0% 0% 0%
coverage
 1    package photospace.vfs;
 2   
 3    import java.io.*;
 4    import org.apache.slide.common.*;
 5    import org.springframework.context.*;
 6    import org.springframework.core.io.*;
 7   
 8    /**
 9    * SlideContext initializes the Slide domain. This is b/c the SimpleFileStore rootpath
 10    * needs to be configured according to config available in the Spring context.
 11    * <p>
 12    * This implementation relies on the Slide behavior that once the Domain is initialized
 13    * it can not be re-initialized. Since Spring loads before the Slide WebDavServlet,
 14    * Spring wins.
 15    */
 16    public class SlideContext
 17    implements java.io.Serializable, ResourceLoaderAware
 18    {
 19   
 20    private static final String TOKEN = "@media.root@";
 21   
 22    private FileSystem filesystem;
 23    private String config;
 24    private ResourceLoader resourceLoader;
 25   
 26  0 public void init()
 27    throws Exception
 28    {
 29  0 BufferedReader reader = new BufferedReader(new FileReader(resourceLoader.getResource(config).getFile()));
 30  0 StringBuffer content = new StringBuffer();
 31  0 String line = null;
 32  0 while ((line = reader.readLine()) != null)
 33    {
 34  0 int pos = line.indexOf(TOKEN);
 35  0 if (pos != -1)
 36    {
 37  0 line = line.substring(0, pos) +
 38    filesystem.getRoot().getPath().replaceAll("\\\\", "/") +
 39    line.substring(pos + TOKEN.length());
 40    }
 41  0 content.append(line);
 42    }
 43  0 InputStream in = new ByteArrayInputStream(content.toString().getBytes());
 44  0 Domain.init(in);
 45    }
 46   
 47  0 public void setFilesystem(FileSystem filesystem)
 48    {
 49  0 this.filesystem = filesystem;
 50    }
 51   
 52  0 public void setConfig(String config)
 53    {
 54  0 this.config = config;
 55    }
 56   
 57   
 58  0 public void setResourceLoader(ResourceLoader resourceLoader)
 59    {
 60  0 this.resourceLoader = resourceLoader;
 61    }
 62    }