예제 #1
0
  @Override
  protected void indicating(CDODataInput in, OMMonitor monitor) throws IOException {
    try {
      monitor.begin();
      Async async = monitor.forkAsync();

      try {
        int viewID = in.readInt();
        CDOBranchPoint branchPoint = in.readCDOBranchPoint();

        int size = in.readInt();
        List<CDOID> invalidObjects = new ArrayList<CDOID>(size);
        for (int i = 0; i < size; i++) {
          CDOID id = in.readCDOID();
          invalidObjects.add(id);
        }

        InternalView view = getSession().getView(viewID);
        view.changeTarget(branchPoint, invalidObjects, allChangedObjects, allDetachedObjects);
      } finally {
        async.stop();
      }

    } finally {
      monitor.done();
    }
  }
  @Override
  public void read(ExtendedDataInput in) throws IOException {
    // TODO: change the parameter to prevent casting to CDODataInput
    CDODataInput cdoDataInput = (CDODataInput) in;
    classifierRef = cdoDataInput.readCDOClassifierRef();

    // and let the super take care of the rest
    super.read(in);
  }
예제 #3
0
 @Override
 protected UnlockObjectsResult confirming(CDODataInput in) throws IOException {
   long timestamp = in.readLong();
   int n = in.readInt();
   CDOLockState[] newLockStates = new CDOLockState[n];
   for (int i = 0; i < n; i++) {
     newLockStates[i] = in.readCDOLockState();
   }
   return new UnlockObjectsResult(newLockStates, timestamp);
 }
예제 #4
0
  @Override
  protected LockObjectsResult confirming(CDODataInput in) throws IOException {
    boolean succesful = in.readBoolean();
    boolean timeout = in.readBoolean();
    boolean waitForUpdate = in.readBoolean();
    long requiredTimestamp = in.readLong();

    int nStaleRevisions = in.readInt();
    CDORevisionKey[] staleRevisions = new CDORevisionKey[nStaleRevisions];
    for (int i = 0; i < nStaleRevisions; i++) {
      staleRevisions[i] = in.readCDORevisionKey();
    }

    long timestamp = in.readLong();

    int n = in.readInt();
    CDOLockState[] newLockStates = new CDOLockState[n];
    for (int i = 0; i < n; i++) {
      newLockStates[i] = in.readCDOLockState();
    }

    return new LockObjectsResult(
        succesful,
        timeout,
        waitForUpdate,
        requiredTimestamp,
        staleRevisions,
        newLockStates,
        timestamp);
  }
예제 #5
0
  /** @since 4.0 */
  protected void readSystemValues(CDODataInput in) throws IOException {
    EClassifier classifier = in.readCDOClassifierRefAndResolve();
    initClassInfo((EClass) classifier);

    id = in.readCDOID();
    branchPoint = in.readCDOBranchPoint();
    version = in.readInt();
    if (!id.isTemporary()) {
      revised = in.readLong();
    }

    resourceID = in.readCDOID();
    containerID = in.readCDOID();
    containingFeatureID = in.readInt();

    if (TRACER.isEnabled()) {
      TRACER.format(
          "Reading revision: ID={0}, className={1}, version={2}, branchPoint={3}, revised={4}, resource={5}, container={6}, featureID={7}", //$NON-NLS-1$
          id,
          getEClass().getName(),
          version,
          branchPoint,
          revised,
          resourceID,
          containerID,
          containingFeatureID);
    }
  }
  @Override
  protected boolean[] confirming(CDODataInput in, OMMonitor monitor) throws IOException {
    int size = in.readInt();
    for (int i = 0; i < size; i++) {
      allChangedObjects.add(in.readCDORevisionDelta());
    }

    size = in.readInt();
    for (int i = 0; i < size; i++) {
      CDOID id = in.readCDOID();
      allDetachedObjects.add(
          CDOIDUtil.createIDAndVersion(id, CDOBranchVersion.UNSPECIFIED_VERSION));
    }

    return null;
  }
  @Override
  protected void indicating(CDODataInput in) throws IOException {
    if (in.readBoolean()) {
      eClass = (EClass) in.readCDOClassifierRefAndResolve();
      if (TRACER.isEnabled()) {
        TRACER.format("Read eClass: {0}", eClass); // $NON-NLS-1$
      }
    }

    if (in.readBoolean()) {
      branch = in.readCDOBranch();
      if (TRACER.isEnabled()) {
        TRACER.format("Read branch: {0}", branch); // $NON-NLS-1$
      }

      exactBranch = in.readBoolean();
      if (TRACER.isEnabled()) {
        TRACER.format("Read exactBranch: {0}", exactBranch); // $NON-NLS-1$
      }
    }

    timeStamp = in.readLong();
    if (TRACER.isEnabled()) {
      TRACER.format("Read timeStamp: {0}", CDOCommonUtil.formatTimeStamp(timeStamp)); // $NON-NLS-1$
    }

    exactTime = in.readBoolean();
    if (TRACER.isEnabled()) {
      TRACER.format("Read exactTime: {0}", exactTime); // $NON-NLS-1$
    }
  }
예제 #8
0
  @Override
  protected void indicating(CDODataInput in) throws IOException {
    int viewID = in.readInt();
    IView view = getSession().getView(viewID);
    InternalLockManager lockManager = getRepository().getLockingManager();

    LockType lockType = in.readCDOLockType();
    CDOID id = in.readCDOID();
    Object key =
        getRepository().isSupportingBranches()
            ? CDOIDUtil.createIDAndBranch(id, view.getBranch())
            : id;

    boolean byOthers = in.readBoolean();
    if (byOthers) {
      isLocked = lockManager.hasLockByOthers(lockType, view, key);
    } else {
      isLocked = lockManager.hasLock(lockType, view, key);
    }
  }
예제 #9
0
  private boolean readValue(
      CDODataInput in, EClass owner, EStructuralFeature[] features, int i, boolean unchunked)
      throws IOException {
    Object value;
    byte unsetState = in.readByte();
    switch (unsetState) {
      case UNSET_OPCODE:
        return unchunked;

      case SET_NULL_OPCODE:
        setValue(i, CDORevisionData.NIL);
        return unchunked;
    }

    EStructuralFeature feature = features[i];
    if (feature.isMany()) {
      CDOList list = in.readCDOList(owner, feature);
      if (unchunked) {
        int size = list.size();
        if (size != 0) {
          Object lastElement = list.get(size - 1);
          if (lastElement == InternalCDOList.UNINITIALIZED
              || lastElement instanceof CDOElementProxy) {
            unchunked = false;
          }
        }
      }

      value = list;
    } else {
      value = in.readCDOFeatureValue(feature);
      if (TRACER.isEnabled()) {
        TRACER.format("Read feature {0}: {1}", feature.getName(), value);
      }
    }

    setValue(i, value);
    return unchunked;
  }
예제 #10
0
  /** @since 3.0 */
  public void read(CDODataInput in) throws IOException {
    if (READING.isEnabled()) {
      READING.start(this);
    }

    readSystemValues(in);

    flags = in.readByte(); // Don't set permissions into this.falgs before readValues()
    flags |= UNCHUNKED_FLAG; // First assume all lists are unchunked; may be revised below
    flags |=
        BYPASS_PERMISSION_CHECKS_FLAG; // Temporarily disable permission checking to be able to set
                                       // the read values

    if ((flags & PERMISSION_MASK) == CDOPermission.NONE.ordinal()) {
      if (getClassInfo().isResourceNode()) {
        clearValues();

        EClass eClass = getEClass();
        EStructuralFeature[] features = getAllPersistentFeatures();
        readValue(in, eClass, features, RESOURCE_NODE_NAME_INDEX, true);

        if (getClassInfo().isResourceFolder()) {
          if (!readValue(in, eClass, features, RESOURCE_FOLDER_NODES_INDEX, true)) {
            flags &= ~UNCHUNKED_FLAG;
          }
        }
      }
    } else {
      if (!readValues(in)) {
        flags &= ~UNCHUNKED_FLAG;
      }
    }

    // Enable permission checking
    flags &= ~BYPASS_PERMISSION_CHECKS_FLAG;

    if (READING.isEnabled()) {
      READING.stop(this);
    }
  }
 @Override
 protected void initializeCommitContext(CDODataInput in) throws Exception {
   int viewID = in.readInt();
   InternalTransaction transaction = getTransaction(viewID);
   commitContext = new XATransactionCommitContext(transaction);
 }
예제 #12
0
 @Override
 protected Boolean confirming(CDODataInput in, OMMonitor monitor) throws IOException {
   return in.readBoolean();
 }
 @Override
 protected void indicating(CDODataInput in) throws IOException {
   LockNotificationMode mode = in.readEnum(LockNotificationMode.class);
   getSession().setLockNotificationMode(mode);
 }