Examples of EmsConnection


Examples of org.mc4j.ems.connection.EmsConnection

        if (isTreeCache)
            query += "tree";
        query += "cache-interceptor=%name%";
        ObjectNameQueryUtility util = new ObjectNameQueryUtility(query);
        query = util.getTranslatedQuery();
        EmsConnection connection = parentServer.getEmsConnection();
        if (connection != null)
            interceptors = connection.queryBeans(query);

    }
View Full Code Here

Examples of org.mc4j.ems.connection.EmsConnection

                    bean += "cache-interceptor=";
                    bean += name.substring(0, pos);
                }
                String attr = name.substring(pos + 1);

                EmsConnection conn = parentServer.getEmsConnection();
                EmsBean eBean = conn.getBean(bean);
                if (eBean != null) {
                    List<String> attrs = new ArrayList<String>();
                    eBean.refreshAttributes(attrs); // only refresh selecte attrs, as there might be non-serializable ones
                    EmsAttribute eAttr = eBean.getAttribute(attr);
                    if (metric.getDataType() == DataType.MEASUREMENT) {
View Full Code Here

Examples of org.mc4j.ems.connection.EmsConnection

    }

    public AvailabilityType getAvailability() {

        try {
            EmsConnection connection = parentServer.getEmsConnection();
            if (connection == null)
                return AvailabilityType.DOWN;

            boolean up = connection.getBean(baseObjectName).isRegistered();
            return up ? AvailabilityType.UP : AvailabilityType.DOWN;
        } catch (Exception e) {
            if (log.isDebugEnabled())
                log.debug("Can not determine availability for " + baseObjectName + ": " + e.getMessage());
            return AvailabilityType.DOWN;
View Full Code Here

Examples of org.mc4j.ems.connection.EmsConnection

     *
     * @param objectName the name of the bean to load
     * @return the bean that is loaded
     */
    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
                // bean before giving up.
                emsConnection.queryBeans(objectName);
                bean = emsConnection.getBean(objectName);
            }

            return bean;
        }

View Full Code Here

Examples of org.mc4j.ems.connection.EmsConnection

     */
    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context)
        throws InvalidPluginConfigurationException, Exception {

        JBossCacheComponent parent = (JBossCacheComponent) context.getParentResourceComponent();
        EmsConnection emsConnection = parent.getEmsConnection();
        String resKey = context.getParentResourceContext().getResourceKey();
        File file = DeploymentUtility.getDescriptorFile(emsConnection, resKey);
        if (file == null) {
            log.warn("File is null for " + resKey);
            return null;
View Full Code Here

Examples of org.mc4j.ems.connection.EmsConnection

        return ret;
    }

    @Override
    public EmsConnection getEmsConnection() {
        EmsConnection conn = super.getEmsConnection();
        if (LOG.isTraceEnabled()) {
            LOG.trace("EmsConnection is " + conn.toString());
        }
        return conn;

    }
View Full Code Here

Examples of org.mc4j.ems.connection.EmsConnection

        String name = request.getName();
        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();
View Full Code Here

Examples of org.mc4j.ems.connection.EmsConnection

        Set<DiscoveredResourceDetails> result = new HashSet<DiscoveredResourceDetails>();

        ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(objectName);
        JMXComponent parentResourceComponent = context.getParentResourceComponent();
        EmsConnection connection = parentResourceComponent.getEmsConnection();

        Configuration pluginConfig = context.getDefaultPluginConfiguration();

        List<EmsBean> beans = connection.queryBeans(queryUtility.getTranslatedQuery());
        if (beans.size() == 1) {
            String version = getVersionFromSource(connection, versionSource);
            DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), objectName, resourceName, version, resourceDescription, pluginConfig, null);
            result.add(detail);
        }
View Full Code Here

Examples of org.mc4j.ems.connection.EmsConnection

        String name = config.getSimple("MBeanName").getStringValue();
        PropertySimple nameTemplateProp = report.getPluginConfiguration().getSimple("nameTemplate");
        String rName = nameTemplateProp.getStringValue();
        rName = rName.replace("{name}", name);

        EmsConnection connection = parentResourceComponent.getEmsConnection();

        if (DeploymentUtility.isDuplicateJndiName(connection, objectNamePreString, name)) {
            report.setStatus(CreateResourceStatus.FAILURE);
            report.setErrorMessage("Duplicate JNDI Name, a resource with that name already exists");
            return report;
View Full Code Here

Examples of org.mc4j.ems.connection.EmsConnection

    }

    private Double getSessionMetric(String metricName) {
        boolean isClustered = false;

        EmsConnection jmxConnection = getEmsConnection();
        String servletMBeanNames = SESSION_NAME_BASE_TEMPLATE.replace("%PATH%",
            WarDiscoveryHelper.getContextPath(this.contextRoot));
        servletMBeanNames = servletMBeanNames.replace("%HOST%", vhost);
        ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(servletMBeanNames);
        List<EmsBean> mBeans = jmxConnection.queryBeans(queryUtility.getTranslatedQuery());

        if (mBeans.size() == 0) {
            // retry with the cluster manager TODO select the local vs cluster mode on discovery
            servletMBeanNames = CLUSTER_SESSION_NAME_BASE_TEMPLATE.replace("%PATH%",
                WarDiscoveryHelper.getContextPath(this.contextRoot));
            servletMBeanNames = servletMBeanNames.replace("%HOST%", vhost);
            queryUtility = new ObjectNameQueryUtility(servletMBeanNames);
            mBeans = jmxConnection.queryBeans(queryUtility.getTranslatedQuery());
            if (mBeans.size() > 0)
                isClustered = true;
        }

        String property = metricName.substring(SESSION_PREFIX.length());
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.