Package org.apache.cayenne.event

Examples of org.apache.cayenne.event.EventManager$InvocationDispatch


    public void testNotifyingRemoteListeners() {
        DataRowStore cache = new DataRowStore(
                "cacheXYZ",
                Collections.EMPTY_MAP,
                new EventManager());

        assertEquals(DataRowStore.REMOTE_NOTIFICATION_DEFAULT, cache
                .isNotifyingRemoteListeners());

        cache.setNotifyingRemoteListeners(!DataRowStore.REMOTE_NOTIFICATION_DEFAULT);
View Full Code Here


     */
    public void testMaxSize() throws Exception {
        Map props = new HashMap();
        props.put(DataRowStore.SNAPSHOT_CACHE_SIZE_PROPERTY, String.valueOf(2));

        DataRowStore cache = new DataRowStore("cacheXYZ", props, new EventManager());
        assertEquals(2, cache.maximumSize());
        assertEquals(0, cache.size());

        ObjectId key1 = new ObjectId("Artist", Artist.ARTIST_ID_PK_COLUMN, 1);
        Map diff1 = new HashMap();
View Full Code Here

        deleteTestData();

        DataRowStore cache = new DataRowStore(
                "cacheTest",
                Collections.EMPTY_MAP,
                new EventManager());

        c1 = new DataContext(getDomain(), new ObjectStore(cache));
        c2 = new DataContext(getDomain(), new ObjectStore(cache));

        // prepare a single artist record
View Full Code Here

        TEST_DEFAULTS.put(DataRowStore.SNAPSHOT_CACHE_SIZE_PROPERTY, new Integer(10));
        TEST_DEFAULTS.put(DataRowStore.REMOTE_NOTIFICATION_PROPERTY, Boolean.FALSE);
    }

    public MockDataRowStore() {
        super("mock DataRowStore", TEST_DEFAULTS, new EventManager());
    }
View Full Code Here

                // cache entity resolver, as we have no idea how expensive it is to query
                // it on the channel every time
                this.entityResolver = channel.getEntityResolver();

                EventManager eventManager = channel.getEventManager();

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

                    // listen to our channel events...
View Full Code Here

    /**
     * @since 1.2
     */
    void fireDataChannelCommitted(Object postedBy, GraphDiff changes) {
        EventManager manager = getEventManager();

        if (manager != null) {
            GraphEvent e = new GraphEvent(this, postedBy, changes);
            manager.postEvent(e, DataChannel.GRAPH_FLUSHED_SUBJECT);
        }
    }
View Full Code Here

    /**
     * @since 1.2
     */
    void fireDataChannelRolledback(Object postedBy, GraphDiff changes) {
        EventManager manager = getEventManager();

        if (manager != null) {
            GraphEvent e = new GraphEvent(this, postedBy, changes);
            manager.postEvent(e, DataChannel.GRAPH_ROLLEDBACK_SUBJECT);
        }
    }
View Full Code Here

    /**
     * @since 1.2
     */
    void fireDataChannelChanged(Object postedBy, GraphDiff changes) {
        EventManager manager = getEventManager();

        if (manager != null) {
            GraphEvent e = new GraphEvent(this, postedBy, changes);
            manager.postEvent(e, DataChannel.GRAPH_CHANGED_SUBJECT);
        }
    }
View Full Code Here

            }
        }
    }

    void registerForDataContextEvents() {
        EventManager eventManager = originatingContext.getEventManager();
        eventManager.addListener(
                this,
                "dataContextWillCommit",
                DataContextEvent.class,
                DataContext.WILL_COMMIT,
                originatingContext);
        eventManager.addListener(
                this,
                "dataContextDidCommit",
                DataContextEvent.class,
                DataContext.DID_COMMIT,
                originatingContext);
        eventManager.addListener(
                this,
                "dataContextDidRollback",
                DataContextEvent.class,
                DataContext.DID_ROLLBACK,
                originatingContext);
View Full Code Here

                DataContext.DID_ROLLBACK,
                originatingContext);
    }

    void unregisterFromDataContextEvents() {
        EventManager eventManager = originatingContext.getEventManager();
        eventManager.removeListener(this, DataContext.WILL_COMMIT);
        eventManager.removeListener(this, DataContext.DID_COMMIT);
        eventManager.removeListener(this, DataContext.DID_ROLLBACK);
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.event.EventManager$InvocationDispatch

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.