Package org.apache.qpid.qmf2.common

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


            query = new QmfQuery(QmfQueryTarget.OBJECT, wasp.getObjectId());
            results = evaluateDataQuery(query);
            displayResults(results);

            System.out.println("\nlooking up mammal objects");
            query = new QmfQuery(QmfQueryTarget.OBJECT, new SchemaClassId("mammal"));
            results = evaluateDataQuery(query);
            displayResults(results);

            System.out.println("\nlooking up everything in package com.fadams.qmf2");
            query = new QmfQuery(QmfQueryTarget.OBJECT, new SchemaClassId("com.fadams.qmf2", null));
            results = evaluateDataQuery(query);
            displayResults(results);


            System.out.println("\nQuery for all mammals with more than two legs");
View Full Code Here


        }
    }

    public void registerObjectClass(SchemaObjectClass schema)
    {
        SchemaClassId classId = schema.getClassId();
        _schemaCache.put(classId, schema);
    }
View Full Code Here

        _schemaCache.put(classId, schema);
    }

    public void addObject(QmfAgentData object) throws QmfException
    {
        SchemaClassId classId = object.getSchemaClassId();
        SchemaClass schema = _schemaCache.get(classId);

        // Try to create an objectName using the set of property names that have been specified as idNames in the schema
        StringBuilder buf = new StringBuilder();
        if (schema != null && schema instanceof SchemaObjectClass)
        {
            String[] idNames = ((SchemaObjectClass)schema).getIdNames();
            for (String name : idNames)
            {
                buf.append(object.getStringValue(name));
            }
        }
        String objectName = buf.toString();

        // If the schema hasn't given any help we use a UUID
        if (objectName.length() == 0) objectName = UUID.randomUUID().toString();

        // Finish up the name by incorporating package and class names
        objectName = classId.getPackageName() + ":" + classId.getClassName() + ":" + objectName;

        // Now we've got a good name for the object we create it's ObjectId and add that to the object
        ObjectId addr = new ObjectId("test"/*name*/, objectName, 0/*epoch*/);
        object.setObjectId(addr);

View Full Code Here

        _childSchema = new SchemaObjectClass(packageName, "child");
        _childSchema.addProperty(new SchemaProperty("name", QmfType.TYPE_STRING));
        _childSchema.setIdNames("name");
   
        // Declare the event class
        _eventSchema = new SchemaEventClass(packageName, "event");
        _eventSchema.addProperty(new SchemaProperty("text", QmfType.TYPE_STRING));

        System.out.println("AgentTest Schema classes initialised OK");

        _agent.registerObjectClass(_exceptionSchema);
View Full Code Here

                    for (Map content : mapResults)
                    {
                        SchemaClass schema = new SchemaObjectClass(content);
                        if (schema.getClassId().getType().equals("_event"))
                        {
                            schema = new SchemaEventClass(content);
                        }
//schema.listValues();
                        results.add(schema);
                    }
                }
View Full Code Here

            // Declare the child class
            SchemaObjectClass child = new SchemaObjectClass(packageName, "child");
            child.addProperty(new SchemaProperty("name", QmfType.TYPE_STRING));
   
            // Declare the event class
            SchemaEventClass event = new SchemaEventClass(packageName, "event");
            event.addProperty(new SchemaProperty("text", QmfType.TYPE_STRING));

            System.out.println("Test3 Schema classes initialised OK");

            // Now we create new instance of each class from the map encodings and list the values
            // to check everything looks OK.

            System.out.println("Test3 testing serialisation of exception schema");
            SchemaObjectClass exceptionFromMap = new SchemaObjectClass(exception.mapEncode());
            exceptionFromMap.listValues();
            System.out.println();

            System.out.println("Test3 testing serialisation of control schema");
            SchemaObjectClass controlFromMap = new SchemaObjectClass(control.mapEncode());
            controlFromMap.listValues();
            System.out.println();

            System.out.println("Test3 testing serialisation of child schema");
            SchemaObjectClass childFromMap = new SchemaObjectClass(child.mapEncode());
            childFromMap.listValues();
            System.out.println();

            System.out.println("Test3 testing serialisation of event schema");
            SchemaEventClass eventFromMap = new SchemaEventClass(event.mapEncode());
            eventFromMap.listValues();
            System.out.println();

        }
        catch (QmfException qmfe)
        {
View Full Code Here

        _controlSchema.addProperty(new SchemaProperty("state", QmfType.TYPE_STRING));
        _controlSchema.addProperty(new SchemaProperty("methodCount", QmfType.TYPE_INT));
        _controlSchema.addProperty(new SchemaProperty("offset", QmfType.TYPE_INT));
        _controlSchema.setIdNames("state");

        SchemaMethod stopMethod = new SchemaMethod("stop", "Stop Agent");
        stopMethod.addArgument(new SchemaProperty("message", QmfType.TYPE_STRING, "{dir:IN}"));
        _controlSchema.addMethod(stopMethod);

        SchemaMethod echoMethod = new SchemaMethod("echo", "Echo Arguments");
        echoMethod.addArgument(new SchemaProperty("message", QmfType.TYPE_STRING, "{dir:INOUT}"));
        _controlSchema.addMethod(echoMethod);

        SchemaMethod eventMethod = new SchemaMethod("event", "Raise an Event");
        eventMethod.addArgument(new SchemaProperty("text", QmfType.TYPE_STRING, "{dir:IN}"));
        eventMethod.addArgument(new SchemaProperty("severity", QmfType.TYPE_INT, "{dir:IN}"));
        _controlSchema.addMethod(eventMethod);

        SchemaMethod failMethod = new SchemaMethod("fail", "Expected to Fail");
        failMethod.addArgument(new SchemaProperty("useString", QmfType.TYPE_BOOL, "{dir:IN}"));
        failMethod.addArgument(new SchemaProperty("stringVal", QmfType.TYPE_STRING, "{dir:IN}"));
        failMethod.addArgument(new SchemaProperty("details", QmfType.TYPE_MAP, "{dir:IN}"));
        _controlSchema.addMethod(failMethod);

        SchemaMethod createMethod = new SchemaMethod("create_child", "Create Child Object");
        createMethod.addArgument(new SchemaProperty("name", QmfType.TYPE_STRING, "{dir:IN}"));
        createMethod.addArgument(new SchemaProperty("childAddr", QmfType.TYPE_MAP, "{dir:OUT}"));
        _controlSchema.addMethod(createMethod);

        // Declare the child class
        _childSchema = new SchemaObjectClass(packageName, "child");
        _childSchema.addProperty(new SchemaProperty("name", QmfType.TYPE_STRING));
View Full Code Here

            // Declare a control object to test methods against.
            SchemaObjectClass control = new SchemaObjectClass(packageName, "control");
            control.addProperty(new SchemaProperty("state", QmfType.TYPE_STRING));
            control.addProperty(new SchemaProperty("methodCount", QmfType.TYPE_INT));

            SchemaMethod stopMethod = new SchemaMethod("stop", "Stop Agent");
            stopMethod.addArgument(new SchemaProperty("message", QmfType.TYPE_STRING));
            control.addMethod(stopMethod);

            SchemaMethod echoMethod = new SchemaMethod("echo", "Echo Arguments");
            echoMethod.addArgument(new SchemaProperty("sequence", QmfType.TYPE_INT, "{dir:INOUT}"));
            echoMethod.addArgument(new SchemaProperty("map", QmfType.TYPE_MAP, "{dir:INOUT}"));
            control.addMethod(echoMethod);

            SchemaMethod eventMethod = new SchemaMethod("event", "Raise an Event");
            eventMethod.addArgument(new SchemaProperty("text", QmfType.TYPE_STRING, "{dir:IN}"));
            eventMethod.addArgument(new SchemaProperty("severity", QmfType.TYPE_INT, "{dir:IN}"));
            control.addMethod(eventMethod);

            SchemaMethod failMethod = new SchemaMethod("fail", "Expected to Fail");
            failMethod.addArgument(new SchemaProperty("useString", QmfType.TYPE_BOOL, "{dir:IN}"));
            failMethod.addArgument(new SchemaProperty("stringVal", QmfType.TYPE_STRING, "{dir:IN}"));
            failMethod.addArgument(new SchemaProperty("details", QmfType.TYPE_MAP, "{dir:IN}"));
            control.addMethod(failMethod);

            SchemaMethod createMethod = new SchemaMethod("create_child", "Create Child Object");
            createMethod.addArgument(new SchemaProperty("name", QmfType.TYPE_STRING, "{dir:IN}"));
            createMethod.addArgument(new SchemaProperty("childAddr", QmfType.TYPE_MAP, "{dir:OUT}"));
            control.addMethod(createMethod);

            // Declare the child class
            SchemaObjectClass child = new SchemaObjectClass(packageName, "child");
            child.addProperty(new SchemaProperty("name", QmfType.TYPE_STRING));
View Full Code Here

        // Declare a control object to test methods against.
        _controlSchema = new SchemaObjectClass(packageName, "control");
        _controlSchema.addProperty(new SchemaProperty("name", QmfType.TYPE_STRING));
        _controlSchema.setIdNames("name");

        SchemaMethod createMethod = new SchemaMethod("processPayload", "Process a large payload");
        createMethod.addArgument(new SchemaProperty("parameter", QmfType.TYPE_STRING, "{dir:IN}"));
        createMethod.addArgument(new SchemaProperty("return", QmfType.TYPE_STRING, "{dir:OUT}"));
        _controlSchema.addMethod(createMethod);
        System.out.println("BigPayloadAgentTest Schema classes initialised OK");

        _agent.registerObjectClass(_controlSchema);
View Full Code Here

                if (AMQPMessage.isAMQPList(response))
                {
                    List<Map> mapResults = AMQPMessage.getList(response);
                    for (Map content : mapResults)
                    {
                        SchemaClass schema = new SchemaObjectClass(content);
                        if (schema.getClassId().getType().equals("_event"))
                        {
                            schema = new SchemaEventClass(content);
                        }
//schema.listValues();
                        results.add(schema);
View Full Code Here

TOP

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

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.