<commit_before>package org.grails.plugin.platform.events.push;

import grails.events.GrailsEventsAware;
import org.atmosphere.cpr.AtmosphereResourceEvent;
import org.atmosphere.websocket.WebSocketEventListener;
import org.grails.plugin.platform.events.Events;
import org.grails.plugin.platform.events.publisher.EventsPublisher;

/**
 * Author: smaldini
 * Date: 1/15/13
 * Project: events-push
 */
public class BridgeWSListener implements WebSocketEventListener, GrailsEventsAware {

    private Events grailsEvents;

    public void setGrailsEvents(Events events) {
        this.grailsEvents = events;
    }

    @Override
    public void onHandshake(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onHandshake", event);
    }

    @Override
    public void onMessage(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onMessage", event);
    }

    @Override
    public void onClose(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onClose", event);
    }

    @Override
    public void onControl(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onControl", event);
    }

    @Override
    public void onDisconnect(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onDisconnect", event);
    }

    @Override
    public void onConnect(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onConnect", event);
    }

    @Override
    public void onPreSuspend(AtmosphereResourceEvent event) {
        //grailsEvents.event(SharedConstants.PUSH_SCOPE, "onPreSuspend", event);
    }

    @Override
    public void onSuspend(AtmosphereResourceEvent event) {
        //grailsEvents.event(SharedConstants.PUSH_SCOPE, "onConnect", event);
    }

    @Override
    public void onResume(AtmosphereResourceEvent event) {
        //grailsEvents.event(SharedConstants.PUSH_SCOPE, "onResume", event);
    }

    @Override
    public void onDisconnect(AtmosphereResourceEvent event) {
        //grailsEvents.event(SharedConstants.PUSH_SCOPE, "onDisconnect", event);
    }

    @Override
    public void onBroadcast(AtmosphereResourceEvent event) {
        //grailsEvents.event(SharedConstants.PUSH_SCOPE, "onBroadcast", event);
    }

    @Override
    public void onThrowable(AtmosphereResourceEvent event) {
        //grailsEvents.event(SharedConstants.PUSH_SCOPE, "onThrowable", event);
    }
}<commit_msg>- merged @zyro fixes - add connection listener bridge ( to publish on browser:// namespace )<commit_after>package org.grails.plugin.platform.events.push;

import grails.events.GrailsEventsAware;
import org.atmosphere.cpr.AtmosphereResourceEvent;
import org.atmosphere.websocket.WebSocketEventListener;
import org.grails.plugin.platform.events.Events;
import org.grails.plugin.platform.events.publisher.EventsPublisher;

/**
 * Author: smaldini
 * Date: 1/15/13
 * Project: events-push
 */
public class BridgeWSListener implements WebSocketEventListener, GrailsEventsAware {

    private Events grailsEvents;

    public void setGrailsEvents(Events events) {
        this.grailsEvents = events;
    }

    @Override
    public void onHandshake(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onHandshake", event);
    }

    @Override
    public void onMessage(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onMessage", event);
    }

    @Override
    public void onClose(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onClose", event);
    }

    @Override
    public void onControl(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onControl", event);
    }

    @Override
    public void onDisconnect(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onDisconnect", event);
    }

    @Override
    public void onConnect(WebSocketEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onConnect", event);
    }

    @Override
    public void onPreSuspend(AtmosphereResourceEvent event) {
        //grailsEvents.event(SharedConstants.PUSH_SCOPE, "onPreSuspend", event);
    }

    @Override
    public void onSuspend(AtmosphereResourceEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onConnect", event);
    }

    @Override
    public void onResume(AtmosphereResourceEvent event) {
        //grailsEvents.event(SharedConstants.PUSH_SCOPE, "onResume", event);
    }

    @Override
    public void onDisconnect(AtmosphereResourceEvent event) {
        grailsEvents.event(SharedConstants.PUSH_SCOPE, "onDisconnect", event);
    }

    @Override
    public void onBroadcast(AtmosphereResourceEvent event) {
        //grailsEvents.event(SharedConstants.PUSH_SCOPE, "onBroadcast", event);
    }

    @Override
    public void onThrowable(AtmosphereResourceEvent event) {
        //grailsEvents.event(SharedConstants.PUSH_SCOPE, "onThrowable", event);
    }
}
{'fraction_non_alphanumeric': 0.09548438432464691, 'fraction_numerical': 0.001989258006763477, 'mean_word_length': 3.872093023255814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6615711', 'n_tokens_mistral': 1554, 'n_tokens_neox': 1488, 'n_words': 271}