Package org.apache.qpid.qmf2.common

Examples of org.apache.qpid.qmf2.common.QmfException


     */   
    public final MethodResult invokeMethod(final String name, final QmfData inArgs, final int timeout) throws QmfException
    {
        if (_agent == null)
        {
            throw new QmfException("QmfConsoleData.invokeMethod() called with null Agent");
        }
        return _agent.invokeMethod(getObjectId(), name, inArgs, timeout);
    }
View Full Code Here


     */   
    public final void invokeMethod(final String name, final QmfData inArgs, final String replyHandle) throws QmfException
    {
        if (_agent == null)
        {
            throw new QmfException("QmfConsoleData.invokeMethod() called with null Agent");
        }
        _agent.invokeMethod(getObjectId(), name, inArgs, replyHandle);
    }
View Full Code Here

    {
        if (_exception == this)
        {
            if (hasValue("error_text"))
            {
                return new QmfException(getStringValue("error_text"));
            }

            if (hasValue("message"))
            {
                return new QmfException(getStringValue("message"));
            }
        }
        return null;
    }
View Full Code Here

        if (name != null)
        {
            String[] split = name.split(":");
            if (split.length < 2 || split.length > 3)
            {
                throw new QmfException("Agent name must be in the format <vendor>:<product>[:<instance>]");
            }

            _vendor = split[0];
            _product = split[1];

            if (split.length == 3)
            {
                _instance = split[2];
            }

            _name = _vendor + ":" + _product + ":" + _instance;
        }

        _domain = (domain == null) ? "default" : domain;

        if (notifier == null)
        {
            _eventListener = new NullQmfEventListener();
        }
        else if (notifier instanceof Notifier)
        {
            _eventListener = new NotifierWrapper((Notifier)notifier, _workQueue);
        }
        else if (notifier instanceof QmfEventListener)
        {
            _eventListener = (QmfEventListener)notifier;
        }
        else
        {
            throw new QmfException("QmfCallback listener must be either a Notifier or QmfEventListener");
        }

        if (interval > 0)
        {
            _heartbeatInterval = interval;
View Full Code Here

        // to the same Agent instance at the same time.
        synchronized(this)
        {
            if (_connection != null)
            {
                throw new QmfException("Multiple connections per Agent is not supported");
            }
            _connection = conn;
        }

        if (_name == null || _vendor == null || _product == null)
        {
            throw new QmfException("The vendor, product or name is not set");
        }

        setValue("_epoch", _epoch);
        setValue("_heartbeat_interval", _heartbeatInterval);
        setValue("_name", _name);
        setValue("_product", _product);
        setValue("_vendor", _vendor);
        setValue("_instance", _instance);

        try
        {
            String directBase = "qmf." + _domain + ".direct";
            String topicBase  = "qmf." + _domain + ".topic";
            String address = directBase + "/" + _name + addressOptions;

            _asyncSession = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            _syncSession = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

            // Create a MessageProducer for the QMF topic address used to broadcast Events & Heartbeats.
            Destination topicAddress = _syncSession.createQueue(topicBase);
            _broadcaster = _syncSession.createProducer(topicAddress);
            _broadcastAddress = "'" + topicBase + "'";

            // Create a MessageProducer for the QMF direct address, mainly used for request/response
            Destination directAddress = _syncSession.createQueue(directBase);
            _responder = _syncSession.createProducer(directAddress);

            // TODO it should be possible to bind _locateConsumer, _mainConsumer and _aliasConsumer to the
            // same queue if I can figure out the correct AddressString to use, probably not a big deal though.

            // Set up MessageListener on the Agent Locate Address
            Destination locateAddress = _asyncSession.createQueue(topicBase + "/console.request.agent_locate");
            _locateConsumer = _asyncSession.createConsumer(locateAddress);
            _locateConsumer.setMessageListener(this);

            // Set up MessageListener on the Agent address
            Destination agentAddress = _asyncSession.createQueue(address);
            _mainConsumer = _asyncSession.createConsumer(agentAddress);
            _mainConsumer.setMessageListener(this);

            // If the product name has been set to qpidd we create an additional consumer address of
            // "qmf.default.direct/broker" in addition to the main address so that Consoles can talk to the
            // broker Agent without needing to do Agent discovery. This is only really needed when the Agent
            // class has been used to create the QmfManagementAgent for the Java broker QmfManagementPlugin.
            // It's important to do this as many tools (such as qpid-config) and demo code tend to use the
            // alias address rather than the discovered address when talking to the broker ManagementAgent.
            if (_product.equals("qpidd"))
            {
                String alias = directBase + "/broker";
                _log.info("Creating address {} as an alias address for the broker Agent", alias);
                Destination aliasAddress = _asyncSession.createQueue(alias);
                _aliasConsumer = _asyncSession.createConsumer(aliasAddress);
                _aliasConsumer.setMessageListener(this);
            }

            _connection.start();

            // Schedule a Heartbeat every _heartbeatInterval seconds sending the first one immediately
            _timer = new Timer(true);
            _timer.schedule(new Heartbeat(), 0, _heartbeatInterval*1000);
        }
        catch (JMSException jmse)
        {
            // If we can't create the QMF Destinations there's not much else we can do
            _log.info("JMSException {} caught in setConnection()", jmse.getMessage());
            throw new QmfException("Failed to create sessions or destinations " + jmse.getMessage());
        }
    } // end of setConnection()
View Full Code Here

     */
    public final void removeConnection(final Connection conn) throws QmfException
    {
        if (conn != _connection)
        {
            throw new QmfException("Attempt to delete unknown connection");
        }

        try
        {
            _timer.cancel();
            _connection.close();
        }
        catch (JMSException jmse)
        {
            throw new QmfException("Failed to remove connection, caught JMSException " + jmse.getMessage());
        }
        _connection = null;
    }
View Full Code Here

        if (foundObject != null)
        {
            // If a duplicate object has actually been Deleted we can reuse the address.
            if (!foundObject.isDeleted())
            {
                throw new QmfException("Duplicate QmfAgentData Address");
            }
        }

        _objectIndex.put(addr, object);
View Full Code Here

        if (name != null)
        {
            String[] split = name.split(":");
            if (split.length < 2 || split.length > 3)
            {
                throw new QmfException("Agent name must be in the format <vendor>:<product>[:<instance>]");
            }

            _vendor = split[0];
            _product = split[1];

            if (split.length == 3)
            {
                _instance = split[2];
            }

            _name = _vendor + ":" + _product + ":" + _instance;
        }

        _domain = (domain == null) ? "default" : domain;

        if (notifier == null)
        {
            _eventListener = new NullQmfEventListener();
        }
        else if (notifier instanceof Notifier)
        {
            _eventListener = new NotifierWrapper((Notifier)notifier, _workQueue);
        }
        else if (notifier instanceof QmfEventListener)
        {
            _eventListener = (QmfEventListener)notifier;
        }
        else
        {
            throw new QmfException("QmfCallback listener must be either a Notifier or QmfEventListener");
        }

        if (interval > 0)
        {
            _heartbeatInterval = interval;
View Full Code Here

        // to the same Agent instance at the same time.
        synchronized(this)
        {
            if (_connection != null)
            {
                throw new QmfException("Multiple connections per Agent is not supported");
            }
            _connection = conn;
        }

        if (_name == null || _vendor == null || _product == null)
        {
            throw new QmfException("The vendor, product or name is not set");
        }

        setValue("_epoch", _epoch);
        setValue("_heartbeat_interval", _heartbeatInterval);
        setValue("_name", _name);
        setValue("_product", _product);
        setValue("_vendor", _vendor);
        setValue("_instance", _instance);

        try
        {
            _asyncSession = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            _syncSession = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

            // Create a Destination for the QMF direct address, mainly used for request/response
            String directBase = "qmf." + _domain + ".direct";
            _quotedDirectBase = "'" + directBase + "'";
            _directAddress = _syncSession.createQueue(directBase);

            // Create a Destination for the QMF topic address used to broadcast Events & Heartbeats.
            String topicBase  = "qmf." + _domain + ".topic";
            _quotedTopicBase = "'" + topicBase + "'";
            _topicAddress = _syncSession.createQueue(topicBase);

            // Create an unidentified MessageProducer for sending to various destinations.
            _producer = _syncSession.createProducer(null);

            // TODO it should be possible to bind _locateConsumer, _mainConsumer and _aliasConsumer to the
            // same queue if I can figure out the correct AddressString to use, probably not a big deal though.

            // Set up MessageListener on the Agent Locate Address
            Destination locateAddress = _asyncSession.createQueue(topicBase + "/console.request.agent_locate");
            _locateConsumer = _asyncSession.createConsumer(locateAddress);
            _locateConsumer.setMessageListener(this);

            // Set up MessageListener on the Agent address
            String address = directBase + "/" + _name + addressOptions;
            Destination agentAddress = _asyncSession.createQueue(address);
            _mainConsumer = _asyncSession.createConsumer(agentAddress);
            _mainConsumer.setMessageListener(this);

            // If the product name has been set to qpidd we create an additional consumer address of
            // "qmf.default.direct/broker" in addition to the main address so that Consoles can talk to the
            // broker Agent without needing to do Agent discovery. This is only really needed when the Agent
            // class has been used to create the QmfManagementAgent for the Java broker QmfManagementPlugin.
            // It's important to do this as many tools (such as qpid-config) and demo code tend to use the
            // alias address rather than the discovered address when talking to the broker ManagementAgent.
            if (_product.equals("qpidd"))
            {
                String alias = directBase + "/broker";
                _log.info("Creating address {} as an alias address for the broker Agent", alias);
                Destination aliasAddress = _asyncSession.createQueue(alias);
                _aliasConsumer = _asyncSession.createConsumer(aliasAddress);
                _aliasConsumer.setMessageListener(this);
            }

            _connection.start();

            // Schedule a Heartbeat every _heartbeatInterval seconds sending the first one immediately
            _timer = new Timer(true);
            _timer.schedule(new Heartbeat(), 0, _heartbeatInterval*1000);
        }
        catch (JMSException jmse)
        {
            // If we can't create the QMF Destinations there's not much else we can do
            _log.info("JMSException {} caught in setConnection()", jmse.getMessage());
            throw new QmfException("Failed to create sessions or destinations " + jmse.getMessage());
        }
    } // end of setConnection()
View Full Code Here

     */
    public final void removeConnection(final Connection conn) throws QmfException
    {
        if (conn != _connection)
        {
            throw new QmfException("Attempt to delete unknown connection");
        }

        try
        {
            _timer.cancel();
            _connection.close();
        }
        catch (JMSException jmse)
        {
            throw new QmfException("Failed to remove connection, caught JMSException " + jmse.getMessage());
        }
        _connection = null;
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.qmf2.common.QmfException

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.