Package net.sf.joafip.store.entity.objectio

Examples of net.sf.joafip.store.entity.objectio.ObjectAndPersistInfo


      try {
        // data is field value object
        final ObjectModelForImport fieldObjectModel = (ObjectModelForImport) data;

        final ObjectAndPersistInfo fieldObjectAndPersistInfo =
        /**/createObjectAndPersistInfo(fieldObjectModel);

        final FieldInfo fieldInfo = createFieldInfo(
            currentFieldDeclaringClassDef.getClassInfo(),
            fieldTypeDef.getClassInfo(), currentFieldName,
View Full Code Here


  public ObjectAndPersistInfo substituteForWrite(
      final ObjectAndPersistInfo objectAndPersistInfo)
      throws ObjectIOException, ObjectIODataCorruptedException {
    assertNotSubstituted(objectAndPersistInfo);
    ObjectAndPersistInfo result;
    final ClassInfo classInfo = objectAndPersistInfo.objectClassInfo;
    final ClassInfo substituteClassInfo = classInfo
        .getSubstituteClassInfo();
    result = objectAndPersistInfo.getSubstituteObjectAndPersistInfo();
    if (result == null) {
View Full Code Here

      final DataRecordIdentifier dataRecordIdentifier,
      final boolean notLazy) throws ObjectIOException,
      ObjectIODataRecordNotFoundException,
      ObjectIOClassNotFoundException, ObjectIOInvalidClassException,
      ObjectIODataCorruptedException, ObjectIONotSerializableException {
    ObjectAndPersistInfo objectAndPersistInfo = getObjectByIdentifier(dataRecordIdentifier);
    if (objectAndPersistInfo == null) {
      objectAndPersistInfo = createObjectReadingInStore(
          dataRecordIdentifier, notLazy);
    }
    return objectAndPersistInfo;
View Full Code Here

    headerReader.read(binary, dataRecordIdentifier);
    final ClassInfo classInfo = headerReader.objectClassInfo;
    assertStorable(classInfo);
    final Deque<ClassReplacementDef> replacementDef = replacementDefForHeader(classInfo);

    final ObjectAndPersistInfo objectAndPersistInfo;

    final StorageInfo storageInfo = new StorageInfo();
    storageInfo.setReplacementDefList(replacementDef);
    storageInfo.setHeaderDataSize(headerReader.headerDataSize);
    storageInfo.setJoafipReleaseId(headerReader.joafipReleaseId);
    storageInfo.setDataModelIdentifier(headerReader.dataModelIdentifier);

    if (replacementDef.isEmpty()) {

      // ASSERTX
      assert assertClassExists(classInfo);
      /* create the object */
      objectAndPersistInfo = createObjectReadingInStore(
          dataRecordIdentifier, classInfo, storageInfo, notLazy,
          binary);
      // ASSERTX
      assert assertObjectCreated(classInfo, objectAndPersistInfo);
      // ASSERTX
      assert assertHasPersistenceState(objectAndPersistInfo);

    } else {
      /*
       * create the replacement object and convert from stored state of
       * original object
       */

      // ASSERTX
      assert assertOriginalClassInfo(classInfo, replacementDef);

      final ClassInfo replacementClassInfo = replacementDef.peekLast()
          .getReplacementClass();

      // create replacement object
      if (replacementClassInfo.classExists()) {
        objectAndPersistInfo = createObjectReadingInStore(
            dataRecordIdentifier, replacementClassInfo,
            storageInfo, notLazy, binary);
      } else if (replacementClassInfo.isKnownAsNotExisting()) {
        try {
          objectAndPersistInfo = new ObjectAndPersistInfo(null,
              false, replacementClassInfo, storageInfo);
        } catch (final ClassInfoException exception) {
          throw new ObjectIOException(exception);
        }
      } else {
View Full Code Here

      final boolean notLazy, final byte[] binary)
      throws ObjectIOException, ObjectIODataRecordNotFoundException,
      ObjectIOClassNotFoundException, ObjectIOInvalidClassException,
      ObjectIODataCorruptedException, ObjectIONotSerializableException {
    final IObjectInput objectInput = getObjectInput(classInfo, notLazy);
    final ObjectAndPersistInfo objectAndPersistInfo;
    try {
      objectAndPersistInfo = objectInput.createObject(
          dataRecordIdentifier, binary, classInfo, storageInfo);
    } catch (final RuntimeException exception) {
      logger.fatal("error creating object of class "
          + classInfo.toString() + "\ndata record identifier "
          + dataRecordIdentifier + "\nusing object input "
          + objectInput.getClass().getName());
      throw exception;
    } catch (final ObjectIOException exception) {
      final String message = "error creating object of class "
          + classInfo.toString() + "\ndata record identifier "
          + dataRecordIdentifier;
      logger.fatal(message);
      throw new ObjectIOException(message, exception);
    }
    assert assertTransformed(objectInput, objectAndPersistInfo);
    assertNotSubstituted(objectAndPersistInfo);
    setInstanceFactoryFieldsOfObject(objectAndPersistInfo);
    // not a new object to add to storage, created reading in storage
    objectAndPersistInfo.setNewObject(false);
    return objectAndPersistInfo;
  }
View Full Code Here

  protected ObjectAndPersistInfo originalObjectAndPersistInfo(
      final ObjectAndPersistInfo objectAndPersistInfo)
      throws ObjectIOException, ObjectIODataCorruptedException,
      ObjectIODataRecordNotFoundException, ObjectIOInvalidClassException,
      ObjectIOClassNotFoundException, ObjectIONotSerializableException {
    final ObjectAndPersistInfo result;
    if (objectAndPersistInfo.isSubstitution()) {

      final ClassInfo classInfo = objectAndPersistInfo.objectClassInfo;
      final Object object = objectAndPersistInfo.getObject();
      final Object substitutedObject;
View Full Code Here

      final ObjectAndPersistInfo objectAndItsPersistInfo)
      throws ObjectIOException, ObjectIOInvalidClassException,
      ObjectIONotSerializableException, ObjectIOClassNotFoundException,
      ObjectIODataRecordNotFoundException, ObjectIODataCorruptedException {
    // will write original object else will write the substitute
    ObjectAndPersistInfo toWriteObjectAndPersistInfo =
    /**/objectAndItsPersistInfo.getSubstituteObjectAndPersistInfo();
    if (toWriteObjectAndPersistInfo == null) {
      toWriteObjectAndPersistInfo = objectAndItsPersistInfo;
    }
    assert !toWriteObjectAndPersistInfo.isSubstituted();

    // ASSERTX
    assert assertWritable(toWriteObjectAndPersistInfo);
    final DataRecordIdentifier dataRecordIdentifier = toWriteObjectAndPersistInfo.dataRecordIdentifier;
    if (logger.debugEnabled) {
      logger.debug("begin write: data record " + dataRecordIdentifier);
    }

    /* the object class can be different than object.getClass() */
    final ClassInfo classInfo = toWriteObjectAndPersistInfo.objectClassInfo;
    // ASSERTX
    assert classInfo != null && classInfo != ClassInfo.NULL : "class information for object not defined";
    final IObjectOutput objectOutput;
    objectOutput = getObjectOutput(classInfo);
    final int byteSize = objectOutput.byteSize(toWriteObjectAndPersistInfo,
        HEADER_DATA_SIZE);
    final byte[] binary = new byte[byteSize];
    final int offset = headerWriter.write(classInfo, binary);
    if (offset != HEADER_DATA_SIZE) {
      throw new ObjectIOException("header data size missmatch");
    }
    final ObjectClassInfoAndDeclared[] sonObject = objectOutput.writeBody(
        binary, offset, toWriteObjectAndPersistInfo, true);

    writeDataRecord(dataRecordIdentifier, binary);

    if (logger.debugEnabled) {
      logger.debug("end write: data record " + dataRecordIdentifier);
    }
    toWriteObjectAndPersistInfo.setNewObject(false);
    return sonObject;
  }
View Full Code Here

    // throw new ObjectIOException("is not storable "
    // + objectAndPersistInfo.toString());
    // }
    // final Object object = objectAndPersistInfo.getObject();

    ObjectAndPersistInfo toWriteObjectAndPersistInfo;
    toWriteObjectAndPersistInfo = keptInMemorysubstituteObject(objectAndPersistInfo);
    if (toWriteObjectAndPersistInfo == null) {
      toWriteObjectAndPersistInfo =
      /**/substituteObject(objectAndPersistInfo);
      if (toWriteObjectAndPersistInfo == null) {
        toWriteObjectAndPersistInfo = objectAndPersistInfo;
      }
    }
    final ClassInfo toWriteClassInfo = toWriteObjectAndPersistInfo.objectClassInfo;
    assert assertWritable(toWriteObjectAndPersistInfo);
    final Object object = toWriteObjectAndPersistInfo.getObject();
    final IObjectOutput objectOutput;
    // ASSERTX
    assert assertHasInstance(toWriteObjectAndPersistInfo, object);
    objectOutput = getObjectOutput(toWriteClassInfo);
    assert !toWriteClassInfo.isSubstituted();
View Full Code Here

  }

  protected ObjectAndPersistInfo substituteObject(
      final ObjectAndPersistInfo objectAndPersistInfo)
      throws ObjectIOException, ObjectIODataCorruptedException {
    ObjectAndPersistInfo substituteObjectAndPersistInfo;
    if (objectAndPersistInfo.objectClassInfo.isSubstituted()) {
      substituteObjectAndPersistInfo = objectAndPersistInfo
          .getSubstituteObjectAndPersistInfo();

      if (substituteObjectAndPersistInfo == null) {
View Full Code Here

  public ObjectAndPersistInfo getOrCreateObjectPersistInfoOfObject(
      final Object object, final Boolean proxyInstance,
      final ClassInfo objectClassInfo, final boolean persisted)
      throws ObjectIOException, ObjectIODataCorruptedException {
    // FIXMELUC x is persisted equal false possible ?
    ObjectAndPersistInfo objectPersistInfoOfObject;
    if (object == null) {
      objectPersistInfoOfObject = ObjectAndPersistInfo.NULL;
    } else if (persisted) {
      objectPersistInfoOfObject = getObjectAndPersistInfoOfObject(object);
      if (objectPersistInfoOfObject == null) {
        objectPersistInfoOfObject = createObjectAndPersistInfoOfObject(
            object, proxyInstance, objectClassInfo);
      }
    } else {
      final boolean objectIsProxyInstance;
      if (proxyInstance == null) {
        objectIsProxyInstance = ProxyManager2.isProxyOrEnhanced(object);
      } else {
        objectIsProxyInstance = proxyInstance.booleanValue();
        assert objectIsProxyInstance == ProxyManager2
            .isProxyOrEnhanced(object);
      }
      try {
        objectPersistInfoOfObject = new ObjectAndPersistInfo(object,
            objectIsProxyInstance, objectClassInfo);
      } catch (final ClassInfoException exception) {
        throw new ObjectIOException(exception);
      }
      assert assertProxyInstanceState(object, objectIsProxyInstance,
View Full Code Here

TOP

Related Classes of net.sf.joafip.store.entity.objectio.ObjectAndPersistInfo

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.