コード例 #1
0
  @Override
  protected void handleEPackage(EPackage ePackage, Set<EPackage> visitedPackages) {
    if (ePackage != null && visitedPackages.add(ePackage)) {
      if (excludeEcore
          && // Optimize EPackage comparison
          (EcorePackage.eINSTANCE == ePackage
              || EcorePackage.eNS_URI.equals(ePackage.getNsURI()))) {
        return;
      }

      Set<Object> visited = new HashSet<Object>();
      for (EClassifier classifier : ePackage.getEClassifiers()) {
        handleEClassifier(classifier, visitedPackages, visited);
      }

      for (Object object : visited) {
        if (object instanceof EClassifier) {
          EClassifier classifier = (EClassifier) object;
          final EPackage p = classifier.getEPackage();
          if (p != null) {
            if (visitedPackages.add(p)) {
              if (TRACER.isEnabled()) {
                TRACER.trace("Found package " + p.getNsURI()); // $NON-NLS-1$
              }
            }
          } else {
            OM.LOG.warn(
                MessageFormat.format(
                    Messages.getString("CompletePackageClosure.0"),
                    classifier.getName())); // $NON-NLS-1$
          }
        }
      }
    }
  }
コード例 #2
0
  /** @since 4.0 */
  public void resolveConflicts(
      Map<CDOObject, Pair<CDORevision, CDORevisionDelta>> conflicts,
      List<CDORevisionDelta> allRemoteDeltas) {
    Map<CDOID, CDORevisionDelta> localDeltas = getTransaction().getRevisionDeltas();
    for (Entry<CDOObject, Pair<CDORevision, CDORevisionDelta>> entry : conflicts.entrySet()) {
      CDOObject conflict = entry.getKey();
      CDORevision oldRevision = entry.getValue().getElement1();
      CDORevisionDelta remoteDelta = entry.getValue().getElement2();
      CDORevisionDelta localDelta = localDeltas.get(conflict.cdoID());

      try {
        resolveConflict(conflict, oldRevision, localDelta, remoteDelta, allRemoteDeltas);
      } catch (Exception ex) {
        OM.LOG.error(ex);
      }
    }
  }
コード例 #3
0
      public void notifyEvent(IEvent event) {
        try {
          if (event instanceof CDOViewInvalidationEvent) {
            CDOViewInvalidationEvent e = (CDOViewInvalidationEvent) event;
            for (Map.Entry<CDOObject, CDORevisionDelta> entry : e.getRevisionDeltas().entrySet()) {
              CDOObject notifier = entry.getKey();
              List<CDORevisionDelta> list = deltas.get(notifier);
              if (list == null) {
                list = new ArrayList<CDORevisionDelta>();
                deltas.put(notifier, list);
              }

              CDORevisionDelta delta = entry.getValue();
              list.add(delta);
            }
          }
        } catch (Exception ex) {
          OM.LOG.error(ex);
        }
      }
コード例 #4
0
  protected void revisionToInstance() {
    synchronized (recursionCounter) {
      if (underConstruction) {
        // Return if revisionToInstance was called before to avoid doubled calls
        return;
      }

      underConstruction = true;
      InternalCDORevision revision = cdoRevision();

      if (TRACER.isEnabled()) {
        TRACER.format(
            "Transfering revision to instance: {0} --> {1}", revision, instance); // $NON-NLS-1$
      }

      boolean deliver = instance.eDeliver();
      if (deliver) {
        instance.eSetDeliver(false);
      }

      Counter counter = recursionCounter.get();
      if (counter == null) {
        counter = new Counter();
        recursionCounter.set(counter);
      }

      InternalCDOResource resource = null;
      boolean bypassPermissionChecks = revision.bypassPermissionChecks(true);

      try {
        registerWrapper(this);
        counter.increment();
        viewAndState.view.registerObject(this);

        revisionToInstanceResource();
        revisionToInstanceContainer();

        Resource eResource = instance.eResource();
        if (eResource instanceof InternalCDOResource) {
          resource = (InternalCDOResource) eResource;
          resource.cdoInternalLoading(instance);
        }

        for (EStructuralFeature feature : classInfo.getAllPersistentFeatures()) {
          revisionToInstanceFeature(feature);
        }
      } catch (RuntimeException ex) {
        OM.LOG.error(ex);
        throw ex;
      } catch (Exception ex) {
        OM.LOG.error(ex);
        throw new CDOException(ex);
      } finally {
        try {
          revision.bypassPermissionChecks(bypassPermissionChecks);

          if (resource != null) {
            resource.cdoInternalLoadingDone(instance);
          }

          if (deliver) {
            instance.eSetDeliver(true);
          }
        } finally {
          if (counter.decrement() == 0) {
            recursionCounter.remove();
          }

          unregisterWrapper(this);
          underConstruction = false;
        }
      }
    }
  }