Package org.apache.qpid.server.model

Examples of org.apache.qpid.server.model.Exchange


    {
        if(childClass == org.apache.qpid.server.model.Binding.class)
        {
            if(otherParents != null && otherParents.length == 1 && otherParents[0] instanceof Exchange)
            {
                Exchange exchange = (Exchange) otherParents[0];
                if(exchange.getParent(org.apache.qpid.server.model.VirtualHost.class) == getParent(org.apache.qpid.server.model.VirtualHost.class))
                {
                    return (C) createBinding(exchange, attributes);
                }
                else
                {
View Full Code Here


            _queue.setAttribute(Queue.ALTERNATE_EXCHANGE, getAlternateExchange(), null);
        }
        else
        {
            VirtualHost virtualHost = _queue.getParent(VirtualHost.class);
            Exchange exchange = MBeanUtils.findExchangeFromExchangeName(virtualHost, exchangeName);

            _queue.setAttribute(Queue.ALTERNATE_EXCHANGE, getAlternateExchange(), exchange);
        }
    }
View Full Code Here

        }
    }

    public String getAlternateExchange()
    {
        Exchange alternateExchange = (Exchange) _queue.getAttribute(Queue.ALTERNATE_EXCHANGE);
        return alternateExchange == null ? null : alternateExchange.getName();
    }
View Full Code Here

    @Override
    public void unregisterExchange(String exchangeName)
            throws IOException, JMException, MBeanException
    {
        Exchange theExchange = MBeanUtils.findExchangeFromExchangeName(_virtualHostMBean.getVirtualHost(), exchangeName);
        try
        {
            theExchange.delete();
        }
        catch (IllegalStateException ex)
        {
            final JMException jme = new JMException(ex.toString());
            throw new MBeanException(jme, "Error in unregistering exchange " + exchangeName);
View Full Code Here

    {
        if(childClass == org.apache.qpid.server.model.Binding.class)
        {
            if(otherParents != null && otherParents.length == 1 && otherParents[0] instanceof Exchange)
            {
                Exchange exchange = (Exchange) otherParents[0];
                if(exchange.getParent(org.apache.qpid.server.model.VirtualHost.class) == getParent(org.apache.qpid.server.model.VirtualHost.class))
                {
                    return (C) createBinding(exchange, attributes);
                }
                else
                {
View Full Code Here

            _queue.setAttribute(Queue.ALTERNATE_EXCHANGE, getAlternateExchange(), null);
        }
        else
        {
            VirtualHost virtualHost = _queue.getParent(VirtualHost.class);
            Exchange exchange = MBeanUtils.findExchangeFromExchangeName(virtualHost, exchangeName);

            _queue.setAttribute(Queue.ALTERNATE_EXCHANGE, getAlternateExchange(), exchange);
        }
    }
View Full Code Here

        }
    }

    public String getAlternateExchange()
    {
        Exchange alternateExchange = (Exchange) _queue.getAttribute(Queue.ALTERNATE_EXCHANGE);
        return alternateExchange == null ? null : alternateExchange.getName();
    }
View Full Code Here

    {
        if(childClass == org.apache.qpid.server.model.Binding.class)
        {
            if(otherParents != null && otherParents.length == 1 && otherParents[0] instanceof Exchange)
            {
                Exchange exchange = (Exchange) otherParents[0];
                if(exchange.getParent(org.apache.qpid.server.model.VirtualHost.class) == getParent(org.apache.qpid.server.model.VirtualHost.class))
                {
                    return (C) createBinding(exchange, attributes);
                }
                else
                {
View Full Code Here

                                if (object != null)
                                {
                                    org.apache.qpid.server.qmf2.agentdata.Exchange ex =
                                        (org.apache.qpid.server.qmf2.agentdata.Exchange)object;

                                    Exchange altEx = ex.getExchange();
                                    queue.setAttribute("alternateExchange", null, altEx);
                                }
                            }
                        }
                        else if (type.equals("binding")) // create binding.
                        {
                            Exchange exchange = nameParser.getExchange();
                            if (exchange == null)
                            {
                                agent.raiseException(handle, "Cannot create binding on Exchange " +
                                                     nameParser.getExchangeName());
                                return;
                            }
                            else
                            {
                                Map<String, Object> attributes = Collections.emptyMap();
                                exchange.createBinding(nameParser.getBindingKey(), nameParser.getQueue(),
                                                       properties, attributes);
                            }
                        }

                        agent.methodResponse(methodName, handle, outArgs, null);
                    }
                    catch (Exception e)
                    {
                        agent.raiseException(handle, e.getMessage());
                    }
                }
                else // method = delete
                {
                    try
                    {
                        if (type.equals("exchange")) // delete exchange.
                        {
                            Exchange exchange = nameParser.getExchange();
                            if (exchange != null)
                            {
                                exchange.delete();
                            }
                        }
                        else if (type.equals("queue")) // delete queue.
                        {
                            Queue queue = nameParser.getQueue();
View Full Code Here

        // Set the altExchange reference if an alternateExchange exists and hasn't already been set.
        // Not sure how to set this closer to the Constructor. At the moment the _alternateExchangeName gets set
        // too late to populate the "altEx" property of the queueDeclareEvent.
        if (_alternateExchange == null)
        {
            Exchange altEx = (Exchange)_queue.getAttribute("alternateExchange");
            if (altEx != null)
            {
                _alternateExchangeName = _vhostName + altEx.getName();
                _alternateExchange = new ObjectId("", "org.apache.qpid.broker:exchange:" + _alternateExchangeName, 0);
                setRefValue("altExchange", _alternateExchange);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.model.Exchange

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.