Examples of QmfAgentData


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

    public void populateData() throws QmfException
    {
        System.out.println("*** BigPayloadAgentTest creating a control object ***");

        _control = new QmfAgentData(_controlSchema);
        _control.setValue("name", "controller");
        _agent.addObject(_control);
        System.out.println("BigPayloadAgentTest Schema control object added OK");
    }
View Full Code Here

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

            registerObjectClass(mammal);
            registerObjectClass(insect);
            registerObjectClass(reptile);
            registerObjectClass(bird);

            QmfAgentData cat = new QmfAgentData(mammal);
            cat.setValue("name", "cat");
            cat.setValue("legs", 4l);
            addObject(cat);

            QmfAgentData dog = new QmfAgentData(mammal);
            dog.setValue("name", "dog");
            dog.setValue("legs", 4l);
            addObject(dog);

            QmfAgentData rabbit = new QmfAgentData(mammal);
            rabbit.setValue("name", "rabbit");
            rabbit.setValue("legs", 4);
            addObject(rabbit);

            QmfAgentData horse = new QmfAgentData(mammal);
            horse.setValue("name", "horse");
            horse.setValue("legs", 4);
            addObject(horse);

            QmfAgentData human = new QmfAgentData(mammal);
            human.setValue("name", "human");
            human.setValue("legs", 2);
            addObject(human);


            QmfAgentData wasp = new QmfAgentData(insect);
            wasp.setValue("name", "wasp");
            wasp.setValue("legs", 6);
            addObject(wasp);

            QmfAgentData ant = new QmfAgentData(insect);
            ant.setValue("name", "ant");
            ant.setValue("legs", 6);
            addObject(ant);

            QmfAgentData crocodile = new QmfAgentData(reptile);
            crocodile.setValue("name", "crocodile");
            crocodile.setValue("legs", 4);
            addObject(crocodile);

            QmfAgentData gecko = new QmfAgentData(reptile);
            gecko.setValue("name", "gecko");
            gecko.setValue("legs", 4);
            addObject(gecko);

            QmfAgentData python = new QmfAgentData(reptile);
            python.setValue("name", "python");
            python.setValue("legs", 0);
            addObject(python);

            QmfAgentData hawk = new QmfAgentData(bird);
            hawk.setValue("name", "hawk");
            hawk.setValue("legs", 2);
            addObject(hawk);

            QmfAgentData ostrich = new QmfAgentData(bird);
            ostrich.setValue("name", "ostrich");
            ostrich.setValue("legs", 2);
            addObject(ostrich);


            System.out.println("total number of objects registered: " + _objectIndex.size());
View Full Code Here

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

        if (query.getObjectId() != null)
        {
            // Look up a QmfAgentData object by the ObjectId obtained from the query
            ObjectId objectId = query.getObjectId();
            QmfAgentData object = _objectIndex.get(objectId);
            if (object != null && !object.isDeleted())
            {
                results.add(new QmfConsoleData(object.mapEncode(), null));
            }
        }
        else
        {
            for (QmfAgentData object : _objectIndex.values())
            {
                if (!object.isDeleted() && query.evaluate(object))
                {
                    results.add(new QmfConsoleData(object.mapEncode(), null));
                }
            }
        }

        return results;
View Full Code Here

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

                    else if (methodName.equals("create_child"))
                    {
                        System.out.println("Invoked create_child method");
                        String childName = inArgs.getStringValue("name");
                        System.out.println("childName = " + childName);
                        QmfAgentData child = new QmfAgentData(_childSchema);
                        child.setValue("name", childName);
                        addObject(child);
                        QmfData outArgs = new QmfData();
                        outArgs.setRefValue("childAddr", child.getObjectId(), "reference"); // Set suptype just to test
                        _agent.methodResponse(methodName, item.getHandle(), outArgs, null);
                    }
                }
            }
            catch (QmfException qmfe)
            {
                System.err.println("QmfException " + qmfe.getMessage() + " caught: AgentExternalTest failed");
                QmfData error = new QmfData();
                error.setValue("error_text", qmfe.getMessage());
                _agent.methodResponse(methodName, item.getHandle(), null, error);
            }
        }

        if (wi.getType() == QUERY)
        {
            QueryWorkItem item = (QueryWorkItem)wi;
            QmfQuery query = item.getQmfQuery();

            System.out.println("Query User ID = " + item.getUserId());

            if (query.getObjectId() != null)
            {
                // Look up a QmfAgentData object by the ObjectId obtained from the query
                ObjectId objectId = query.getObjectId();
                QmfAgentData object = _objectIndex.get(objectId);
                if (object != null && !object.isDeleted())
                {
                    _agent.queryResponse(item.getHandle(), object);
                }
                _agent.queryComplete(item.getHandle(), 0);
            }
            else
            {
                // Look up QmfAgentData objects by the SchemaClassId obtained from the query
                // This is implemented by a linear search and allows searches with only the className specified.
                // Linear searches clearly don't scale brilliantly, but the number of QmfAgentData objects managed
                // by an Agent is generally fairly small, so it should be OK. Note that this is the same approach
                // taken by the C++ broker ManagementAgent, so if it's a problem here........
                for (QmfAgentData object : _objectIndex.values())
                {
                    if (!object.isDeleted() && query.evaluate(object))
                    {
                        _agent.queryResponse(item.getHandle(), object);
                    }
                }
                _agent.queryComplete(item.getHandle(), 0);
View Full Code Here

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

    public void populateData() throws QmfException
    {
        System.out.println("*** AgentExternalTest creating a control object ***");

        _control = new QmfAgentData(_controlSchema);
        _control.setValue("state", "OPERATIONAL");
        _control.setValue("methodCount", 0);

        addObject(_control);
        System.out.println("AgentExternalTest Schema control object added OK");
View Full Code Here

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

        {
            if (query.getObjectId() != null)
            {
                // Look up a QmfAgentData object by the ObjectId obtained from the query
                ObjectId objectId = query.getObjectId();
                QmfAgentData object = _objectIndex.get(objectId);
                if (object != null && !object.isDeleted())
                {
                    results.add(object);
                }
            }
            else
            {
                // Look up QmfAgentData objects evaluating the query
                for (QmfAgentData object : _objectIndex.values())
                {
                    if (!object.isDeleted() && query.evaluate(object))
                    {
                        results.add(object);
                    }
                }
            }
View Full Code Here

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

            // Reap any QmfAgentData Objects that have been marked as Deleted
            // Use the iterator approach rather than foreach as we may want to call iterator.remove() to zap an entry
            Iterator<QmfAgentData> i = _objectIndex.values().iterator();
            while (i.hasNext())
            {
                QmfAgentData object = i.next();
                if (object.isDeleted())
                {
System.out.println("****** Removing deleted Object *******");
                    i.remove();
                }
            }
View Full Code Here

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

                    else if (methodName.equals("create_child"))
                    {
                        System.out.println("Invoked create_child method");
                        String childName = inArgs.getStringValue("name");
                        System.out.println("childName = " + childName);
                        QmfAgentData child = new QmfAgentData(_childSchema);
                        child.setValue("name", childName);
                        _agent.addObject(child);
                        QmfData outArgs = new QmfData();
                        outArgs.setRefValue("childAddr", child.getObjectId(), "reference"); // Set subtype just to test
                        _agent.methodResponse(methodName, item.getHandle(), outArgs, null);
                    }
                }
            }
            catch (QmfException qmfe)
View Full Code Here

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

    public void populateData() throws QmfException
    {
        System.out.println("*** AgentTest creating a control object ***");

        _control = new QmfAgentData(_controlSchema);
        _control.setValue("state", "OPERATIONAL");
        _control.setValue("methodCount", 0);
        _agent.addObject(_control);
        System.out.println("AgentTest Schema control object added OK");
    }
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
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.