Examples of EmsBean


Examples of org.mc4j.ems.connection.bean.EmsBean

     */
    protected EmsBean loadBean(MBeanResourceComponent<?> context, String objectName) {
        EmsConnection emsConnection = context.getEmsConnection();

        if (emsConnection != null) {
            EmsBean bean = emsConnection.getBean(objectName);
            if (bean == null) {
                // In some cases, this resource component may have been discovered by some means other than querying its
                // parent's EMSConnection (e.g. ApplicationDiscoveryComponent uses a filesystem to discover EARs and
                // WARs that are not yet deployed). In such cases, getBean() will return null, since EMS won't have the
                // bean in its cache. To cover such cases, make an attempt to query the underlying MBeanServer for the
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

        Configuration pluginConfig = context.getParentResourceComponent().getResourceContext().getPluginConfiguration();

        String[] engineObjectNames = pluginConfig.getSimple(ENGINE_OBJECT_NAME).getStringValue().split("\\|");

        for (String engineObjectName : engineObjectNames) {
            EmsBean engineBean = this.loadBean(context.getParentResourceComponent(), engineObjectName);
            if (engineBean != null) {
                return engineBean.getAttribute(JVM_ROUTE_PROPERTY).refresh().toString();
            }
        }

        return null;
    }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

     * @param context
     * @param objectName
     * @return
     */
    public boolean isBeanConfiguredClassName(ResourceDiscoveryContext<JMXComponent<?>> context, String objectName) {
        EmsBean emsBean = loadBean(context.getParentResourceComponent(), objectName);
        if (emsBean == null) {
            return false;
        }

        ClassLoader cl = Thread.currentThread().getContextClassLoader();

        try {
            Thread.currentThread().setContextClassLoader(emsBean.getClass().getClassLoader());

            String className = context.getDefaultPluginConfiguration().getSimple(CLASS_NAME).getStringValue();

            return className.equals(emsBean.getClassTypeName());
        } catch (Exception e) {
            log.info(e);
            return false;
        } finally {
            Thread.currentThread().setContextClassLoader(cl);
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

            // Handle stuff for the generic Messaging MBeans ourselves. Pass the remainder
            // to our parent later.
            if (request.getName().startsWith(pattern)) {
                Matcher m = PROPERTY_PATTERN.matcher(request.getName());
                if (m.matches() && (m.group(1) != null)) {
                    EmsBean eBean = getEmsConnection().getBean(m.group(1));

                    List<String> attributes = new ArrayList<String>(1);
                    attributes.add(m.group(2));
                    eBean.refreshAttributes(attributes);
                    EmsAttribute emsAtt = eBean.getAttribute(m.group(2));
                    Object value = emsAtt.getValue();
                    if ((request.getDataType() == DataType.MEASUREMENT) && (value instanceof Number)) {
                        report.addData(new MeasurementDataNumeric(request, ((Number) value).doubleValue()));
                    } else if (request.getDataType() == DataType.TRAIT) {
                        String displayValue = null;
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

        int delimIndex = name.lastIndexOf(':');
        String beanName = name.substring(0, delimIndex);
        String attributeName = name.substring(delimIndex + 1);
        try {
            EmsConnection emsConnection = getEmsConnection();
            EmsBean bean = emsConnection.getBean(beanName);
            if (bean != null) {
                bean.refreshAttributes();
                EmsAttribute attribute = bean.getAttribute(attributeName);
                if (attribute != null) {
                    Object valueObject = attribute.refresh();
                    if (valueObject instanceof Number) {
                        Number value = (Number) valueObject;
                        if (percentageMeasurements.get(name)) {
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

    private Object getStatelessSessionBeanStats() throws Exception {
        // will actually be a type of: javax.management.j2ee.statistics.StatelessSessionBeanStats
        Object statelessSessionBeanStats = null;

        // accesses the remote MBean to get information on the EJB
        EmsBean emsBean = getEmsBean();

        // use the connection's classloader so we use the appropriate class definitions
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(emsBean.getClass().getClassLoader());

        try {
            EmsAttribute attribute = emsBean.getAttribute("stats");
            statelessSessionBeanStats = attribute.refresh();
        } catch (RuntimeException e) {
            String msg = "Failed to retrieve EJB2 invocation stats.";
            if (log.isDebugEnabled()) {
                log.debug(msg, e);
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

        try {
            ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(beanName);
            List<EmsBean> beans = connection.queryBeans(queryUtility.getTranslatedQuery());
            if (beans.size() == 1) {
                EmsBean bean = beans.get(0);
                bean.refreshAttributes(Arrays.asList(attrs));
                StringBuilder ret = new StringBuilder();
                Iterator<String> iter = Arrays.asList(attrs).iterator();
                while (iter.hasNext()) {
                    String att = iter.next();
                    EmsAttribute eatt = bean.getAttribute(att);
                    ret.append((String) eatt.getValue());
                    if (iter.hasNext())
                        ret.append(" ");
                }
                return ret.toString();
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

*/
public class EntityDiscoveryComponent implements ResourceDiscoveryComponent<MBeanResourceComponent<?>> {
    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<MBeanResourceComponent<?>> context) {
        Set<DiscoveredResourceDetails> entities = new HashSet<DiscoveredResourceDetails>();

        EmsBean statsBean = context.getParentResourceComponent().getEmsBean();

        String[] entityNames = (String[]) statsBean.getAttribute("EntityNames").refresh();

        for (String entityName : entityNames) {
            DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), entityName,
                entityName, null, "Hibernate Entity", null, null);
            entities.add(detail);
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

                if (metricName.equals("Vhost.name")) {
                    List<EmsBean> beans = getVHosts(contextRoot);
                    String value = "";
                    Iterator<EmsBean> iter = beans.iterator();
                    while (iter.hasNext()) {
                        EmsBean eBean = iter.next();
                        value += eBean.getBeanName().getKeyProperty("host");
                        if (iter.hasNext())
                            value += ",";
                    }
                    MeasurementDataTrait trait = new MeasurementDataTrait(schedule, value);
                    report.addData(trait);
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

        String property = metricName.substring(SESSION_PREFIX.length());

        Double ret = Double.NaN;

        if (mBeans.size() > 0) { // TODO flag error if != 1 ?
            EmsBean eBean = mBeans.get(0);
            eBean.refreshAttributes();

            if (isClustered) {
                property = lookupClusteredAttributeName(property);
            }

            EmsAttribute att = eBean.getAttribute(property);
            if (att != null) {
                Object o = att.getValue();
                if (o instanceof Long) {
                    Long l = (Long) o;
                    ret = Double.valueOf(l);
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.