Package fi.foyt.hibernate.gae.search.persistence.domainmodel

Examples of fi.foyt.hibernate.gae.search.persistence.domainmodel.FileSegment


        switchCurrentSegment();
      }
 
      FileSegmentDAO fileSegmentDAO = new FileSegmentDAO();
     
      FileSegment fileSegment = getCurrentSegment();
      byte[] segmentData = getSegmentData(fileSegment, segmentPosition + 1);
      segmentData[segmentPosition++] = b;
      fileSegmentDAO.updateData(fileSegment, segmentData);
    } catch (Exception e) {
      throw new IOException(e);
View Full Code Here


          currentSegmentIndex++;
          switchCurrentSegment();
        }
       
        FileSegmentDAO fileSegmentDAO = new FileSegmentDAO();
        FileSegment fileSegment = getCurrentSegment();
        int remainInSegment = GaeFile.SEGMENT_SIZE - segmentPosition;
        int bytesToCopy = len < remainInSegment ? len : remainInSegment;
       
        byte[] segmentData = getSegmentData(fileSegment, segmentPosition + bytesToCopy);
 
View Full Code Here

  public FileSegmentDAO() {
    super("FILESEGMENT", true);
  }

  public FileSegment create(File file, Long segmentNo, byte[] data) {
    FileSegment fileSegment = new FileSegment(file);
    fileSegment.setData(data);
    fileSegment.setSegmentNo(segmentNo);
    persist(fileSegment);
   
    String lookupKey = FILE_SEGMENTNO_LOOKUP + file.getKey() + "," + segmentNo;
    putLookupKey(lookupKey, fileSegment.getKey());
    updateCountCache(file, countByFile(file) + 1);
    return fileSegment;
  }
View Full Code Here

    }
   
    Query query = new Query(getKind(), file.getKey())
      .addFilter("segmentNo", FilterOperator.EQUAL, segmentNo);
   
    FileSegment fileSegment = getSingleObject(query);

    if (fileSegment != null) {
      putLookupKey(lookupKey, fileSegment.getKey());
    } else {
      putLookupKey(lookupKey, createNullLookupKey());
    }
   
    return fileSegment;
View Full Code Here

    return currentSegmentIndex < 0 ? 0 : segmentStart + segmentPosition;
  }

  @Override
  public void seek(long pos) throws IOException {
    FileSegment fileSegment = getCurrentSegment();

    if (fileSegment == null || pos < segmentStart || pos >= segmentStart + GaeFile.SEGMENT_SIZE) {
      currentSegmentIndex = (int) (pos / GaeFile.SEGMENT_SIZE);
      switchCurrentSegment(false);
    }
View Full Code Here

TOP

Related Classes of fi.foyt.hibernate.gae.search.persistence.domainmodel.FileSegment

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.