private void restoreContainers() {
    DirectoryStream<Path> ds = null;
    try {
      Path containersPath = fs.getPath("/containers");
      if (ios.exists(containersPath)) {
        ds =
            ios.newDirectoryStream(
                containersPath,
                new Filter<Path>() {

                  @Override
                  public boolean accept(Path entry) throws IOException {
                    return Files.isDirectory(entry);
                  }
                });
        if (ds != null) {
          XStream xs = XStreamXml.newXStreamMarshaller(KieServerImpl.class.getClassLoader());
          for (Path entry : ds) {
            BufferedReader reader = null;
            try {
              logger.info("Restoring state of kie container '" + entry.getFileName() + "'");
              reader =
                  Files.newBufferedReader(
                      entry.resolve(CONTAINER_STATE_FILE), Charset.forName("UTF-8"));
              KieContainerResource resource = (KieContainerResource) xs.fromXML(reader);
              restore(resource);
            } catch (Exception e) {
              logger.error("Error restoring kie container state", e);
            } finally {
              if (reader != null) {
                try {
                  reader.close();
                } catch (java.io.IOException e) {
                }
              }
            }
          }
        }
      }
    } catch (Exception e) {
      logger.error("Error restoring kie server state", e);
    } finally {
      if (ds != null) ds.close();
    }
  }
 @Override
 public List<Path> listFiles() {
   final DirectoryStream<org.uberfire.java.nio.file.Path> stream =
       ioService.newDirectoryStream(
           root,
           new DirectoryStream.Filter<org.uberfire.java.nio.file.Path>() {
             @Override
             public boolean accept(org.uberfire.java.nio.file.Path entry) throws IOException {
               return typeDefinition.accept(Paths.convert(entry));
             }
           });
   final List<Path> files = new ArrayList<Path>();
   final Iterator<org.uberfire.java.nio.file.Path> itr = stream.iterator();
   while (itr.hasNext()) {
     files.add(Paths.convert(itr.next()));
   }
   return files;
 }