Package org.apache.cayenne.event

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


     *            Can't be null.
     * @param properties Properties map used to configure DataRowStore parameters. Can be
     *            null.
     */
    public DataRowStore(String name, Map properties) {
        this(name, properties, new EventManager());
    }
View Full Code Here


        if (serverContext.hasChanges()) {
            serverContext.rollbackChanges();

            if (lifecycleEventsEnabled) {
                EventManager eventManager = getEventManager();
                if (eventManager != null) {
                    eventManager.postEvent(
                            new GraphEvent(this, null),
                            DataChannel.GRAPH_ROLLEDBACK_SUBJECT);
                }
            }
        }
View Full Code Here

     */
    GraphDiff onFlush(GraphDiff childDiff) {
        childDiff.apply(new ChildDiffLoader(serverContext));

        if (lifecycleEventsEnabled) {
            EventManager eventManager = getEventManager();

            if (eventManager != null) {
                eventManager.postEvent(
                        new GraphEvent(this, childDiff),
                        DataChannel.GRAPH_CHANGED_SUBJECT);
            }
        }

View Full Code Here

            diff.apply(clientConverter);
            returnClientDiff = clientConverter.getClientDiff();
        }

        if (lifecycleEventsEnabled) {
            EventManager eventManager = getEventManager();

            if (eventManager != null) {
                CompoundDiff notification = new CompoundDiff();
                notification.add(childDiff);
                notification.add(returnClientDiff);

                eventManager.postEvent(
                        new GraphEvent(this, notification),
                        DataChannel.GRAPH_FLUSHED_SUBJECT);
            }
        }
View Full Code Here

                this.mergeHandler = null;
            }

            this.channel = channel;

            EventManager eventManager = (channel != null)
                    ? channel.getEventManager()
                    : null;
            if (eventManager != null) {
                this.mergeHandler = new CayenneContextMergeHandler(this);
View Full Code Here

        this.configureLogging();

        // set domain configuration name
        this.setDomainConfigurationName(domainConfigurationName);

        this.eventManager = new EventManager();
    }
View Full Code Here

    public ClientChannel(ClientConnection connection) {
        this(connection, false);
    }

    public ClientChannel(ClientConnection connection, boolean channelEventsEnabled) {
        this(connection, channelEventsEnabled, new EventManager(2));
    }
View Full Code Here

    /**
     * Wraps GraphDiff in a GraphEvent and sends it via EventManager with specified
     * subject.
     */
    void send(GraphDiff diff, EventSubject subject, Object eventSource) {
        EventManager manager = (context.getChannel() != null) ? context
                .getChannel()
                .getEventManager() : null;

        if (manager != null) {
            GraphEvent e = new GraphEvent(context, eventSource, diff);
            manager.postEvent(e, subject);
        }
    }
View Full Code Here

            // check flag again in the synced block...
            if (!dbRelationshipsRefreshNeeded) {
                return;
            }

            EventManager eventLoop = EventManager.getDefaultManager();

            // remove existing relationships
            Iterator removeIt = dbRelationships.iterator();
            while (removeIt.hasNext()) {
                DbRelationship relationship = (DbRelationship) removeIt.next();
                eventLoop.removeListener(
                        this,
                        DbRelationship.PROPERTY_DID_CHANGE,
                        relationship);

                removeIt.remove();
            }

            if (this.dbRelationshipPath != null) {

                ObjEntity entity = (ObjEntity) getSourceEntity();
                if (entity == null) {
                    throw new CayenneRuntimeException(
                            "Can't resolve DbRelationships, null source ObjEntity");
                }

                try {
                    // add new relationships from path
                    Iterator it = entity.resolvePathComponents(new ASTDbPath(
                            this.dbRelationshipPath));

                    while (it.hasNext()) {
                        DbRelationship relationship = (DbRelationship) it.next();

                        // listen for changes
                        eventLoop.addListener(
                                this,
                                "dbRelationshipDidChange",
                                RelationshipEvent.class,
                                DbRelationship.PROPERTY_DID_CHANGE,
                                relationship);
View Full Code Here

                this.mergeHandler = null;
            }

            this.channel = channel;

            EventManager eventManager = (channel != null)
                    ? channel.getEventManager()
                    : null;
            if (eventManager != null) {
                this.mergeHandler = new CayenneContextMergeHandler(this);
View Full Code Here

TOP

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

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.