Package org.cometd.annotation

Examples of org.cometd.annotation.ServerAnnotationProcessor$SubscriptionCallback


  }

  @Provides
  @Singleton
  ServerAnnotationProcessor annotationProcessor(BayeuxServer server) {
    return new ServerAnnotationProcessor(server);
  }
View Full Code Here


    @PostConstruct
    private void init()
    {
        BayeuxServer bayeuxServer = bayeuxServer();
        bayeuxServer.setSecurityPolicy(policy());
        this.processor = new ServerAnnotationProcessor(bayeuxServer);

        // Link the cloud, or use OortMulticastConfigurer.
        Oort oort = oort();
//        oort.observeComet("http://cloud.cometd.org/cometd");
View Full Code Here

        BayeuxServerImpl bayeuxServer = injector.getInstance(BayeuxServerImpl.class);
        bayeuxServer.start();

        // Configure services
        // Guice does not handle @PostConstruct and @PreDestroy, so we need to handle them
        ServerAnnotationProcessor processor = new ServerAnnotationProcessor(bayeuxServer);
        GuiceBayeuxService service = injector.getInstance(GuiceBayeuxService.class);
        Assert.assertTrue(processor.process(service));

        // At this point we're configured properly
        // The code above should be put into a ServletContextListener.contextInitialized()
        // method, so that it is triggered by the web application lifecycle handling
        // and the BayeuxServer instance can be put into the ServletContext

        // Test that we're configured properly
        Assert.assertNotNull(service);
        assertNotNull(service.dependency);
        assertNotNull(service.bayeuxServer);
        assertNotNull(service.serverSession);
        assertTrue(service.active);
        assertEquals(1, service.bayeuxServer.getChannel(GuiceBayeuxService.CHANNEL).getSubscribers().size());

        // Deconfigure services
        // The code below should be put into a ServletContextListener.contextDestroyed()
        // method, so that it is triggered by the web application lifecycle handling
        Assert.assertTrue(processor.deprocess(service));
        // Manually stop the BayeuxServer
        bayeuxServer.stop();

        assertFalse(service.active);
    }
View Full Code Here

    }

    @PostConstruct
    private void init()
    {
        this.processor = new ServerAnnotationProcessor(bayeuxServer);
    }
View Full Code Here

        BayeuxServer bayeux = (BayeuxServer)context.getAttribute(BayeuxServer.ATTRIBUTE);
        Oort oort = (Oort)context.getAttribute(Oort.OORT_ATTRIBUTE);
        Seti seti = (Seti)context.getAttribute(Seti.SETI_ATTRIBUTE);

        _processor = new ServerAnnotationProcessor(bayeux, oort, seti);
        _service = new OortChatService();
        _processor.process(_service);

        bayeux.addExtension(new TimesyncExtension());
    }
View Full Code Here

        });

        // Allow anybody to handshake
        bayeux.getChannel(ServerChannel.META_HANDSHAKE).addAuthorizer(GrantAuthorizer.GRANT_PUBLISH);

        ServerAnnotationProcessor processor = new ServerAnnotationProcessor(bayeux);
        processor.process(new EchoRPC());
        processor.process(new Monitor());
        // processor.process(new ChatService());

        bayeux.createChannelIfAbsent("/foo/bar/baz", new ConfigurableServerChannel.Initializer.Persistent());

        if (logger.isDebugEnabled())
View Full Code Here

public class CometDRemoteCallTest extends AbstractCometDTest
{
    @Test
    public void testRemoteCallWithResult() throws Exception
    {
        ServerAnnotationProcessor processor = new ServerAnnotationProcessor(cometdServlet.getBayeux());
        String response = "response";
        processor.process(new RemoteCallWithResultService(response));

        defineClass(Latch.class);

        evaluateScript("cometd.init({ url: '" + cometdURL + "', logLevel: '" + getLogLevel() + "' });");
        Thread.sleep(1000); // Wait for /meta/connect
View Full Code Here

    }

    @Test
    public void testRemoteCallWithFailure() throws Exception
    {
        ServerAnnotationProcessor processor = new ServerAnnotationProcessor(cometdServlet.getBayeux());
        String failure = "response";
        processor.process(new RemoteCallWithFailureService(failure));

        defineClass(Latch.class);

        evaluateScript("cometd.init({ url: '" + cometdURL + "', logLevel: '" + getLogLevel() + "' });");
        Thread.sleep(1000); // Wait for /meta/connect
View Full Code Here

    @Test
    public void testRemoteCallTimeout() throws Exception
    {
        long timeout = 1000;
        ServerAnnotationProcessor processor = new ServerAnnotationProcessor(cometdServlet.getBayeux());
        boolean processed = processor.process(new RemoteCallTimeoutService(timeout));
        Assert.assertTrue(processed);

        defineClass(Latch.class);

        evaluateScript("cometd.init({ url: '" + cometdURL + "', logLevel: '" + getLogLevel() + "' });");
View Full Code Here

        jsonContext.getJSON().addConvertor(Custom.class, new CustomConvertor());

        final String request = "request";
        final String response = "response";

        ServerAnnotationProcessor processor = new ServerAnnotationProcessor(cometdServlet.getBayeux());
        boolean processed = processor.process(new RemoteCallWithCustomDataClassService(request, response));
        Assert.assertTrue(processed);

        defineClass(Latch.class);

        evaluateScript("var latch = new Latch(1);");
View Full Code Here

TOP

Related Classes of org.cometd.annotation.ServerAnnotationProcessor$SubscriptionCallback

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.