Examples of RboException


Examples of org.rugby.online.core.exception.RboException

    // delete previous version
    boolean previousDeleted = targetFile.delete();
    try {
      targetFile.createNewFile();
      if (previousDeleted) {
        throw new RboException(RboExceptionType.INFO, "file " + filename + " already exists : deletion occured.");
      }
    } catch (IOException e) {
      throw new RboException(RboExceptionType.WARNING, "error creating " + filename + " :\n", e);
   
  }
View Full Code Here

Examples of org.rugby.online.core.exception.RboException

   * @param dir the directory to test
   * @throws RboException when it does not exists
   */
  private static void checkIfDirectoryExist(File dir) throws RboException {
    if (!dir.exists()) {
      throw new RboException(RboExceptionType.ERROR,
          "directory path does not exists.");
    }
  }
View Full Code Here

Examples of org.rugby.online.core.exception.RboException

   * @param dir the directory to test
   * @throws RboException when it does not exists
   */
  private static void checkIsDirectory(File dir) throws RboException {
    if (!dir.isDirectory()) {
      throw new RboException(RboExceptionType.ERROR, "directory path "
          + dir.getPath() + " is not a directory.");
    }
  }
View Full Code Here

Examples of org.rugby.online.core.exception.RboException

          new FileOutputStream(filePath));
      oos.writeObject(obj);
      oos.flush();
      oos.close();
    } catch (FileNotFoundException e) {
      throw new RboException(RboExceptionType.ERROR, "file " + filename
          + " not found :\n", e);
    } catch (IOException e) {
      throw new RboException(RboExceptionType.ERROR, "I/O for file "
          + filename + " :\n", e);
    }
    return true;
  }
View Full Code Here

Examples of org.rugby.online.core.exception.RboException

      FileInputStream fis = new FileInputStream(fileObject);
      ObjectInputStream ois = new ObjectInputStream(fis);
      obj = (Serializable) ois.readObject();
      ois.close();
    } catch (FileNotFoundException e) {
      throw new RboException(RboExceptionType.ERROR, "file object "
          + filePath + " does not exist.", e);
    } catch (IOException e) {
      throw new RboException(RboExceptionType.ERROR, "I/O for file "
          + filePath + " :\n", e);
    } catch (ClassNotFoundException e) {
      throw new RboException(RboExceptionType.ERROR,
          "Class not found from file " + filePath + " :\n", e);
    }
    return obj;
  }
View Full Code Here

Examples of org.rugby.online.core.exception.RboException

    String filePath = getPersistencyPathForClass(clazz) + "/"
        + getFileName(clazz, id);
    File fileObject = new File(filePath);

    if (!fileObject.exists()) {
      throw new RboException(RboExceptionType.ERROR, "file object "
          + filePath + " for UPDATE does not exist : nothing done.");
    } else {
      // Re-write the object directly
      this.writeObject(clazz, id, obj);
    }
View Full Code Here

Examples of org.rugby.online.core.exception.RboException

        + getFileName(clazz, id);
    File fileObject = new File(filePath);
   
    // Delete the object
    if (!fileObject.delete()) {
      throw new RboException(RboExceptionType.WARNING, "file object "
          + filePath + " for DELETE does not exist.");
    }
    return true;
  }
View Full Code Here

Examples of org.rugby.online.core.exception.RboException

  public void init() throws RboException {
    if (strategy == null) {
      strategy = new DefaultPersistencyStrategy();
    }
    if (strategy == null) {
      throw new RboException(RboExceptionType.ERROR,
          "Persistency strategy failed to init.");
    }
  }
View Full Code Here

Examples of org.rugby.online.core.exception.RboException

        String line = null;
        while ((line = bfr.readLine()) != null) {
          lines.add(line);
        }
      } catch (FileNotFoundException e) {
        throw new RboException(RboExceptionType.ERROR, "file not found", e);
      } catch (IOException e) {
        throw new RboException(RboExceptionType.ERROR, "streaming error", e);
      }
    }
    else {
      throw new RboException(RboExceptionType.ERROR, "file for first name not accessible.");
    }
   
    // Check that lines has been found
    if (lines.size() > 0) {
      return lines.get(new Random(UUID.randomUUID().getLeastSignificantBits()).nextInt(lines.size()));
    } else {
      throw new RboException(RboExceptionType.WARNING, "no name found");
    }
  }
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.