package org.atmosphere.samples.guice;

import com.google.inject.Inject;
import org.atmosphere.cpr.AtmosphereResourceEvent;
import org.atmosphere.cpr.AtmosphereResourceEventListener;

/**
 * @author Sebastian Lövdahl
 */
public class EventListener implements AtmosphereResourceEventListener {

    private InjectedService injectedService;

    @Inject
    void setInjectedService(InjectedService injectedService) {
        this.injectedService = injectedService;
    }

    @Override
    public void onPreSuspend( AtmosphereResourceEvent atmosphereResourceEvent ) {
        checkInjection();
    }

    @Override
    public void onSuspend( AtmosphereResourceEvent atmosphereResourceEvent ) {
        checkInjection();
    }

    @Override
    public void onResume( AtmosphereResourceEvent atmosphereResourceEvent ) {
        checkInjection();
    }

    @Override
    public void onDisconnect( AtmosphereResourceEvent atmosphereResourceEvent ) {
        checkInjection();
    }

    @Override
    public void onBroadcast( AtmosphereResourceEvent atmosphereResourceEvent ) {
        checkInjection();
    }

    @Override
    public void onThrowable( AtmosphereResourceEvent atmosphereResourceEvent ) {
        checkInjection();
    }

    @Override
    public void onClose( AtmosphereResourceEvent atmosphereResourceEvent ) {
        checkInjection();
    }

    @Override
    public void onHeartbeat( AtmosphereResourceEvent atmosphereResourceEvent ) {
        checkInjection();
    }

    private void checkInjection() {
        if (injectedService == null) {
            throw new RuntimeException("Guice injection doesn't work");
        }
    }
}

@@ -497,33 +497,32 @@
 id onPreSuspend(
- 
 AtmosphereResour
@@ -544,33 +544,32 @@
 ereResourceEvent
- 
 ) %7B%0A        chec
@@ -629,17 +629,16 @@
 Suspend(
- 
 Atmosphe
@@ -668,33 +668,32 @@
 ereResourceEvent
- 
 ) %7B%0A        chec
@@ -752,17 +752,16 @@
 nResume(
- 
 Atmosphe
@@ -791,33 +791,32 @@
 ereResourceEvent
- 
 ) %7B%0A        chec
@@ -879,17 +879,16 @@
 connect(
- 
 Atmosphe
@@ -918,33 +918,32 @@
 ereResourceEvent
- 
 ) %7B%0A        chec
@@ -1005,17 +1005,16 @@
 oadcast(
- 
 Atmosphe
@@ -1044,33 +1044,32 @@
 ereResourceEvent
- 
 ) %7B%0A        chec
@@ -1131,17 +1131,16 @@
 rowable(
- 
 Atmosphe
@@ -1170,33 +1170,32 @@
 ereResourceEvent
- 
 ) %7B%0A        chec
@@ -1253,17 +1253,16 @@
 onClose(
- 
 Atmosphe
@@ -1292,33 +1292,32 @@
 ereResourceEvent
- 
 ) %7B%0A        chec
@@ -1379,17 +1379,16 @@
 artbeat(
- 
 Atmosphe
@@ -1426,17 +1426,16 @@
 rceEvent
- 
 ) %7B%0A    

Fix code style