Package org.apache.qpid.qmf2.console

Examples of org.apache.qpid.qmf2.console.Console


        _filter = filter;
        _purge = purge;
        try
        {
            Connection connection = ConnectionHelper.createConnection(url, connectionOptions);       
            _console = new Console(this);
            _console.addConnection(connection);
            updateQueueCache();
        }
        catch (QmfException qmfe)
        {
View Full Code Here


        System.out.println("Connecting to " + url);
        _url = url;
        try
        {
            Connection connection = ConnectionHelper.createConnection(url, connectionOptions);       
            _console = new Console(this);
            _console.addConnection(connection);
        }
        catch (QmfException qmfe)
        {
            System.err.println ("QmfException " + qmfe.getMessage() + " caught in QpidPrintEvents constructor");
View Full Code Here

                    final String id, final String agentName, final String command, final String args)
    {
        try
        {
            Connection connection = ConnectionHelper.createConnection(url, connectionOptions);       
            _console = new Console();
            _console.addConnection(connection);

            // Find the specified Agent
            Agent agent = _console.findAgent(agentName);
            if (agent == null)
View Full Code Here

        _url = url;
        _whitelist = whitelist;
        try
        {
            Connection connection = ConnectionHelper.createConnection(url, connectionOptions);       
            _console = new Console(this);
            _console.addConnection(connection);
            checkExistingSubscriptions();
        }
        catch (QmfException qmfe)
        {
View Full Code Here

    public ConnectionLogger(final String url, final String connectionOptions, final boolean logQueues)
    {
        try
        {
            Connection connection = ConnectionHelper.createConnection(url, connectionOptions);       
            _console = new Console(this);
            _console.addConnection(connection);
            _logQueues = logQueues;
            System.out.println("Hit Return to exit");
            logConnectionInformation();
        }
View Full Code Here

                // if there was an intention to retrieve work items, but in a fairly general REST API we can't guarantee
                // that clients will. ConsoleLease acts to make the WorkQueue "circular" by deleting items from the
                // front of the WorkQueue if it exceeds a particular size.
                if (_disableEvents)
                {
                    _console = new Console(_name, null, null, null);
                    _console.disableEvents();
                }
                else
                {
                    BlockingNotifier notifier = new BlockingNotifier();
                    _console = new Console(_name, null, notifier, null);
                }
                _console.addConnection(_connection);
                _connected = true;
                _expireCount = UNUSED_THRESHOLD;
                notifyAll();
View Full Code Here

                        tx.sendResponse(HTTP_OK, "application/json", connection.toString());
                    }
                    else
                    { // In this block we are dealing with resources associated with a specified connectionName.
                      // path describes the resources specifically related to "/qpid/connection/<connectionName>"
                        Console console = connection.getConsole();

                        if (path.startsWith("console/objects/"))
                        { // Get information about specified objects.
                            path = path.substring(16);
                            sendGetObjectsResponse(tx, console, path);
                        }
                        else if (path.startsWith("console/objects") && path.length() == 15)
                        {  // If objects is unspecified treat as a synonym for classes.
                            tx.sendResponse(HTTP_OK, "application/json", JSON.fromObject(console.getClasses()));
                        }
                        else if (path.startsWith("console/address/"))
                        { // Get the Console AMQP Address
                            tx.sendResponse(HTTP_OK, "application/json", JSON.fromObject(console.getAddress()));
                        }
                        else if (path.startsWith("console/address") && path.length() == 15)
                        { // Get the Console AMQP Address
                            tx.sendResponse(HTTP_OK, "application/json", JSON.fromObject(console.getAddress()));
                        }
                        else if (path.startsWith("console/workItemCount/"))
                        { // Returns the count of pending WorkItems that can be retrieved.
                            tx.sendResponse(HTTP_OK, "text/plain", "" + console.getWorkitemCount());
                        }
                        else if (path.startsWith("console/workItemCount") && path.length() == 21)
                        { // Returns the count of pending WorkItems that can be retrieved.
                            tx.sendResponse(HTTP_OK, "text/plain", "" + console.getWorkitemCount());
                        }
                        else if (path.startsWith("console/nextWorkItem/"))
                        { // Obtains the next pending work item, or null if none available.
                            tx.sendResponse(HTTP_OK, "application/json", JSON.fromObject(console.getNextWorkitem()));
                        }
                        else if (path.startsWith("console/nextWorkItem") && path.length() == 20)
                        { // Obtains the next pending work item, or null if none available.
                            tx.sendResponse(HTTP_OK, "application/json", JSON.fromObject(console.getNextWorkitem()));
                        }
                        else if (path.startsWith("console/agents") && path.length() == 14)
                        { // Get information about all available Agents.
                            tx.sendResponse(HTTP_OK, "application/json", JSON.fromObject(console.getAgents()));
                        }
                        else if (path.startsWith("console/agent/"))
                        { // Get information about a specified Agent.
                            Agent agent = console.getAgent(path.substring(14));
                            if (agent == null)
                            {
                                tx.sendResponse(HTTP_NOT_FOUND, "text/plain", "404 Not Found.");
                            }
                            else
                            {
                                tx.sendResponse(HTTP_OK, "application/json", JSON.fromObject(agent));
                            }
                        }
                        else if (path.startsWith("console/agent") && path.length() == 13)
                        { // If agent is unspecified treat as a synonym for agents.
                            tx.sendResponse(HTTP_OK, "application/json", JSON.fromObject(console.getAgents()));
                        }
                        else if (path.startsWith("console/classes/"))
                        { // Get information about the classes for a specified Agent
                            path = path.substring(16); // Get Agent name

                            // TODO handle getClasses() for specified Agent
                            tx.sendResponse(HTTP_NOT_IMPLEMENTED, "text/plain", "501 getClasses() for specified Agent not yet implemented.");
                        }
                        else if (path.startsWith("console/classes") && path.length() == 15)
                        { // Get information about all the classes for all Agents
                            tx.sendResponse(HTTP_OK, "application/json", JSON.fromObject(console.getClasses()));
                        }
                        else if (path.startsWith("console/packages/"))
                        { // Get information about the packages for a specified Agent
                            path = path.substring(17); // Get Agent name

                            // TODO handle getPackages() for specified Agent.
                            tx.sendResponse(HTTP_NOT_IMPLEMENTED, "text/plain", "501 getPackages() for specified Agent not yet implemented.");
                        }
                        else if (path.startsWith("object/"))
                        {
                            /**
                             * This is the REST implementation of getObjects(oid) it is also the equivalent of
                             * the QmfConsoleData refresh() method where an object can update its state.
                             * N.B. that the ManagementAgent on the broker appears not to set the timestamp properties
                             * in the response to this call, which means that they get set to current time in the
                             * QmfConsoleData, this is OK for _update_ts but not for _create_ts and _delete_ts
                             * users of this call should be aware of that in their own code.
                             */
                            path = path.substring(7);

                            // The ObjectId has been passed in the URI, create a real ObjectId
                            ObjectId oid = new ObjectId(path);

                            List<QmfConsoleData> objects = console.getObjects(oid);
                            if (objects.size() == 0)
                            {
                                tx.sendResponse(HTTP_NOT_FOUND, "text/plain", "404 Not Found.");
                            }
                            else
                            {
                                // Not that in a departure from the QMF2 API this returns the QmfConsoleData object
                                // rather than a list of size one. Perhaps the APIs should be completely consistent
                                // but this response seems more convenient.
                                tx.sendResponse(HTTP_OK, "application/json", JSON.fromObject(objects.get(0)));
                            }
                        }
                        else if (path.startsWith("console/packages") && path.length() == 16)
                        { // Get information about all the packages for all Agents
                            tx.sendResponse(HTTP_OK, "application/json", JSON.fromObject(console.getPackages()));
                        }
                        else
                        {
                            tx.sendResponse(HTTP_NOT_FOUND, "text/plain", "404 Not Found.");
                        }
View Full Code Here

                {
                    tx.sendResponse(HTTP_INTERNAL_ERROR, "text/plain", "500 Broker Disconnected.");
                }
                else
                { // If we get this far we should have found a Qpid Connection so retrieve the QMF2 Console Object.
                    Console console = connection.getConsole();

                    if (path.startsWith("object/"))
                    {
                        path = path.substring(7);

                        // The ObjectId has been passed in the URI create an ObjectId and retrieve the Agent Name.
                        ObjectId oid = new ObjectId(path);
                        String agentName = oid.getAgentName();

                        // The qpidd ManagementAgent doesn't populate AgentName, if it's empty assume it's the broker.
                        agentName = agentName.equals("") ? "broker" : agentName;

                        Agent agent = console.getAgent(agentName); // Find the Agent we got the QmfData from.
                        if (agent == null)
                        {
                            _log.info("QpidServer.doPost path: {} Agent: {} not found.", tx.getRequestURI(), agentName);
                            tx.sendResponse(HTTP_NOT_FOUND, "text/plain", "404 Not Found.");
                        }
View Full Code Here

     */
    public void onEvent(final WorkItem wi)
    {
        if (wi instanceof EventReceivedWorkItem)
        {
            EventReceivedWorkItem item = (EventReceivedWorkItem)wi;
            QmfEvent event = item.getEvent();
            String className = event.getSchemaClassId().getClassName();
            if (className.equals("subscribe"))
            {
                readWhitelist();
                String queueName = event.getStringValue("qName");
View Full Code Here

     */
    public void onEvent(final WorkItem wi)
    {
        if (wi instanceof EventReceivedWorkItem)
        {
            EventReceivedWorkItem item = (EventReceivedWorkItem)wi;
            Agent agent = item.getAgent();
            QmfEvent event = item.getEvent();

            String className = event.getSchemaClassId().getClassName();
            if (className.equals("clientConnect") ||
                className.equals("clientDisconnect"))
            {
                _stateChanged = true;
            }
        }
        else if (wi instanceof AgentRestartedWorkItem)
        {
            _stateChanged = true;
        }
        else if (wi instanceof AgentHeartbeatWorkItem)
        {
            AgentHeartbeatWorkItem item = (AgentHeartbeatWorkItem)wi;
            Agent agent = item.getAgent();

            if (_stateChanged && agent.getName().contains("qpidd"))
            {
                logConnectionInformation();
                _stateChanged = false;
View Full Code Here

TOP

Related Classes of org.apache.qpid.qmf2.console.Console

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.