Examples of EmsBean


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

        return DeploymentUtility.getVHostsFromLocalManager(contextRoot, getEmsConnection());
    }

    private WarDeploymentInformation getDeploymentInformation() {
        WarDeploymentInformation deploymentInformation = null;
        EmsBean mBean = this.getEmsBean();
        if (mBean != null && mBean.getBeanName() != null) {
            String beanName = this.getEmsBean().getBeanName().getCanonicalName();
            List<String> beanNameList = new ArrayList<String>();
            beanNameList.add(beanName);
            //            deploymentInformation = DeploymentUtility.getWarDeploymentInformation(getEmsConnection(), beanNameList)
            //                .get(beanName); TODO fix this
View Full Code Here

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

            String beanName = req.substring(0, req.lastIndexOf(':'));
            String attributeName = req.substring(req.lastIndexOf(':') + 1);

            try {
                // Bean is cached by EMS, so no problem with getting the bean from the connection on each call
                EmsBean eBean = loadBean(beanName);
                if (eBean == null) {
                    log.warn("Bean " + beanName + " not found, skipping ...");
                    continue;
                }

                EmsAttribute attribute = eBean.getAttribute(attributeName);

                Object valueObject = attribute.refresh();
                Number value = (Number) valueObject;

                report.addData(new MeasurementDataNumeric(request, value.doubleValue()));
View Full Code Here

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

        if (getResourceContext().getParentResourceComponent().getResourceContext().getVersion().startsWith("5")) {
            report.getConfiguration().remove(CONFIG_V5_KEEP_ALIVE_TIMEOUT);
        }
       
        EmsBean bean = super.getEmsBean();
        for (String key : report.getConfiguration().getSimpleProperties().keySet()) {
          EmsAttribute attribute = bean.getAttribute(key);
          if (attribute == null) {
            log.debug("Removing " + key + " does correspond to an attribut");
            report.getConfiguration().remove(key);
            continue; // skip unsupported attributes
          }
View Full Code Here

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

                    if (metricName.equals(TRAIT_VHOST_NAMES)) {
                        List<EmsBean> beans = getVHosts();
                        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

        List<EmsBean> mBeans = jmxConnection.queryBeans(queryUtility.getTranslatedQuery());
        String property = metricName.substring(METRIC_PREFIX_SESSION.length());
        Double ret = Double.NaN;

        if (mBeans.size() > 0) { // TODO flag error if != 1 ?
            EmsBean eBean = mBeans.get(0);
            eBean.refreshAttributes();
            EmsAttribute att = eBean.getAttribute(property);
            if (att != null) {
                Integer i = (Integer) att.getValue();
                ret = Double.valueOf(i);
            }
View Full Code Here

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

     * @return the Catalina WebModule MBean associated with this WAR
     */
    @Nullable
    private EmsBean getWebModuleMBean() {
        String webModuleMBeanName = getWebModuleMBeanName();
        EmsBean result = null;

        if (null != webModuleMBeanName) {
            EmsConnection conn = getEmsConnection();
            if (null != conn) {
                ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(webModuleMBeanName);
View Full Code Here

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

    @SuppressWarnings("unchecked")
    @Override
    public OperationResult invokeOperation(String name, Configuration parameters) throws Exception {
        if ("reloadCaches".equals(name)) {
            EmsBean emsBean = getEmsBean();
            Map<String, Integer> before = (Map<String, Integer>) emsBean.getAttribute("CacheCounts").refresh();
            emsBean.getOperation("reloadCaches").invoke(); // void return
            Map<String, Integer> after = (Map<String, Integer>) emsBean.getAttribute("CacheCounts").refresh();

            OperationResult result = new OperationResult();
            PropertyList statistics = new PropertyList("reloadStatistics");
            result.getComplexResults().put(statistics);
            for (String cacheName : before.keySet()) {
View Full Code Here

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

    public AvailabilityType getAvailability() {
        AvailabilityType avail;
        try {
            EmsConnection connection = loadConnection();
            EmsBean bean = connection.getBean("Catalina:type=Server");

            // this is necessary to prove that that not only the connection exists but is servicing requests.
            bean.getAttribute("serverInfo").refresh();
            avail = AvailabilityType.UP;
        } catch (Exception e) {
            if (log.isDebugEnabled()) {
                log.debug("An exception occurred during availability check for Tomcat Server Resource with key ["
                    + this.getResourceContext().getResourceKey() + "] and plugin config ["
View Full Code Here

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

            String beanName = name.substring(0, delimIndex);
            String attributeName = name.substring(delimIndex + 1);
            try {
                // Bean is cached by EMS, so no problem with getting the bean from the connection on each call
                EmsConnection emsConnection = loadConnection();
                EmsBean bean = emsConnection.getBean(beanName);
                EmsAttribute attribute = bean.getAttribute(attributeName);

                Object valueObject = attribute.refresh();
                if (valueObject instanceof Number) {
                    Number value = (Number) valueObject;
                    report.addData(new MeasurementDataNumeric(schedule, value.doubleValue()));
View Full Code Here

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

    private String storeConfig() {
        EmsConnection connection = this.serverComponent.getEmsConnection();
        if (connection == null) {
            throw new RuntimeException("Can not connect to the server");
        }
        EmsBean bean = connection.getBean(SERVER_MBEAN_NAME);
        EmsOperation operation = bean.getOperation("storeConfig");
        operation.invoke(new Object[0]);

        return ("Tomcat configuration updated.");
    }
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.