Package org.apache.qpid.qmf2.common

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


        _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


        }
        else if (target == QmfQueryTarget.SCHEMA)
        {
            List<Map> results = new ArrayList<Map>(1);
            // Look up a SchemaClass object by the SchemaClassId obtained from the query
            SchemaClassId classId = query.getSchemaClassId();
            SchemaClass schema = _schemaCache.get(classId);
            if (schema != null)
            {
                results.add(schema.mapEncode());
            }
View Full Code Here

     *
     * @param schema the SchemaObjectClass to be registered
     */
    public final void registerObjectClass(final SchemaObjectClass schema)
    {
        SchemaClassId classId = schema.getClassId();
        _schemaCache.put(classId, schema);
    }
View Full Code Here

     *
     * @param schema the SchemaEventClass to be registered
     */
    public final void registerEventClass(final SchemaEventClass schema)
    {
        SchemaClassId classId = schema.getClassId();
        _schemaCache.put(classId, schema);
    }
View Full Code Here

        // it may need to have a "well known" ObjectId. This is the case with the Java Broker Management Agent
        // where tools such as qpid-config might have made assumptions about its ObjectId rather than doing "discovery".
        ObjectId addr = object.getObjectId();
        if (addr == null)
        {
            SchemaClassId classId = object.getSchemaClassId();
            SchemaClass schema = _schemaCache.get(classId);

            // Try to create an objectName using the property names that have been specified as idNames in the schema
            StringBuilder buf = new StringBuilder();
            // Initialise idNames as an empty array as we want to check if a key has been used to construct the name.
            String[] idNames = {};
            if (schema != null && schema instanceof SchemaObjectClass)
            {
                idNames = ((SchemaObjectClass)schema).getIdNames();
                for (String property : idNames)
                {
                    buf.append(object.getStringValue(property));
                }
            }
            String objectName = buf.toString();

            // If the schema hasn't given any help we use a UUID. Note that we check the length of idNames too
            // as a given named key property might legitimately be an empty string (e.g. the default direct
            // exchange has name == "")
            if (objectName.length() == 0 && idNames.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 its ObjectId and add that to the object
            addr = new ObjectId(_name, objectName, _epoch);

            object.setObjectId(addr);
View Full Code Here

     */
    private void createQueueSubscription()
    {
        try
        {   // This QmfQuery simply does an ID query for objects with the className "queue"
            QmfQuery query = new QmfQuery(QmfQueryTarget.OBJECT, new SchemaClassId("queue"));
            SubscribeParams params = _console.createSubscription(_broker, query, "queueStatsHandle");
            _subscriptionId = params.getSubscriptionId();
            _subscriptionDuration = params.getLifetime() - 10; // Subtract 10 as we want to refresh before it times out
            _startTime = System.currentTimeMillis();
        }
View Full Code Here

                {
                    List<Map> mapResults = AMQPMessage.getList(response);
                    for (Map content : mapResults)
                    {
//new SchemaClassId(content).listValues();
                        results.add(new SchemaClassId(content));
                    }
                }
                else if (AMQPMessage.isAMQPMap(response))
                {
                    // Error responses are returned as MapMessages, though they are being ignored here.
View Full Code Here

     * @param className the schema class name we're looking up objects for.
     * @return a List of QMF Objects describing that class.
     */
    public List<QmfConsoleData> getObjects(final String className)
    {
        return getObjects(new SchemaClassId(className));
    }
View Full Code Here

     * @param timeout overrides the default replyTimeout.
     * @return a List of QMF Objects describing that class.
     */
    public List<QmfConsoleData> getObjects(final String className, final int timeout)
    {
        return getObjects(new SchemaClassId(className), timeout);
    }
View Full Code Here

     * @param agentList if this parameter is supplied then the query is sent to only those Agents.
     * @return a List of QMF Objects describing that class.
     */
    public List<QmfConsoleData> getObjects(final String className, final List<Agent> agentList)
    {
        return getObjects(new SchemaClassId(className), agentList);
    }
View Full Code Here

TOP

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

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.