Examples of ObjectId


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

                System.out.println(p + ": " + connection.getStringValue(p));
            }

            System.out.println("createTimestamp: " + new Date(connection.getCreateTime()/1000000l));

            ObjectId connectionId = connection.getObjectId();
            for (QmfConsoleData session : sessions)
            { // Iterate through all session objects
                ObjectId connectionRef = session.getRefValue("connectionRef");
                if (connectionRef.equals(connectionId))
                { // But only select sessions that are associated with the connection under consideration.
                    System.out.printf("Session '%s'\n", session.getStringValue("name"));
                    int subscriptionCount = 0;
                    ObjectId sessionId = session.getObjectId();
                    for (QmfConsoleData subscription : subscriptions)
                    { // Iterate through all subscription objects
                        ObjectId sessionRef = subscription.getRefValue("sessionRef");
                        if (sessionRef.equals(sessionId))
                        { // But only select subscriptions that are associated with the session under consideration.
                            subscriptionCount++;
                            ObjectId queueRef = subscription.getRefValue("queueRef");
                            if (_logQueues)
                            {
                                logQueueInformation(queueRef);
                            }
                        }
View Full Code Here

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

        // 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);

        if (_objectIndex.get(addr) != null)
        {
            throw new QmfException("Duplicate QmfAgentData Address");
View Full Code Here

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

        List<QmfConsoleData> results = new ArrayList<QmfConsoleData>();

        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));
            }
View Full Code Here

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

                //qmfContentType = "_data";
                if (query.getObjectId() != null)
                {
                    List<Map> results = new ArrayList<Map>(1);
                    // 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.mapEncode());
                    }
View Full Code Here

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

        { // Note that we don't include objects marked as deleted in the results here, because if an object gets
          // destroyed we asynchronously publish its new state to subscribers, see QmfAgentData.destroy() method.
            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);
                }
View Full Code Here

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

    public void addObject(final QmfAgentData object) throws QmfException
    {
        // There are some cases where a QmfAgentData Object might have already set its ObjectId, for example where
        // 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);
        }

        QmfAgentData foundObject = _objectIndex.get(addr);
View Full Code Here

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

     * @param objectName the name of the QmfAgentData being managed.
     * @return a new ObjectId based on the objectName passed as a parameter.
     */
    public ObjectId allocObjectId(final String objectName)
    {
        return new ObjectId(getName(), objectName, getEpoch());
    }
View Full Code Here

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

            _control.incValue("methodCount", 1);

            MethodCallWorkItem item = (MethodCallWorkItem)wi;
            MethodCallParams methodCallParams = item.getMethodCallParams();
            String methodName = methodCallParams.getName();
            ObjectId objectId = methodCallParams.getObjectId();
            String userId = methodCallParams.getUserId();
            QmfData inArgs = methodCallParams.getArgs();
            ObjectId controlAddress = _control.getObjectId();

            System.out.println("Method Call User ID = " + userId);

            try
            {
                if (objectId == null)
                {
                    // Method invoked directly on Agent
                    if (methodName.equals("toString"))
                    {
                        QmfData outArgs = new QmfData();
                        outArgs.setValue("string", _agent.toString());
                        _agent.methodResponse(methodName, item.getHandle(), outArgs, null);
                    }
                }
                else if (objectId.equals(controlAddress))
                {
                    if (methodName.equals("stop"))
                    {
                        System.out.println("Invoked stop method");
                        String message = inArgs.getStringValue("message");
                        System.out.println("Stopping: message = " + message);
                        _agent.methodResponse(methodName, item.getHandle(), null, null);
                        _agent.destroy();
                        System.exit(1);
                    }
                    else if (methodName.equals("echo"))
                    {
                        System.out.println("Invoked echo method");
                        _agent.methodResponse(methodName, item.getHandle(), inArgs, null);
                    }
                    else if (methodName.equals("event"))
                    {
                        System.out.println("Invoked event method");
                        QmfEvent event = new QmfEvent(_eventSchema);
                        event.setSeverity((int)inArgs.getLongValue("severity"));
                        event.setValue("text", inArgs.getStringValue("text"));
                        _agent.raiseEvent(event);
                        _agent.methodResponse(methodName, item.getHandle(), null, null);
                    }
                    else if (methodName.equals("fail"))
                    {
                        System.out.println("Invoked fail method");
                        QmfData error = new QmfData();
                        if (inArgs.getBooleanValue("useString"))
                        {
                            error.setValue("error_text", inArgs.getStringValue("stringVal"));
                        }
                        else
                        {
                            error.setValue("whatHappened", "It Failed");
                            error.setValue("howBad", 75);
                            error.setValue("details", inArgs.getValue("details"));
                        }
                        _agent.methodResponse(methodName, item.getHandle(), null, error);
                    }
                    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);
                }
View Full Code Here

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

        System.out.println("AgentExternalTest Schema control object added OK");
    }

    public void addObject(QmfAgentData object) throws QmfException
    {
        ObjectId addr = _agent.allocObjectId(UUID.randomUUID().toString());
        object.setObjectId(addr);
        _objectIndex.put(addr, object);

        // Does the new object match any Subscriptions? If so add a reference to the matching Subscription and publish.
        for (Subscription subscription : _subscriptions.values())
View Full Code Here

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

        if (query.getTarget() == QmfQueryTarget.OBJECT)
        {
            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);
                }
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.