Package org.eclipse.orion.server.core.resources

Examples of org.eclipse.orion.server.core.resources.FileLocker.lock()


        throw new RuntimeException("Meta File Error, parent is not a folder");
      }
      File newFile = retrieveMetaFile(parent, name);
      FileLocker locker = new FileLocker(newFile);
      try {
        locker.lock();
      } catch (IOException e) {
        Logger logger = LoggerFactory.getLogger("org.eclipse.orion.server.config"); //$NON-NLS-1$
        logger.error("Meta File Error, file IO error, could not lock the file", e); //$NON-NLS-1$
        throw new RuntimeException("Meta File Error, file IO error, could not lock the file", e);
      }
View Full Code Here


      throw new RuntimeException("Meta File Error, cannot delete, does not exist.");
    }
    File savedFile = retrieveMetaFile(parent, name);
    FileLocker locker = new FileLocker(savedFile);
    try {
      locker.lock();
      if (!savedFile.delete()) {
        throw new RuntimeException("Meta File Error, cannot delete file.");
      }
    } catch (IOException e) {
      throw new RuntimeException("Meta File Error, cannot delete file.", e);
View Full Code Here

        return null;
      }
      File savedFile = retrieveMetaFile(parent, name);
      char[] chars = new char[(int) savedFile.length()];
      FileLocker locker = new FileLocker(savedFile);
      locker.lock();
      try {
        FileInputStream fileInputStream = new FileInputStream(savedFile);
        Charset utf8 = Charset.forName("UTF-8");
        InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, utf8);
        inputStreamReader.read(chars);
View Full Code Here

      if (!isMetaFile(parent, name)) {
        throw new RuntimeException("Meta File Error, cannot update, does not exist.");
      }
      File savedFile = retrieveMetaFile(parent, name);
      FileLocker locker = new FileLocker(savedFile);
      locker.lock();
      try {
        FileOutputStream fileOutputStream = new FileOutputStream(savedFile);
        Charset utf8 = Charset.forName("UTF-8");
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, utf8);
        outputStreamWriter.write(jsonObject.toString(4));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.