コード例 #1
0
ファイル: DataContext.java プロジェクト: apache/cayenne
  /** @since 3.1 */
  @Override
  protected void attachToChannel(DataChannel channel) {

    super.attachToChannel(channel);

    if (mergeHandler != null) {
      mergeHandler.setActive(false);
      mergeHandler = null;
    }

    EventManager eventManager = channel.getEventManager();

    if (eventManager != null) {
      mergeHandler = new DataContextMergeHandler(this);

      // listen to our channel events...
      // note that we must reset listener on channel switch, as there is
      // no
      // guarantee that a new channel uses the same EventManager.
      EventUtil.listenForChannelEvents(channel, mergeHandler);
    }

    if (!usingSharedSnaphsotCache && getObjectStore() != null) {
      DataRowStore cache = getObjectStore().getDataRowCache();

      if (cache != null) {
        cache.setEventManager(eventManager);
      }
    }
  }
コード例 #2
0
ファイル: DataContext.java プロジェクト: apache/cayenne
 // this completely meaningless override is needed to expose the method as
 // package-private ... is there a better way?
 @Override
 protected void fireDataChannelChanged(Object postedBy, GraphDiff changes) {
   super.fireDataChannelChanged(postedBy, changes);
 }
コード例 #3
0
ファイル: DataContext.java プロジェクト: apache/cayenne
 @Override
 protected void attachToRuntime(Injector injector) {
   super.attachToRuntime(injector);
   this.transactionFactory = injector.getInstance(TransactionFactory.class);
 }