Package com.webobjects.eocontrol

Examples of com.webobjects.eocontrol.EOObjectStoreCoordinator


  }

  public void publishChange(NSNotification n) {
    boolean processingMulticastNotifications = ERXObjectStoreCoordinatorSynchronizer.isProcessingRemoteNotifications();
    if (_coordinators.count() > 1 || (_remoteSynchronizer != null && !processingMulticastNotifications)) {
      EOObjectStoreCoordinator osc = (EOObjectStoreCoordinator) n.object();
      NSDictionary userInfo = n.userInfo();
      if (userInfo == null || userInfo.valueForKey(ERXObjectStoreCoordinatorSynchronizer.SYNCHRONIZER_KEY) == null) {
        LocalChange changes = new LocalChange(osc, userInfo, processingMulticastNotifications);
        _queue.addChange(changes);
      }
View Full Code Here


     * @param sender
     */
    protected void process(EOObjectStoreCoordinator sender, SnapshotProcessor processor, NSDictionary changesByEntity, String userInfoKey) {
      NSMutableDictionary dbcs = new NSMutableDictionary();
      for (Enumeration oscs = _synchronizer.coordinators(); oscs.hasMoreElements();) {
        EOObjectStoreCoordinator osc = (EOObjectStoreCoordinator) oscs.nextElement();
        if (osc != sender) {
          _process(sender, osc, dbcs, processor, changesByEntity, userInfoKey);
        }
      }
    }
View Full Code Here

      }
    }

    protected void processRemoteChange(RemoteChange remoteChange) {
      for (Enumeration oscs = _synchronizer.coordinators(); oscs.hasMoreElements();) {
        EOObjectStoreCoordinator osc = (EOObjectStoreCoordinator) oscs.nextElement();
        Enumeration cacheChangeEnum = remoteChange.remoteCacheChanges().objectEnumerator();
        while (cacheChangeEnum.hasMoreElements()) {
          ERXDatabase.CacheChange cacheChange = (ERXDatabase.CacheChange) cacheChangeEnum.nextElement();
          EOKeyGlobalID gid = (EOKeyGlobalID) cacheChange.gid();
          EODatabaseContext dbc = ERXEOAccessUtilities.databaseContextForEntityNamed(osc, gid.entityName());
View Full Code Here

            }
          }
          if (changes != null) {
            if (changes instanceof LocalChange) {
              LocalChange localChange = (LocalChange) changes;
              EOObjectStoreCoordinator sender = localChange.coordinator();
              process(sender, _deleteProcessor, localChange.deleted(), EODatabaseContext.DeletedKey);
              process(sender, _insertProcessor, localChange.inserted(), EODatabaseContext.InsertedKey);
              process(sender, _updateProcessor, localChange.updated(), EODatabaseContext.UpdatedKey);
              process(sender, _invalidateProcessor, localChange.invalidated(), EODatabaseContext.InvalidatedKey);
              publishRemoteChanges(_transactionID++, localChange);
View Full Code Here

     * @param relationshipName relationship name
     * @param database database object
     */
    public static void clearSnapshotForRelationshipNamedInDatabase(EOEnterpriseObject eo, String relationshipName, EODatabase database) {
        EOEditingContext ec = eo.editingContext();
        EOObjectStoreCoordinator osc = (EOObjectStoreCoordinator) ec.rootObjectStore();
        osc.lock();
        try {
          EOGlobalID gid = ec.globalIDForObject(eo);
          database.recordSnapshotForSourceGlobalID(null, gid, relationshipName);
          Object o = eo.storedValueForKey(relationshipName);
          boolean needRefresh = false;
          if(o instanceof EOFaulting) {
            EOFaulting toManyArray = (EOFaulting)o;
              if (!toManyArray.isFault()) {
                EOFaulting tmpToManyArray = (EOFaulting)((EOObjectStoreCoordinator)ec.rootObjectStore()).arrayFaultWithSourceGlobalID(gid, relationshipName, ec);
                toManyArray.turnIntoFault(tmpToManyArray.faultHandler());
                needRefresh = true;
              }
          } else {
            EOFaulting tmpToManyArray = (EOFaulting)((EOObjectStoreCoordinator)ec.rootObjectStore()).arrayFaultWithSourceGlobalID(gid, relationshipName, ec);
            eo.takeStoredValueForKey(tmpToManyArray, relationshipName);
            needRefresh = true;
          }
          if(needRefresh && (eo instanceof ERXEnterpriseObject)) {
            ((ERXEnterpriseObject)eo).flushCaches();
          }
        }
        finally {
          osc.unlock();
        }
    }
View Full Code Here

     * @param eo the EO to get a database context for
     * @return the eo's database context
     */
    public static EODatabaseContext databaseContextForObject(EOEnterpriseObject eo) {
        EOEditingContext editingContext = eo.editingContext();
        EOObjectStoreCoordinator osc = (EOObjectStoreCoordinator) editingContext.rootObjectStore();
        EODatabaseContext databaseContext = (EODatabaseContext) osc.objectStoreForObject(eo);
        return databaseContext;
    }
View Full Code Here

    public void setUp() {
        System.setProperty("NSProjectBundleEnabled", "true");
        System.setProperty("NSPropertiesInitializationWarning", "false");
        NSBundle.mainBundle();

        EOObjectStoreCoordinator osc = new EOObjectStoreCoordinator();
        // EOEditingContext editingContext = ERXEC.newEditingContext(osc);
        // editingContext.lock();
        // try {
        // for (int i = 0; i < 3; i++) {
        // Company c = Company.createCompany(editingContext, "Company " + i);
View Full Code Here

    }

    public static ERXJDBCConnectionBroker connectionBrokerForEoInEditingContext(EOEnterpriseObject eo) {
        EOObjectStore os = eo.editingContext().rootObjectStore();
        if (os instanceof EOObjectStoreCoordinator) {
            EOObjectStoreCoordinator osc = (EOObjectStoreCoordinator)os;
            EOCooperatingObjectStore cos = osc.objectStoreForObject(eo);
            if (cos instanceof EODatabaseContext) {
                EODatabaseContext dbctx = (EODatabaseContext)cos;
                EOAdaptor adaptor = dbctx.database().adaptor();
                return ERXJDBCConnectionBroker.connectionBrokerForAdaptor(adaptor);
            }
View Full Code Here

      }
    }

        if (ec == null) return;
       
        EOObjectStoreCoordinator osc = (EOObjectStoreCoordinator) ec.rootObjectStore();

        osc.lock();
        try {

            NSArray rootKeyPathObjects = KeyPath.parseKeyPathStrings(keypaths);

            Enumeration keyPathObjectsEnum = rootKeyPathObjects.objectEnumerator();
            while (keyPathObjectsEnum.hasMoreElements()) {
                KeyPath kp = (KeyPath) keyPathObjectsEnum.nextElement();
                kp.traverseForObjects(sourceObjects, skipFaultedSourceObjects);
            }

        } finally {
            osc.unlock();
        }
    }
View Full Code Here

                        NSDictionary dict =  null;
                        String currentKey = (String) destinationAttibuteNames.objectAtIndex(j);
                        Object v;
                        if (o instanceof EOEnterpriseObject) {
                            EOEnterpriseObject eoenterpriseobject = (EOEnterpriseObject)o;
                            EOObjectStoreCoordinator osc = ((EOObjectStoreCoordinator)eoenterpriseobject.editingContext().rootObjectStore());
                            dict = osc.valuesForKeys(new NSArray(currentKey), eoenterpriseobject);
                            v = dict.objectForKey(currentKey);
                         } else {
                            v = o;
                         }
                        realValues.addObject(v);
View Full Code Here

TOP

Related Classes of com.webobjects.eocontrol.EOObjectStoreCoordinator

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.