Package com.hdfs.file.bean

Examples of com.hdfs.file.bean.HdfsMemory


    }
  }

  @Override
  public HdfsMemory findMemory(int memoryId) {
    HdfsMemory memory = new HdfsMemory();
    Session session = this.getSession();
    memory = (HdfsMemory) session.get(HdfsMemory.class, memoryId);
    return memory;
  }
View Full Code Here


  public boolean deleteMemory(int memoryId) {
    // TODO Auto-generated method stub
    Session session = this.getSession();
    try {
      Transaction trans = session.beginTransaction();
      HdfsMemory memory = new HdfsMemory();
      memory.setMemoryId(memoryId);
      session.delete(findMemory(memoryId));

      trans.commit();
      session.close();
      return true;
View Full Code Here

   */

  @Override
  public HdfsMemory getMemory(int memoryId) {
    Session session = this.getSession();
    HdfsMemory memory = (HdfsMemory) session
        .get(HdfsMemory.class, memoryId);
    return memory;
  }
View Full Code Here

  @Override
  public HdfsMemory find(long memoryId) {
    Session session = this.getSession();
    Criteria crit = session.createCriteria(HdfsMemory.class);
    crit.add(Restrictions.eq("memoryId", memoryId));
    HdfsMemory memory = null;
    try {
      memory = (HdfsMemory) crit.uniqueResult();
    } catch (Exception e) {
      return null;
    } finally {
View Full Code Here

      /*
       * 根据用户信息,取出对应的用户空间
       */
      long memoryId = user.getMemoryId();
      HdfsMemory memory = fileservice.getMemory((int) memoryId);

      /*
       * 删除该文件,并更新用户空间的已用空间
       */
      wddescjson = fileservice.deleteFile(fileId, memory);
View Full Code Here

    Users user = new Users();
    user.setUserId((int) userId);
    user = userservice.find(user);

    long memoryId = user.getMemoryId();
    HdfsMemory memory = fileservice.getMemory((int) memoryId);
    int free = memory.getTotalmemory() - memory.getMemoryused();
    /*
     * 将上传的临时文件uploadFile复制到dst文件。
     */
    File dst = new File(ServletActionContext.getServletContext()
        .getContextPath() + "/" + this.getFilename());
View Full Code Here

      /*
       * 根据用户信息,取出对应的用户空间
       */
      long memoryId = user.getMemoryId();
      HdfsMemory memory = fileservice.getMemory((int) memoryId);

      /*
       * 删除该文件,并更新用户空间的已用空间
       */
      wddescjson = fileservice.deleteFile(fileId, memory);

      int free = memory.getTotalmemory() - memory.getMemoryused();
      File newUploadFile = new File(getAbsoluteFilePath());

      if (getUploadType() != 0) { // 加密上传
        /*
         * 判断是否第一次使用加密上传的功能 可以提取users表的public_key字段判断
View Full Code Here

    int total = 0;
    if (type == 2)
      total = 1000000;
    if (type == 1)
      total = 10000000;
    HdfsMemory memory = new HdfsMemory(type, total, 0);
    memory.setMemoryId(userId);
    memory = filedao.saveMemory(memory);
    return memory;

  }
View Full Code Here

    int total = 0;
    if (type == 2)
      total = 1000000;
    if (type == 1)
      total = 10000000;
    HdfsMemory memory = new HdfsMemory(type, total, 0);
    filedao.updateMemory(memory);
  }
View Full Code Here

    // 在hdfs文件系统中为该用户创建一个根目录
    fileservice.rootmkdir(47, user.getUsername(), user.getUserId()
        .longValue(), Long.parseLong(rootId));

    // 创建该用户对应的存储空间
    HdfsMemory memory = fileservice.insertMemory(user.getUserId(), 2);

    // 设置用户关于存储空间Id字段
    user.setMemoryId(memory.getMemoryId());
    userservice.updateUser(user);
    if (this.user == null) {
      return INPUT;
    }
View Full Code Here

TOP

Related Classes of com.hdfs.file.bean.HdfsMemory

Copyright © 2018 www.massapicom. 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.