Package net.sf.joafip.store.service.objectio

Examples of net.sf.joafip.store.service.objectio.ObjectIOException


   */
  public void closeChangeLog() throws ObjectIOException {
    try {
      changeFileOutputStream.close();
    } catch (final IOException exception) {
      throw new ObjectIOException(exception);
    }
  }
View Full Code Here


      if (toWrite == null) {
        toWrite = objectAndPersistInfo;
      }
    }
    if (!objectAndPersistInfo.isLoadedOrNotAProxy()) {
      throw new ObjectIOException("can not store not loaded object");
    }
    final DataRecordIdentifier dataRecordIdentifier = toWrite.dataRecordIdentifier;
    // /**/getKnownDataRecordIdentifierAssociatedToObject(toWrite);
    if (logger.debugEnabled) {
      logger.debug("begin store: data record " + dataRecordIdentifier);
    }

    /* the object class can be different than object.getClass() */
    final IObjectOutput objectOutput;
    objectOutput = getObjectOutput(classInfo);
    assert !toWrite.isSubstituted();
    objectOutput.prepareWrite(toWrite);

    final int byteSizeForObject = objectOutput.byteSize(toWrite,
        HEADER_DATA_SIZE);
    /*
     * "long byte size" added to length for object and store data record
     * identifier
     */

    final byte[] binary = new byte[HelperBinaryConversion.INT_BYTE_SIZE
        + HelperBinaryConversion.LONG_BYTE_SIZE + byteSizeForObject];

    int offset = 0;
    try {
      /* first data is data record identifier */
      offset = helperBinaryConversion.longConverter.toBinary(binary,
          offset, true, dataRecordIdentifier.value);

      /* second is data for object length */
      offset = helperBinaryConversion.integerConverter.toBinary(binary,
          offset, true, byteSizeForObject);

      /* third data is class name identifier */
      final int classNameIdentifier = classNameManager
          .getIdentifier(classInfo);
      /* the data header */
      offset = helperBinaryConversion.integerConverter.toBinary(binary,
          offset, true, Integer.valueOf(classNameIdentifier));
    } catch (final BinaryConverterException exception) {
      throw new ObjectIOException(exception);
    }

    if (offset != HEADER_DATA_SIZE) {
      throw new ObjectIOException("header data size miss match");
    }

    /* then object serialization */
    objectOutput.writeBody(binary, offset, toWrite, false);

    try {
      changeFileOutputStream.write(binary, 0, binary.length);
    } catch (final IOException exception) {
      throw new ObjectIOException(exception);
    }

    if (logger.debugEnabled) {
      logger.debug("end store: data record " + dataRecordIdentifier);
    }
View Full Code Here

    /**/new TreeMap<DataRecordIdentifier, byte[]>();
    FileInputStream changeFileInputStream;
    try {
      changeFileInputStream = /**/new FileInputStream(fileName);
    } catch (final FileNotFoundException exception) {
      throw new ObjectIOException(exception);
    }
    try {
      boolean done = false;
      do {
        done = true ^ readOneRecord(changeFileInputStream, map);
      } while (!done);
    } catch (final IOException exception) {
      throw new ObjectIOException(exception);
    } finally {
      try {
        changeFileInputStream.close();
      } catch (final IOException exception) {
        // ignore error
View Full Code Here

      AbstractConverter binaryConverter;
      try {
        binaryConverter = helperBinaryConversion.longConverter;
        binaryConverter.fromBinary(data, 0);
      } catch (final BinaryConverterException exception) {
        throw new ObjectIOException(exception);
      }
      if (!binaryConverter.valueDefinedFromBinary) {
        throw new ObjectIOException(
            "data record identifier value must be defined");
      }
      final Long dataRecordIdentifierValue =
      /**/(Long) binaryConverter.objectFromBinary;
      binaryConverter.objectFromBinary = null;// NOPMD
      final DataRecordIdentifier dataRecordIdentifier =
      /**/new DataRecordIdentifier(dataRecordIdentifierValue);

      /* second get data for object length */
      data = new byte[HelperBinaryConversion.INT_BYTE_SIZE];
      readInChangeFileInputStream(changeFileInputStream, data);
      try {
        binaryConverter = helperBinaryConversion.integerConverter;
        binaryConverter.fromBinary(data, 0);
      } catch (final BinaryConverterException exception) {
        throw new ObjectIOException(exception);
      }
      if (!binaryConverter.valueDefinedFromBinary) {
        throw new ObjectIOException("data length value must be defined");
      }
      final int byteSizeForObject = ((Integer) binaryConverter.objectFromBinary)
          .intValue();
      binaryConverter.objectFromBinary = null;// NOPMD

View Full Code Here

   *
   * @throws ObjectIOException
   *             always throws
   */
  private void unexpectedEndOfFile() throws ObjectIOException {
    throw new ObjectIOException("unexpected end of file");
  }
View Full Code Here

          autoSaveEventListener.saveDone(newNumberOfObjectState,
              numberOfWeakreference, duration);
        }
      }
    } catch (final FilePersistenceException exception) {
      throw new ObjectIOException(exception);
    } catch (final FilePersistenceInvalidClassException exception) {
      throw new ObjectIOException(exception);
    } catch (final FilePersistenceNotSerializableException exception) {
      throw new ObjectIOException(exception);
    } catch (final FilePersistenceClassNotFoundException exception) {
      throw new ObjectIOException(exception);
    } catch (final FilePersistenceDataCorruptedException exception) {
      throw new ObjectIOException(exception);
    } catch (final FilePersistenceTooBigForSerializationException exception) {
      throw new ObjectIOException(exception);
    }
  }
View Full Code Here

  }

  private boolean assertClassExists(final ClassInfo toCreateClassInfo,
      final String message) throws ObjectIOException {
    if (toCreateClassInfo.classDoesNotExist()) {
      throw new ObjectIOException(message);
    }
    return true;
  }
View Full Code Here

      ValuedFieldList valuedFieldList;
      try {
        valuedFieldList = OBJECT_REPLACER.convert(objectIOManager,
            objectAndPersistInfo, fieldValueList);
      } catch (ConversionException exception) {
        throw new ObjectIOException("for "
            + objectAndPersistInfo.toString(), exception);
      }
      setObjectStateFromFieldValueListImpl(objectAndPersistInfo,
          valuedFieldList);
      // ASSERTX
View Full Code Here

      final FromBinaryInfo fromBinaryInfo;
      try {
        fromBinaryInfo = basicOrReferenceInput.fromBinary(binary,
            localOffset);
      } catch (IOException exception) {
        throw new ObjectIOException(exception);
      }
      localOffset = fromBinaryInfo.getEndOffset();
      final ObjectAndPersistInfo fieldAndPersistInfo = fromBinaryInfo
          .getObjectAndPersistInfo();
      fieldList.add(fieldAndPersistInfo);
View Full Code Here

        try {
          setObjectFieldValue(objectAndPersistInfo,
              null/* originalValue */, index, fieldInfo,
              fieldType, fieldValueAndPersistInfo);
        } catch (ObjectIOException exception) {// NOPMD
          throw new ObjectIOException(
              setObjectFieldValueFailureMessage(
                  exception.getMessage(),
                  objectAndPersistInfo, fieldsInfo, index,
                  valuedFieldList), exception);
        } catch (ObjectIOInvalidClassException exception) {// NOPMD
          throw new ObjectIOInvalidClassException(
              setObjectFieldValueFailureMessage(
                  exception.getMessage(),
                  objectAndPersistInfo, fieldsInfo, index,
                  valuedFieldList), exception);
        }
        index++;
      }
    } catch (ClassInfoException exception) {
      throw new ObjectIOException(exception);
    } catch (ConversionException exception) {
      throw new ObjectIOException(exception);
    }
  }
View Full Code Here

TOP

Related Classes of net.sf.joafip.store.service.objectio.ObjectIOException

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.