Package javax.management

Examples of javax.management.ObjectInstance


                    // mbean is not yet registered.Adding the destination to activemq broker.
                    ObjectName brokerObjectName = createBrokerObjectName(brokerInfo.getBrokerName());
                    Set set = server.queryMBeans(brokerObjectName, null);
                    Iterator it = set.iterator();
                    if (it.hasNext()) {
                        ObjectInstance instance = (ObjectInstance) it.next();
                        brokerObjectName = instance.getObjectName();
                    }
                    BrokerViewMBean brokerMBean = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, brokerObjectName, BrokerViewMBean.class, true);
                    brokerMBean.addQueue(destinationInfo.getPhysicalName());
                }
                proxy = (QueueViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, destinationObjectName, QueueViewMBean.class, true);
View Full Code Here


                    // mbean is not yet registered.Adding the destination to activemq broker.
                    ObjectName brokerObj = createBrokerObjectName(brokerInfo.getBrokerName());
                    Set set = server.queryMBeans(brokerObj, null);
                    Iterator it = set.iterator();
                    if (it.hasNext()) {
                        ObjectInstance instance = (ObjectInstance) it.next();
                        brokerObj = instance.getObjectName();
                    }
                    BrokerViewMBean brokerMBean = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, brokerObj, BrokerViewMBean.class, true);
                    brokerMBean.addQueue(destinationInfo.getPhysicalName());
                }
                proxy = (DestinationViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, objName, QueueViewMBean.class, true);
            } else {
                if (!server.isRegistered(objName)) {
                    // mbean is not yet registered.Adding the destination to activemq broker.
                    ObjectName brokerObj = createBrokerObjectName(brokerInfo.getBrokerName());
                    Set set = server.queryMBeans(brokerObj, null);
                    Iterator it = set.iterator();
                    if (it.hasNext()) {
                        ObjectInstance instance = (ObjectInstance) it.next();
                        brokerObj = instance.getObjectName();
                    }
                    BrokerViewMBean brokerMBean = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, brokerObj, BrokerViewMBean.class, true);
                    brokerMBean.addTopic(destinationInfo.getPhysicalName());
                }
                proxy = (DestinationViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, objName, TopicViewMBean.class, true);
View Full Code Here

            return new JMSMessageInfo[0];
        }
        try {
            ObjectName destinationObjectName = createDestinationObjectName(brokerInfo.getBrokerName(), destinationInfo.getType().name(), destinationInfo.getPhysicalName());
            MBeanServer mBeanServer = getMBeanServer();
            ObjectInstance objectInstance = mBeanServer.getObjectInstance(destinationObjectName);
            CompositeData[] compositeData = (CompositeData[]) mBeanServer.invoke(objectInstance.getObjectName(), "browse", new Object[] { selector }, new String[] { String.class.getName() });
            if (compositeData.length > 0) {
                JMSMessageInfo[] messageInfos = new JMSMessageInfo[compositeData.length];
                for (int i = 0; i < compositeData.length; i++) {
                    JMSMessageInfo jmsMessageInfo = new JMSMessageInfo();
                    CompositeData data = compositeData[i];
View Full Code Here

        try {
            // Query Thread Pools
            set = mBeanServer.queryMBeans(tpName, null);
            iterator = set.iterator();
            while (iterator.hasNext()) {
                ObjectInstance oi = (ObjectInstance) iterator.next();
                objectName = oi.getObjectName();
                if (objectName.getKeyProperty("name").indexOf(port) > -1) {
                    tpName = objectName;
                    break;
                }
            }
            // Query Global Request Processors
            set = mBeanServer.queryMBeans(grpName, null);
            iterator = set.iterator();
            while (iterator.hasNext()) {
                ObjectInstance oi = (ObjectInstance) iterator.next();
                objectName = oi.getObjectName();
                if (objectName.getKeyProperty("name").indexOf(port) > -1) {
                    grpName = objectName;
                    break;
                }
            }
View Full Code Here

        // Query Session Managers
        Set set = mBeanServer.queryMBeans(mgrName, null);
        Iterator iterator = set.iterator();
        ObjectName objectName;
        while (iterator.hasNext()) {
            ObjectInstance oi = (ObjectInstance) iterator.next();
            objectName = oi.getObjectName();
            if (objectName.getKeyProperty("path").indexOf(context.getPath()) > -1) {
                mgrName = objectName;
                break;
               
            }
View Full Code Here

            ObjectName servletObjectName = new ObjectName(onStr);
            Set<ObjectInstance> set =
                mBeanServer.queryMBeans(servletObjectName, null);
            Iterator<ObjectInstance> iterator = set.iterator();
            while (iterator.hasNext()) {
                ObjectInstance oi = iterator.next();
                writeWrapper(writer, oi.getObjectName(), mBeanServer, mode);
            }

        } else if (mode == 1){
            // for now we don't write out the context in XML
        }
View Full Code Here

                LOG.debug("MBean already registered with ObjectName: {}", name);
            }
        }

        // register bean if by force or not exists
        ObjectInstance instance = null;
        if (forceRegistration || !exists) {
            LOG.trace("Registering MBean with ObjectName: {}", name);
            instance = server.registerMBean(obj, name);
        }

        // need to use the name returned from the server as some JEE servers may modify the name
        if (instance != null) {
            ObjectName registeredName = instance.getObjectName();
            LOG.debug("Registered MBean with ObjectName: {}", registeredName);
            mbeansRegistered.put(name, registeredName);
        }
    }
View Full Code Here

    public static ObjectInstance getMBeanFactory()
    throws JMException, ServletException {
       
        Iterator factoryItr =
        mBServer.queryMBeans(new ObjectName(FACTORY_TYPE + WILDCARD), null).iterator();
        ObjectInstance mBeanFactory = (ObjectInstance)factoryItr.next();
       
        return mBeanFactory;
    }
View Full Code Here

                    domain = obj.getClass().getPackage().getName();

                oname = ObjectName.getInstance(domain+":"+basis+",id="+count);
            }
           
            ObjectInstance oinstance = _server.registerMBean(mbean, oname);
            Log.debug("Registered {}" , oinstance.getObjectName());
            _beans.put(obj, oinstance.getObjectName());

        }
        catch (Exception e)
        {
            Log.warn("bean: "+obj,e);
View Full Code Here

    public ObjectInstance getObjectInstance(ObjectName objectName) throws InstanceNotFoundException {
        AbstractName abstractName = toAbstractName(objectName);
        try {
            GBeanInfo gbeanInfo = kernel.getGBeanInfo(abstractName);
            return new ObjectInstance(objectName, gbeanInfo.getClassName());
        } catch (GBeanNotFoundException e) {
            throw (InstanceNotFoundException)new InstanceNotFoundException(objectName.getCanonicalName()).initCause(e);
        }
    }
View Full Code Here

TOP

Related Classes of javax.management.ObjectInstance

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.