@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$
          }
        }
      }
    }
  }
 /** @since 3.0 */
 public InvalidObjectException(CDOID id, CDOBranchPoint branchPoint) {
   super(
       MessageFormat.format(
           Messages.getString("InvalidObjectException.0"), //
           id,
           branchPoint.getBranch().getID(),
           CDOCommonUtil.formatTimeStamp(branchPoint.getTimeStamp())));
 }
Example #3
0
  public static InternalCDOObject adapt(Object object, CDOView view) {
    if (view.isClosed()) {
      throw new IllegalStateException(Messages.getString("FSMUtil.0")); // $NON-NLS-1$
    }

    if (object instanceof InternalCDOObject) {
      return (InternalCDOObject) object;
    }

    if (object == null) {
      throw new IllegalArgumentException(Messages.getString("FSMUtil.1")); // $NON-NLS-1$
    }

    if (object instanceof InternalEObject) {
      if (!view.isLegacyModeEnabled()) {
        throw new LegacyModeNotEnabledException();
      }

      return adaptLegacy((InternalEObject) object);
    }

    return null;
  }
Example #4
0
  public CDOID provideCDOID(Object idOrObject) {
    CDOID id = getTransaction().provideCDOID(idOrObject);
    if (id instanceof CDOIDTempObjectExternalImpl) {
      if (idOrObject instanceof InternalEObject) {
        CDOIDTempObjectExternalImpl proxyTemp = (CDOIDTempObjectExternalImpl) id;
        if (!requestedIDs.containsKey(proxyTemp)) {
          InternalCDOObject cdoObject =
              (InternalCDOObject) CDOUtil.getCDOObject((InternalEObject) idOrObject);
          InternalCDOTransaction cdoTransaction = (InternalCDOTransaction) cdoObject.cdoView();
          getTransactionManager().add(cdoTransaction, proxyTemp);
          requestedIDs.put(proxyTemp, cdoTransaction);
          objectToID.put(cdoObject, proxyTemp);
        }
      } else {
        throw new ImplementationError(
            MessageFormat.format(
                Messages.getString("CDOXACommitContextImpl.0"), idOrObject)); // $NON-NLS-1$
      }
    }

    return id;
  }
    @Override
    protected void resolveConflict(
        CDOObject conflict, CDORevisionDelta localDelta, List<CDORevisionDelta> remoteDeltas) {
      if (hasFeatureConflicts(localDelta, remoteDeltas)) {
        // TODO localDelta may be corrupt already and the transaction will not be able to restore
        // it!!!
        throw new CDOException(
            Messages.getString("AbstractObjectConflictResolver.0")); // $NON-NLS-1$
      }

      rollbackObject(conflict);

      // Add remote deltas to local delta
      for (CDORevisionDelta remoteDelta : remoteDeltas) {
        for (CDOFeatureDelta remoteFeatureDelta : remoteDelta.getFeatureDeltas()) {
          // TODO Add public API for this:
          ((InternalCDORevisionDelta) localDelta).addFeatureDelta(remoteFeatureDelta);
        }
      }

      changeObject(conflict, localDelta);
    }
Example #6
0
 @Override
 public String toString() {
   return Messages.getString("CDOAdapterPolicy.2"); // $NON-NLS-1$
 }