Examples of EmsOperation


Examples of org.mc4j.ems.connection.bean.operation.EmsOperation

        return new OperationResult();
    }

    private OperationResult setLog4jLevel(Configuration parameters) {
        EmsBean emsBean = getEmsBean();
        EmsOperation operation = emsBean.getOperation("setLog4jLevel", String.class, String.class);

        String classQualifier = parameters.getSimpleValue("classQualifier");
        String level = parameters.getSimpleValue("level");

        operation.invoke(classQualifier, level);

        return new OperationResult();
    }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.operation.EmsOperation

        Exception {

        OperationResult result = null;
        if ("resetStatistics".equals(name)) {
            for (EmsBean bean : interceptors) {
                EmsOperation ops = bean.getOperation("resetStatistics");
                if (ops != null) // base bean has no resetStatistics
                    ops.invoke(new Object[] {});
            }
            result = null; // no result

        } else if ("listAssociatedMBeans".equals(name)) {
            StringBuilder sb = new StringBuilder();
View Full Code Here

Examples of org.mc4j.ems.connection.bean.operation.EmsOperation

        return getResourceContext().getParentResourceComponent().getEmsBean();
    }

    @Override
    public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) {
        EmsOperation operation = getEmsBean().getOperation("getEntityStatistics");
        Object entityStatistics = operation.invoke(getResourceContext().getResourceKey());

        for (MeasurementScheduleRequest request : requests) {
            Object val = super.lookupAttributeProperty(entityStatistics, request.getName());

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

Examples of org.mc4j.ems.connection.bean.operation.EmsOperation

                throw new RuntimeException("Error reverting from Backup: " + e.getMessage());
            }
        }

        // The following are MBean operations.
        EmsOperation mbeanOperation = this.jbossWebMBean.getOperation(name, new Class[0]);

        if (mbeanOperation == null) {
            throw new IllegalStateException("Operation [" + name + "] not found on bean ["
                + this.jbossWebMBean.getBeanName() + "]");
        }

        // NOTE: None of the supported operations have any parameters or return values, which makes our job easier.
        Object[] paramValues = new Object[0];
        mbeanOperation.invoke(paramValues);
        int state = (Integer) this.jbossWebMBean.getAttribute("state").refresh();
        int expectedState = getExpectedPostExecutionState(operation);

        // regardless of the new state, the avail may have changed, request an avail check
        getResourceContext().getAvailabilityContext().requestAvailabilityCheck();
View Full Code Here

Examples of org.mc4j.ems.connection.bean.operation.EmsOperation

        if (null == this.webModuleMBean) {
            throw new IllegalStateException("Could not find MBean for WAR '" + getApplicationName() + "'.");
        }

        // NOTE: None of the supported operations have any parameters or return values, which makes our job easier.
        EmsOperation mbeanOperation = this.webModuleMBean.getOperation(name, new Class[0]);
        if (mbeanOperation == null) {
            throw new IllegalStateException("Operation [" + name + "] not found on bean ["
                + this.webModuleMBean.getBeanName() + "]");
        }

        Object[] paramValues = new Object[0];
        mbeanOperation.invoke(paramValues);

        if (!WarOperation.DESTROY.equals(operation)) {
            String state = null;
            try {
                // check to see if the mbean is truly active
View Full Code Here

Examples of org.mc4j.ems.connection.bean.operation.EmsOperation

        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

Examples of org.mc4j.ems.connection.bean.operation.EmsOperation

        EmsConnection connection = this.serverComponent.getEmsConnection();
        if (connection == null) {
            throw new ExecutionFailedException("Can not connect to the server");
        }
        EmsBean bean = connection.getBean(mbeanName);
        EmsOperation operation = bean.getOperation(operationName);
        /*
         * Now see if we got the 'real' method (the one with no param) or the
         * overloaded one. This is a workaround for a bug in EMS that prevents
         * finding operations with same name and different signature.
         * http://sourceforge
         * .net/tracker/index.php?func=detail&aid=2007692&group_id
         * =60228&atid=493495
         *
         * In addition, as we offer the user to specify any MBean and any
         * method, we'd need a clever way for the user to specify parameters
         * anyway.
         */
        try {
            List<EmsParameter> params = operation.getParameters();
            int count = params.size();
            if (count == 0)
                operation.invoke(new Object[0]);
            else { // overloaded operation
                operation.invoke(new Object[] { 0 }); // return code of 0
            }
        } catch (RuntimeException e) {
            throw new ExecutionFailedException("Shutting down the server using JMX failed: " + e.getMessage(), e);
        }

View Full Code Here

Examples of org.mc4j.ems.connection.bean.operation.EmsOperation

            String operationMode = (String) operationModeAttr.refresh();
            if (operationMode.equals("DECOMMISSIONED")) {
                log.info("The storage node " + getHost() + " is already decommissioned.");
            } else {
                Class<?>[] emptyParams = new Class<?>[0];
                EmsOperation operation = storageService.getOperation("decommission", emptyParams);
                operation.invoke((Object[]) emptyParams);

                operationMode = (String) operationModeAttr.refresh();
                if (!operationMode.equals("DECOMMISSIONED")) {
                    result.setErrorMessage("Failed to decommission storage node " + getHost() + ". The " +
                        "StorageService is reporting " + operationMode + " for its operation mode but it should be " +
View Full Code Here

Examples of org.mc4j.ems.connection.bean.operation.EmsOperation

            snapshotPrefix + System.currentTimeMillis());
    }

    private void reloadInternodeAuthConfig() {
        EmsBean authBean = getEmsConnection().getBean("org.rhq.cassandra.auth:type=RhqInternodeAuthenticator");
        EmsOperation emsOperation = authBean.getOperation("reloadConfiguration");
        emsOperation.invoke();
    }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.operation.EmsOperation

        try {
            updateInternodeAuthConfFile(ipAddresses);

            EmsBean authBean = getEmsConnection().getBean("org.rhq.cassandra.auth:type=RhqInternodeAuthenticator");
            EmsOperation emsOperation = authBean.getOperation("reloadConfiguration");
            emsOperation.invoke();

            Configuration complexResults = result.getComplexResults();
            complexResults.put(new PropertySimple("details", "Successfully updated the set of known nodes."));

            return result;
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.