Package org.mc4j.ems.connection.bean

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


            // Let's try to auto-discover if this Connector is using a shared executor for its thread pool.
            // If it is, let's set the plugin config property automatically so we can collect the proper metrics.
            // Note that if the "executorName" attribute on the Connector MBean is "Internal", that means it is NOT shared.
            String connectorON = pluginConfiguration.getSimpleValue(TomcatConnectorComponent.OBJECT_NAME_PROP, null);
            if (connectorON != null) {
                EmsBean connectorBean = connection.getBean(connectorON);
                EmsAttribute executorNameAttrib = connectorBean.getAttribute("executorName");
                if (executorNameAttrib != null) {
                    Object executorNameValue = executorNameAttrib.getValue();
                    if (executorNameValue != null) {
                        String executorName = executorNameValue.toString();
                        if (!executorName.isEmpty() && !executorName.equalsIgnoreCase("Internal")) {
View Full Code Here


        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
 
View Full Code Here

    private EmsOperation deployOperation;
    private EmsOperation undeployOperation;

    public TomcatApplicationDeployer(EmsConnection connection, String vhostName) throws NoSuchMethodException {
        String deployerBean = getDeployerBeanName(vhostName);
        EmsBean mainDeployer = connection.getBean(deployerBean);
        if (mainDeployer == null) {
            throw new IllegalStateException("MBean named [" + deployerBean + "] does not exist.");
        }

        connection.getConnectionProvider().getConnectionSettings().getClassPathEntries();
View Full Code Here

                    continue;
                }

                // get some info from the MBean (it seems awkward I have to query for the bean I'm basically dealing with)
                EmsConnection connection = context.getParentResourceComponent().getEmsConnection();
                EmsBean warBean = connection.getBean(resource.getResourceKey());
                // this refresh is important in case EMS is caching a stale version of this object. It can happen if
                // a user deletes and then recreates the same object.
                List<EmsAttribute> contextRootAttribs = warBean.refreshAttributes(EMS_ATTRIBUTE_PATH);               
                String contextRoot = (String) contextRootAttribs.get(0).getValue();
                List<EmsAttribute> docBaseAttribs = warBean.refreshAttributes(EMS_ATTRIBUTE_DOC_BASE);
                String docBase = (String) docBaseAttribs.get(0).getValue();
                File docBaseFile = new File(docBase);
                String filename = (docBaseFile.isAbsolute()) ? docBase
                    : (deployDirectoryPath + File.separator + docBase);
                try {
View Full Code Here

        String objectNameTemplate = "jboss.management.local:J2EEServer=Local,j2eeType=J2EEApplication,name="
            + parentEARComponent.getApplicationName();
        ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(objectNameTemplate);
        List<EmsBean> mBeans = parentJBossASComponent.getEmsConnection().queryBeans(queryUtility.getTranslatedQuery());
        if (mBeans.size() == 1) {
            EmsBean theBean = mBeans.get(0);
            EmsAttribute ddAttr = theBean.getAttribute("deploymentDescriptor");
            ddAttr.refresh();
            ddAttr.getValue();
            String dd = (String) ddAttr.getValue();
            // dd contains application.xml
View Full Code Here

        String objectNameTemplate = "jboss.web:j2eeType=WebModule,name=//localhost/" + contextRoot
            + ",J2EEApplication=none,J2EEServer=none";
        ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(objectNameTemplate);
        List<EmsBean> mBeans = parentJBossASComponent.getEmsConnection().queryBeans(queryUtility.getTranslatedQuery());
        if (mBeans.size() == 1) {
            EmsBean theMBean = mBeans.get(0);
            return theMBean.getBeanName().getCanonicalName();
        }

        return null;
    }
View Full Code Here

     */
    protected EmsBean loadBean(T 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

        log.info("Decommissioning " + getResourceContext().getResourceKey());

        OperationResult result = new OperationResult();
        try {
            EmsConnection emsConnection = getEmsConnection();
            EmsBean storageService = emsConnection.getBean("org.apache.cassandra.db:type=StorageService");

            EmsAttribute operationModeAttr = storageService.getAttribute("OperationMode");
            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 " +
View Full Code Here

        keyspaceService.takeSnapshot(new String[] { SYSTEM_KEYSPACE, SYSTEM_AUTH_KEYSPACE, RHQ_KEYSPACE },
            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

        }

        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."));
View Full Code Here

TOP

Related Classes of org.mc4j.ems.connection.bean.EmsBean

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.