Ejemplo n.º 1
0
  /** This Constructor is used to create metaInfo during sending. */
  private MetaInfo(
      String fileId,
      int blockSize,
      int thresholdSize,
      String transId,
      String originalEventId,
      int totalBlocks,
      int lastBlockSize)
      throws FileAccessException, ApplicationException {
    _subPath = getSubPath(fileId);

    if (FileHelper.exist(IPackagingConstants.PACKAGING_PATH, _subPath, META_INFO_FILENAME)) {
      getMetaInfoFromFile(fileId);
      checkMetaInfo(
          fileId, blockSize, thresholdSize, transId, originalEventId, totalBlocks, lastBlockSize);
    } else {
      _fileId = fileId;
      _transId = transId;
      _blockSize = blockSize;
      _thresholdSize = thresholdSize;
      _originalEventId = originalEventId;
      _totalBlocks = totalBlocks;
      _lastBlockSize = lastBlockSize;
      createMetaInfo();
      storeMetaInfoIntoFile();
    }
  }
Ejemplo n.º 2
0
 /** This Constructor is used to create metaInfo when receiving. */
 private MetaInfo(String fileId, int totalBlocks)
     throws FileAccessException, ApplicationException {
   _subPath = getSubPath(fileId);
   if (FileHelper.exist(IPackagingConstants.PACKAGING_PATH, _subPath, META_INFO_FILENAME)) {
     getMetaInfoFromFile(fileId);
     checkMetaInfo(fileId);
     if (_totalBlocks < totalBlocks) {
       _totalBlocks = totalBlocks; // new total Block value
       storeMetaInfoIntoFile();
     }
   } else {
     _fileId = fileId;
     createMetaInfo();
     if (_totalBlocks < totalBlocks) _totalBlocks = totalBlocks;
     storeMetaInfoIntoFile();
   }
 }
Ejemplo n.º 3
0
 /** This Constructor is used to create metaInfo when receiving acknowledgement. */
 private MetaInfo(String fileId) throws FileAccessException {
   _subPath = getSubPath(fileId);
   if (FileHelper.exist(IPackagingConstants.PACKAGING_PATH, _subPath, META_INFO_FILENAME))
     getMetaInfoFromFile(fileId);
   else throw new FileAccessException("Meta Info file not found!");
 }