Package org.cometd

Examples of org.cometd.Channel


                            listener.deliver(fromClient,toClient,msg);
                    }
                }
                else
                {
                    Channel channel = _oort._bayeux.getChannel(msg.getChannel(),false);
                    if (channel!=null)
                        channel.publish(_oort._oortClient,msg.getData(),msg.getId());
                }
            }
        }
View Full Code Here


        for ( String[] test : tests )
        {
            _bayeux.getChannel(test[0], true);
            assertEquals(test[1], _bayeux.getChannels().toString());
           
            Channel removed = _bayeux.removeChannel(test[2]);
            assertEquals(test[3], removed == null? null : removed.toString());
            assertEquals(test[4], _bayeux.getChannels().toString());
        }
    }
View Full Code Here

        if (params < 2 || params > 4)
            throw new IllegalArgumentException("Method '" + methodName + "' does not have 2or3 parameters");
        if (!Client.class.isAssignableFrom(method.getParameterTypes()[0]))
            throw new IllegalArgumentException("Method '" + methodName + "' does not have Client as first parameter");

        Channel channel=_bayeux.getChannel(channelId,true);

        if (((ChannelImpl)channel).getChannelId().isWild())
        {
            final Method m=method;
            Client wild_client=_bayeux.newClient(_name + "-wild");
            wild_client.addListener(_listener instanceof MessageListener.Asynchronous?new AsyncWildListen(wild_client,m):new SyncWildListen(wild_client,m));
            channel.subscribe(wild_client);
        }
        else
        {
            _methods.put(channelId,method);
            channel.subscribe(_client);
        }
    }
View Full Code Here

        for ( String[] test : tests )
        {
            _bayeux.getChannel(test[0], true);
            assertEquals(test[1], _bayeux.getChannels().toString());
           
            Channel removed = _bayeux.removeChannel(test[2]);
            assertEquals(test[3], removed == null? null : removed.toString());
            assertEquals(test[4], _bayeux.getChannels().toString());
        }
    }
View Full Code Here

                    {
                        if (!_oort.isOort(joiner))
                            _seti.disassociate(userName);
                        if (timeout)
                        {
                            Channel channel=getBayeux().getChannel(channelName,false);
                            if (channel!=null)
                            {
                                Map<String,Object> leave = new HashMap<String,Object>();
                                leave.put("leave",Boolean.TRUE);
                                leave.put("user",userName);
                                channel.publish(null,leave,null);
                            }
                        }
                    }
                   
                });
View Full Code Here

                public void removed(String clientId, boolean timeout)
                {
                    members.values().remove(clientId);
                    Log.info("members: " + members);
                    // Broadcast the members to all existing members
                    Channel channel = getBayeux().getChannel(channelName, false);
                    if (channel != null) channel.publish(getClient(), members.keySet(), messageId);
                }
            });

            Log.info("Members: " + members);
            // Broadcast the members to all existing members
View Full Code Here

        ChannelImpl channel=getChannel(id);

        if (channel == null && create)
        {
            channel=new ChannelImpl(id,this);
            Channel added =_root.addChild(channel);
            if (added!=channel)
                return added;
            if (isLogInfo())
                logInfo("newChannel: " + channel);
        }
View Full Code Here

    }

    /* ------------------------------------------------------------ */
    public Channel removeChannel(String channelId)
    {
        Channel channel=getChannel(channelId);

        boolean removed=false;
        if (channel != null)
            removed=channel.remove();

        if (removed)
            return channel;
        else
            return null;
View Full Code Here

        int expectedMessages = 0;
        // foo has joined
        assertTrue(receive(lock, messages, ++expectedMessages));

        Channel publicChat = _bayeux.getChannel("/chat/demo", false);
        assertTrue(publicChat != null);
       
        for(int i=0; i<5;)
        {
            publishFromServer(publicChat, "server", "message_while_connected_" + (++i));
View Full Code Here

                            notifyMessageListener(listener, fromClient, toClient, msg);
                    }
                }
                else
                {
                    Channel channel = _oort._bayeux.getChannel(msg.getChannel(),false);
                    if (channel!=null)
                        channel.publish(_oort._oortClient,msg.getData(),msg.getId());
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.cometd.Channel

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.