Examples of QmfAgentData


Examples of org.apache.qpid.qmf2.agent.QmfAgentData

    @Override
    public void childAdded(final ConfiguredObject object, final ConfiguredObject child)
    {
//System.out.println("childAdded() " + child.getClass().getSimpleName() + "." + child.getName());

        QmfAgentData data = null;

        if (child instanceof Broker)
        {
            data = new org.apache.qpid.server.qmf2.agentdata.Broker((Broker)child);
        }
        else if (child instanceof Connection)
        {
            if (!agentConnection && !_objects.containsKey(child))
            {
                // If the parent object is the default vhost set it to null so that the Connection ignores it.
                VirtualHost vhost = (object.getName().equals(_defaultVirtualHost)) ? null : (VirtualHost)object;
                data = new org.apache.qpid.server.qmf2.agentdata.Connection(vhost, (Connection)child);
                _objects.put(child, data);

                // Raise a Client Connect Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Connection)data).createClientConnectEvent());
            }
            agentConnection = false; // Only ignore the first Connection, which is the one from the Agent.
        }
        else if (child instanceof Session)
        {
            if (!_objects.containsKey(child))
            {
                QmfAgentData ref = _objects.get(object); // Get the Connection QmfAgentData so we can get connectionRef.
                if (ref != null)
                {
                    data = new org.apache.qpid.server.qmf2.agentdata.Session((Session)child, ref.getObjectId());
                    _objects.put(child, data);
                }
            }
        }
        else if (child instanceof Exchange)
        {
            if (!_objects.containsKey(child))
            {
                // If the parent object is the default vhost set it to null so that the Connection ignores it.
                VirtualHost vhost = (object.getName().equals(_defaultVirtualHost)) ? null : (VirtualHost)object;
                data = new org.apache.qpid.server.qmf2.agentdata.Exchange(vhost, (Exchange)child);
                _objects.put(child, data);

                // Raise an Exchange Declare Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Exchange)data).createExchangeDeclareEvent());

            }
        }
        else if (child instanceof Queue)
        {
            if (!_objects.containsKey(child))
            {
                // If the parent object is the default vhost set it to null so that the Connection ignores it.
                VirtualHost vhost = (object.getName().equals(_defaultVirtualHost)) ? null : (VirtualHost)object;
                data = new org.apache.qpid.server.qmf2.agentdata.Queue(vhost, (Queue)child);
                _objects.put(child, data);

                // Raise a Queue Declare Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Queue)data).createQueueDeclareEvent());
            }
        }
        else if (child instanceof Binding)
        {
            // Bindings are a little more complex because in QMF bindings contain exchangeRef and queueRef properties
            // whereas with the Java Broker model Binding is a child of Queue and Exchange. To cope with this we
            // first try to create or retrieve the QMF Binding Object then add either the Queue or Exchange reference
            // depending on whether Queue or Exchange was the parent of this addChild() call.
            if (!_objects.containsKey(child))
            {
                data = new org.apache.qpid.server.qmf2.agentdata.Binding((Binding)child);
                _objects.put(child, data);

                String eName = child.getAttribute("exchange").toString();
                if (!eName.equals("<<default>>")) // Don't send Event for Binding to default direct.
                {
                    // Raise a Bind Event.
                    _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Binding)data).createBindEvent());
                }
            }

            org.apache.qpid.server.qmf2.agentdata.Binding binding =
                (org.apache.qpid.server.qmf2.agentdata.Binding)_objects.get(child);

            QmfAgentData ref = _objects.get(object);
            if (ref != null)
            {
                if (object instanceof Queue)
                {
                    binding.setQueueRef(ref.getObjectId());
                }
                else if (object instanceof Exchange)
                {
                    binding.setExchangeRef(ref.getObjectId());
                }
            }
        }
        else if (child instanceof Consumer) // AKA Subscription
        {
            // Subscriptions are a little more complex because in QMF Subscriptions contain sessionRef and queueRef
            // properties whereas with the Java Broker model Consumer is a child of Queue and Session. To cope with
            // this we first try to create or retrieve the QMF Subscription Object then add either the Queue or
            // Session reference depending on whether Queue or Session was the parent of this addChild() call.
            if (!_objects.containsKey(child))
            {
                data = new org.apache.qpid.server.qmf2.agentdata.Subscription((Consumer)child);
                _objects.put(child, data);
           }

            org.apache.qpid.server.qmf2.agentdata.Subscription subscription =
                (org.apache.qpid.server.qmf2.agentdata.Subscription)_objects.get(child);

            QmfAgentData ref = _objects.get(object);
            if (ref != null)
            {
                if (object instanceof Queue)
                {
                    subscription.setQueueRef(ref.getObjectId(), (Queue)object);
                    // Raise a Subscribe Event - N.B. Need to do it *after* we've set the queueRef.
                    _agent.raiseEvent(subscription.createSubscribeEvent());
                }
                else if (object instanceof Session)
                {
                    subscription.setSessionRef(ref.getObjectId());
                }
            }
        }

        try
View Full Code Here

Examples of org.apache.qpid.qmf2.agent.QmfAgentData

//System.out.println("childRemoved: " + child.getClass().getSimpleName() + "." + child.getName());

        child.removeChangeListener(this);

        // Look up the associated QmfAgentData and mark it for deletion by the Agent.
        QmfAgentData data = _objects.get(child);
        if (data != null)
        {
            if (child instanceof Connection)
            {
                // Raise a Client Disconnect Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Connection)data).createClientDisconnectEvent());
            }
            else if (child instanceof Session)
            {
                // no-op, don't need to do anything specific when Session is removed.
            }
            else if (child instanceof Exchange)
            {
                // Raise an Exchange Delete Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Exchange)data).createExchangeDeleteEvent());
            }
            else if (child instanceof Queue)
            {
                // Raise a Queue Delete Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Queue)data).createQueueDeleteEvent());
            }
            else if (child instanceof Binding)
            {
                String eName = child.getAttribute("exchange").toString();
                if (!eName.equals("<<default>>")) // Don't send Event for Unbinding from default direct.
                {
                    // Raise an Unbind Event.
                    _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Binding)data).createUnbindEvent());
                }
            }
            else if (child instanceof Consumer)
            {
                // Raise an Unsubscribe Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Subscription)data).createUnsubscribeEvent());
            }

            data.destroy();
        }

        // Remove the mapping from the internal ConfiguredObject->QmfAgentData Map.
        _objects.remove(child);
    }
View Full Code Here

Examples of org.apache.qpid.qmf2.agent.QmfAgentData

            String methodName = methodCallParams.getName();
            ObjectId objectId = methodCallParams.getObjectId();

            // Look up QmfAgentData by ObjectId from the Agent's internal Object store.
            QmfAgentData object = _agent.getObject(objectId);
            if (object == null)
            {
                _agent.raiseException(item.getHandle(), "No object found with ID=" + objectId);
            }
            else
            {
                // If we've found a valid QmfAgentData check it's a Broker or Queue and if so call the generic
                // invokeMethod on these objects, if not send an Exception as we don't support methods on
                // other classes yet.
                if (object instanceof org.apache.qpid.server.qmf2.agentdata.Broker)
                {
                    org.apache.qpid.server.qmf2.agentdata.Broker broker =
                        (org.apache.qpid.server.qmf2.agentdata.Broker) object;
                    broker.invokeMethod(_agent, item.getHandle(), methodName, methodCallParams.getArgs());
                }
                else if (object instanceof org.apache.qpid.server.qmf2.agentdata.Queue)
                {
                    org.apache.qpid.server.qmf2.agentdata.Queue queue =
                        (org.apache.qpid.server.qmf2.agentdata.Queue) object;
                    queue.invokeMethod(_agent, item.getHandle(), methodName, methodCallParams.getArgs());
                }
                else
                {
                    _agent.raiseException(item.getHandle(), "Unknown Method " + methodName + " on " +
                                          object.getClass().getSimpleName());
                }
            }
        }
    }
View Full Code Here

Examples of org.apache.qpid.qmf2.agent.QmfAgentData

                            {
                                ObjectId objectId =
                                        new ObjectId("", "org.apache.qpid.broker:exchange:" + alternateExchange, 0);

                                // Look up Exchange QmfAgentData by ObjectId from the Agent's internal Object store.
                                QmfAgentData object = agent.getObject(objectId);
                                if (object != null)
                                {
                                    org.apache.qpid.server.qmf2.agentdata.Exchange ex =
                                        (org.apache.qpid.server.qmf2.agentdata.Exchange)object;
View Full Code Here

Examples of org.apache.qpid.qmf2.agent.QmfAgentData

        if (_log.isDebugEnabled())
        {
            _log.debug("childAdded: " + child.getClass().getSimpleName() + "." + child.getName());
        }

        QmfAgentData data = null;

        // We current don't listen for new virtualhostnodes or new virtualhosts, so any new instances
        // of these objects wont be seen through QMF until the Broker is restarted.

        if (child instanceof Broker)
        {
            data = new org.apache.qpid.server.qmf2.agentdata.Broker((Broker)child);
        }
        else if (child instanceof Connection)
        {
            if (!agentConnection && !_objects.containsKey(child))
            {
                // If the parent object is the default vhost set it to null so that the Connection ignores it.
                VirtualHost vhost = (object.getName().equals(_defaultVirtualHost)) ? null : (VirtualHost)object;
                data = new org.apache.qpid.server.qmf2.agentdata.Connection(vhost, (Connection)child);
                _objects.put(child, data);

                // Raise a Client Connect Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Connection)data).createClientConnectEvent());
            }
            agentConnection = false; // Only ignore the first Connection, which is the one from the Agent.
        }
        else if (child instanceof Session)
        {
            if (!_objects.containsKey(child))
            {
                QmfAgentData ref = _objects.get(object); // Get the Connection QmfAgentData so we can get connectionRef.
                if (ref != null)
                {
                    data = new org.apache.qpid.server.qmf2.agentdata.Session((Session)child, ref.getObjectId());
                    _objects.put(child, data);
                }
            }
        }
        else if (child instanceof Exchange)
        {
            if (!_objects.containsKey(child))
            {
                // If the parent object is the default vhost set it to null so that the Connection ignores it.
                VirtualHost vhost = (object.getName().equals(_defaultVirtualHost)) ? null : (VirtualHost)object;
                data = new org.apache.qpid.server.qmf2.agentdata.Exchange(vhost, (Exchange)child);
                _objects.put(child, data);

                // Raise an Exchange Declare Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Exchange)data).createExchangeDeclareEvent());

            }
        }
        else if (child instanceof Queue)
        {
            if (!_objects.containsKey(child))
            {
                // If the parent object is the default vhost set it to null so that the Connection ignores it.
                VirtualHost vhost = (object.getName().equals(_defaultVirtualHost)) ? null : (VirtualHost)object;
                data = new org.apache.qpid.server.qmf2.agentdata.Queue(vhost, (Queue)child);
                _objects.put(child, data);

                // Raise a Queue Declare Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Queue)data).createQueueDeclareEvent());
            }
        }
        else if (child instanceof Binding)
        {
            // Bindings are a little more complex because in QMF bindings contain exchangeRef and queueRef properties
            // whereas with the Java Broker model Binding is a child of Queue and Exchange. To cope with this we
            // first try to create or retrieve the QMF Binding Object then add either the Queue or Exchange reference
            // depending on whether Queue or Exchange was the parent of this addChild() call.
            if (!_objects.containsKey(child))
            {
                data = new org.apache.qpid.server.qmf2.agentdata.Binding((Binding)child);
                _objects.put(child, data);

                String eName = ((Binding)child).getExchange().getName();
                if (!eName.equals("<<default>>")) // Don't send Event for Binding to default direct.
                {
                    // Raise a Bind Event.
                    _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Binding)data).createBindEvent());
                }
            }

            org.apache.qpid.server.qmf2.agentdata.Binding binding =
                (org.apache.qpid.server.qmf2.agentdata.Binding)_objects.get(child);

            QmfAgentData ref = _objects.get(object);
            if (ref != null)
            {
                if (object instanceof Queue)
                {
                    binding.setQueueRef(ref.getObjectId());
                }
                else if (object instanceof Exchange)
                {
                    binding.setExchangeRef(ref.getObjectId());
                }
            }
        }
        else if (child instanceof Consumer) // AKA Subscription
        {
            // Subscriptions are a little more complex because in QMF Subscriptions contain sessionRef and queueRef
            // properties whereas with the Java Broker model Consumer is a child of Queue and Session. To cope with
            // this we first try to create or retrieve the QMF Subscription Object then add either the Queue or
            // Session reference depending on whether Queue or Session was the parent of this addChild() call.
            if (!_objects.containsKey(child))
            {
                data = new org.apache.qpid.server.qmf2.agentdata.Subscription((Consumer)child);
                _objects.put(child, data);
           }

            org.apache.qpid.server.qmf2.agentdata.Subscription subscription =
                (org.apache.qpid.server.qmf2.agentdata.Subscription)_objects.get(child);

            QmfAgentData ref = _objects.get(object);
            if (ref != null)
            {
                if (object instanceof Queue)
                {
                    subscription.setQueueRef(ref.getObjectId(), (Queue)object);
                    // Raise a Subscribe Event - N.B. Need to do it *after* we've set the queueRef.
                    _agent.raiseEvent(subscription.createSubscribeEvent());
                }
                else if (object instanceof Session)
                {
                    subscription.setSessionRef(ref.getObjectId());
                }
            }
        }

        try
View Full Code Here

Examples of org.apache.qpid.qmf2.agent.QmfAgentData

        }

        child.removeChangeListener(this);

        // Look up the associated QmfAgentData and mark it for deletion by the Agent.
        QmfAgentData data = _objects.get(child);

        if (data != null)
        {
            if (child instanceof Connection)
            {
                // Raise a Client Disconnect Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Connection)data).createClientDisconnectEvent());
            }
            else if (child instanceof Session)
            {
                // no-op, don't need to do anything specific when Session is removed.
            }
            else if (child instanceof Exchange)
            {
                // Raise an Exchange Delete Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Exchange)data).createExchangeDeleteEvent());
            }
            else if (child instanceof Queue)
            {
                // Raise a Queue Delete Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Queue)data).createQueueDeleteEvent());
            }
            else if (child instanceof Binding)
            {
                String eName = ((Binding)child).getExchange().getName();
                if (!eName.equals("<<default>>")) // Don't send Event for Unbinding from default direct.
                {
                    // Raise an Unbind Event.
                    _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Binding)data).createUnbindEvent());
                }
            }
            else if (child instanceof Consumer)
            {
                // Raise an Unsubscribe Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Subscription)data).createUnsubscribeEvent());
            }

            data.destroy();
        }

        // Remove the mapping from the internal ConfiguredObject->QmfAgentData Map.
        _objects.remove(child);
    }
View Full Code Here

Examples of org.apache.qpid.qmf2.agent.QmfAgentData

            String methodName = methodCallParams.getName();
            ObjectId objectId = methodCallParams.getObjectId();

            // Look up QmfAgentData by ObjectId from the Agent's internal Object store.
            QmfAgentData object = _agent.getObject(objectId);
            if (object == null)
            {
                _agent.raiseException(item.getHandle(), "No object found with ID=" + objectId);
            }
            else
            {
                // If we've found a valid QmfAgentData check it's a Broker or Queue and if so call the generic
                // invokeMethod on these objects, if not send an Exception as we don't support methods on
                // other classes yet.
                if (object instanceof org.apache.qpid.server.qmf2.agentdata.Broker)
                {
                    org.apache.qpid.server.qmf2.agentdata.Broker broker =
                        (org.apache.qpid.server.qmf2.agentdata.Broker) object;
                    broker.invokeMethod(_agent, item.getHandle(), methodName, methodCallParams.getArgs());
                }
                else if (object instanceof org.apache.qpid.server.qmf2.agentdata.Queue)
                {
                    org.apache.qpid.server.qmf2.agentdata.Queue queue =
                        (org.apache.qpid.server.qmf2.agentdata.Queue) object;
                    queue.invokeMethod(_agent, item.getHandle(), methodName, methodCallParams.getArgs());
                }
                else
                {
                    _agent.raiseException(item.getHandle(), "Unknown Method " + methodName + " on " +
                                          object.getClass().getSimpleName());
                }
            }
        }
    }
View Full Code Here

Examples of org.apache.qpid.qmf2.agent.QmfAgentData

    @Override
    public void childAdded(final ConfiguredObject object, final ConfiguredObject child)
    {
//System.out.println("childAdded: " + child.getClass().getSimpleName() + "." + child.getName());

        QmfAgentData data = null;

        if (child instanceof Broker)
        {
            data = new org.apache.qpid.server.qmf2.agentdata.Broker((Broker)child);
        }
        else if (child instanceof Connection)
        {
            if (!agentConnection && !_objects.containsKey(child))
            {
                // If the parent object is the default vhost set it to null so that the Connection ignores it.
                VirtualHost vhost = (object.getName().equals(_defaultVirtualHost)) ? null : (VirtualHost)object;
                data = new org.apache.qpid.server.qmf2.agentdata.Connection(vhost, (Connection)child);
                _objects.put(child, data);

                // Raise a Client Connect Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Connection)data).createClientConnectEvent());
            }
            agentConnection = false; // Only ignore the first Connection, which is the one from the Agent.
        }
        else if (child instanceof Session)
        {
            if (!_objects.containsKey(child))
            {
                QmfAgentData ref = _objects.get(object); // Get the Connection QmfAgentData so we can get connectionRef.
                if (ref != null)
                {
                    data = new org.apache.qpid.server.qmf2.agentdata.Session((Session)child, ref.getObjectId());
                    _objects.put(child, data);
                }
            }
        }
        else if (child instanceof Exchange)
        {
            if (!_objects.containsKey(child))
            {
                // If the parent object is the default vhost set it to null so that the Connection ignores it.
                VirtualHost vhost = (object.getName().equals(_defaultVirtualHost)) ? null : (VirtualHost)object;
                data = new org.apache.qpid.server.qmf2.agentdata.Exchange(vhost, (Exchange)child);
                _objects.put(child, data);

                // Raise an Exchange Declare Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Exchange)data).createExchangeDeclareEvent());

            }
        }
        else if (child instanceof Queue)
        {
            if (!_objects.containsKey(child))
            {
                // If the parent object is the default vhost set it to null so that the Connection ignores it.
                VirtualHost vhost = (object.getName().equals(_defaultVirtualHost)) ? null : (VirtualHost)object;
                data = new org.apache.qpid.server.qmf2.agentdata.Queue(vhost, (Queue)child);
                _objects.put(child, data);

                // Raise a Queue Declare Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Queue)data).createQueueDeclareEvent());
            }
        }
        else if (child instanceof Binding)
        {
            // Bindings are a little more complex because in QMF bindings contain exchangeRef and queueRef properties
            // whereas with the Java Broker model Binding is a child of Queue and Exchange. To cope with this we
            // first try to create or retrieve the QMF Binding Object then add either the Queue or Exchange reference
            // depending on whether Queue or Exchange was the parent of this addChild() call.
            if (!_objects.containsKey(child))
            {
                data = new org.apache.qpid.server.qmf2.agentdata.Binding((Binding)child);
                _objects.put(child, data);

                String eName = ((Binding)child).getExchange().getName();
                if (!eName.equals("<<default>>")) // Don't send Event for Binding to default direct.
                {
                    // Raise a Bind Event.
                    _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Binding)data).createBindEvent());
                }
            }

            org.apache.qpid.server.qmf2.agentdata.Binding binding =
                (org.apache.qpid.server.qmf2.agentdata.Binding)_objects.get(child);

            QmfAgentData ref = _objects.get(object);
            if (ref != null)
            {
                if (object instanceof Queue)
                {
                    binding.setQueueRef(ref.getObjectId());
                }
                else if (object instanceof Exchange)
                {
                    binding.setExchangeRef(ref.getObjectId());
                }
            }
        }
        else if (child instanceof Consumer) // AKA Subscription
        {
            // Subscriptions are a little more complex because in QMF Subscriptions contain sessionRef and queueRef
            // properties whereas with the Java Broker model Consumer is a child of Queue and Session. To cope with
            // this we first try to create or retrieve the QMF Subscription Object then add either the Queue or
            // Session reference depending on whether Queue or Session was the parent of this addChild() call.
            if (!_objects.containsKey(child))
            {
                data = new org.apache.qpid.server.qmf2.agentdata.Subscription((Consumer)child);
                _objects.put(child, data);
           }

            org.apache.qpid.server.qmf2.agentdata.Subscription subscription =
                (org.apache.qpid.server.qmf2.agentdata.Subscription)_objects.get(child);

            QmfAgentData ref = _objects.get(object);
            if (ref != null)
            {
                if (object instanceof Queue)
                {
                    subscription.setQueueRef(ref.getObjectId(), (Queue)object);
                    // Raise a Subscribe Event - N.B. Need to do it *after* we've set the queueRef.
                    _agent.raiseEvent(subscription.createSubscribeEvent());
                }
                else if (object instanceof Session)
                {
                    subscription.setSessionRef(ref.getObjectId());
                }
            }
        }

        try
View Full Code Here

Examples of org.apache.qpid.qmf2.agent.QmfAgentData

//System.out.println("childRemoved: " + child.getClass().getSimpleName() + "." + child.getName());

        child.removeChangeListener(this);

        // Look up the associated QmfAgentData and mark it for deletion by the Agent.
        QmfAgentData data = _objects.get(child);

        if (data != null)
        {
            if (child instanceof Connection)
            {
                // Raise a Client Disconnect Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Connection)data).createClientDisconnectEvent());
            }
            else if (child instanceof Session)
            {
                // no-op, don't need to do anything specific when Session is removed.
            }
            else if (child instanceof Exchange)
            {
                // Raise an Exchange Delete Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Exchange)data).createExchangeDeleteEvent());
            }
            else if (child instanceof Queue)
            {
                // Raise a Queue Delete Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Queue)data).createQueueDeleteEvent());
            }
            else if (child instanceof Binding)
            {
                String eName = ((Binding)child).getExchange().getName();
                if (!eName.equals("<<default>>")) // Don't send Event for Unbinding from default direct.
                {
                    // Raise an Unbind Event.
                    _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Binding)data).createUnbindEvent());
                }
            }
            else if (child instanceof Consumer)
            {
                // Raise an Unsubscribe Event.
                _agent.raiseEvent(((org.apache.qpid.server.qmf2.agentdata.Subscription)data).createUnsubscribeEvent());
            }

            data.destroy();
        }

        // Remove the mapping from the internal ConfiguredObject->QmfAgentData Map.
        _objects.remove(child);
    }
View Full Code Here

Examples of org.apache.qpid.qmf2.agent.QmfAgentData

            String methodName = methodCallParams.getName();
            ObjectId objectId = methodCallParams.getObjectId();

            // Look up QmfAgentData by ObjectId from the Agent's internal Object store.
            QmfAgentData object = _agent.getObject(objectId);
            if (object == null)
            {
                _agent.raiseException(item.getHandle(), "No object found with ID=" + objectId);
            }
            else
            {
                // If we've found a valid QmfAgentData check it's a Broker or Queue and if so call the generic
                // invokeMethod on these objects, if not send an Exception as we don't support methods on
                // other classes yet.
                if (object instanceof org.apache.qpid.server.qmf2.agentdata.Broker)
                {
                    org.apache.qpid.server.qmf2.agentdata.Broker broker =
                        (org.apache.qpid.server.qmf2.agentdata.Broker) object;
                    broker.invokeMethod(_agent, item.getHandle(), methodName, methodCallParams.getArgs());
                }
                else if (object instanceof org.apache.qpid.server.qmf2.agentdata.Queue)
                {
                    org.apache.qpid.server.qmf2.agentdata.Queue queue =
                        (org.apache.qpid.server.qmf2.agentdata.Queue) object;
                    queue.invokeMethod(_agent, item.getHandle(), methodName, methodCallParams.getArgs());
                }
                else
                {
                    _agent.raiseException(item.getHandle(), "Unknown Method " + methodName + " on " +
                                          object.getClass().getSimpleName());
                }
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.