Examples of EmsAttribute


Examples of org.mc4j.ems.connection.bean.attribute.EmsAttribute

    }

    String getOperationMode() {
        EmsConnection emsConnection = getEmsConnection();
        EmsBean storageService = emsConnection.getBean("org.apache.cassandra.db:type=StorageService");
        EmsAttribute attribute = storageService.getAttribute("OperationMode");

        return (String) attribute.refresh();
    }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.attribute.EmsAttribute

    private void waitForTaskToComplete(int initialWaiting, int maxTries, int sleepMillis) throws InterruptedException {
        // initial waiting
        Thread.sleep(initialWaiting);
        EmsConnection emsConnection = getEmsConnection();
        EmsBean flushWriterBean = emsConnection.getBean("org.apache.cassandra.internal:type=FlushWriter");
        EmsAttribute attribute = flushWriterBean.getAttribute("PendingTasks");

        Long valueObject = (Long) attribute.refresh();
        // wait until org.apache.cassandra.internal:type=FlushWriter / PendingTasks == 0
        while (valueObject > 0 && maxTries-- > 0) {
            Thread.sleep(sleepMillis);
            valueObject = (Long) attribute.refresh();
        }
        flushWriterBean.unload();
    }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.attribute.EmsAttribute

    private File getServerHome() throws Exception {
        EmsConnection connection = loadConnection();
        EmsBean bean = connection.getBean("jboss.system:type=ServerConfig");
        File serverHomeViaJnp;
        EmsAttribute serverHomeDirAttrib = bean.getAttribute("ServerHomeDir");
        if (serverHomeDirAttrib != null) {
            serverHomeViaJnp = (File) serverHomeDirAttrib.refresh();
        } else {
            // We have a non-null MBean but a null ServerHomeDir attribute. This most likely means we're
            // connected to a JBoss 5.x or 6.x instance, because in those versions the ServerConfig MBean no
            // longer has a ServerHomeDir attribute. It instead has a ServerHomeLocation attribute, so give
            // that a try, so getAvailabilityNow() can print a more intelligent warning.
            EmsAttribute serverHomeLocationAttrib = bean.getAttribute("ServerHomeLocation");
            URL serverHomeLocation = (URL) serverHomeLocationAttrib.refresh();
            serverHomeViaJnp = toFile(serverHomeLocation);
        }
        return serverHomeViaJnp;
    }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.attribute.EmsAttribute

                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(request, value.doubleValue()));
                    } else {
                        report.addData(new MeasurementDataTrait(request, valueObject.toString()));
View Full Code Here

Examples of org.mc4j.ems.connection.bean.attribute.EmsAttribute

    }

    public static String getJndiNameBinding(EmsBean bean) {
        String jndiNameBinding = "";
        if (bean != null) {
            EmsAttribute attribute = bean.getAttribute("JNDIName");
            attribute.refresh();
            jndiNameBinding = String.valueOf(attribute.getValue());
        }

        return jndiNameBinding;
    }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.attribute.EmsAttribute

        try {
            String baseName = getBaseName(context.getSystemInformation());

            if (baseName != null) {
                EmsAttribute attrib = context.getParentResourceComponent().getAgentBean().getAttribute("Version");
                attrib.refresh();
                String version;
                if (attrib.getValue() != null) {
                    version = attrib.getValue().toString();
                } else {
                    version = Version.getProductVersion(); // just use the one we can get statically, its probably the correct version
                }

                // we know our agent plugin is running in the same process as our agent
View Full Code Here

Examples of org.mc4j.ems.connection.bean.attribute.EmsAttribute

        when(mockConfiguration.getSimple(any(String.class))).thenReturn(mockPropertySimple);
        when(mockPropertySimple.getBooleanValue()).thenReturn(Boolean.TRUE);

        EmsBean mockEmsBean = mock(EmsBean.class);
        when(objectUnderTest.getEmsBean()).thenReturn(mockEmsBean);
        EmsAttribute mockEmsAttribute = mock(EmsAttribute.class);
        when(mockEmsBean.getAttribute(anyString())).thenReturn(mockEmsAttribute);
        when(mockEmsAttribute.getValue()).thenReturn(Boolean.TRUE);

        File deploymentDirectory = new File(this.getClass().getResource("/").getFile() + "deploymentDirectory");
        deleteRecursive(deploymentDirectory);
        when(objectUnderTest.getConfigurationPath()).thenReturn(deploymentDirectory);
View Full Code Here

Examples of org.mc4j.ems.connection.bean.attribute.EmsAttribute

     */
    private boolean findInAgentHome(ResourceDiscoveryContext<AgentServerComponent<?>> context, String version,
        String baseName, HashSet<DiscoveredResourceDetails> discoveries) {

        try {
            EmsAttribute home = context.getParentResourceComponent().getAgentBean().getAttribute("AgentHomeDirectory");
            home.refresh();
            Object agentHome = home.getValue();
            if (agentHome != null) {
                File file = new File(agentHome.toString(), baseName);
                if (file.exists()) {
                    discoveries.add(createDetails(context, version, file));
                }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.attribute.EmsAttribute

                attributeName = getAttributeName(fullProperty);
            } else {
                attributeName = request.getName();
            }

            EmsAttribute attribute = null;
            for (EmsAttribute refreshedAttribute : refreshedAttributes) {
                if (attributeName.equals(refreshedAttribute.getName())) {
                    attribute = refreshedAttribute;
                }
            }

            if (attribute == null) {
                log.debug("Unable to collect measurement, attribute [" + request.getName() + "] not found on ["
                    + this.resourceContext.getResourceKey() + "]");
                // TODO GH: report.addError
            } else {
                Object value = attribute.getValue();
                if ((value != null) && (fullProperty != null)) {
                    // we're meant to load a specific property of the returned value object
                    value = lookupAttributeProperty(value, fullProperty);
                }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.attribute.EmsAttribute

        ConfigurationDefinition configurationDefinition = this.resourceContext.getResourceType()
            .getResourceConfigurationDefinition();

        for (PropertyDefinition property : configurationDefinition.getPropertyDefinitions().values()) {
            if (property instanceof PropertyDefinitionSimple) {
                EmsAttribute attribute = getEmsBean().getAttribute(property.getName());
                if (attribute != null) {
                    configuration.put(new PropertySimple(property.getName(), attribute.refresh()));
                }
            }
        }

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