Examples of DiscoveredResourceDetails


Examples of org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails

            pluginConfig = context.getDefaultPluginConfiguration();

            pluginConfig.put(new PropertySimple("ordinal", i));

            DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), key, key, null,
                null, pluginConfig, null);

            results.add(detail);
        }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails

    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<T> context)
        throws InvalidPluginConfigurationException, Exception {
        Configuration pluginConfig = context.getDefaultPluginConfiguration();
        pluginConfig.put(new PropertySimple(TEST_PROPERTY, RESOURCE_TEST_PROPERTY));
        return Collections.singleton(new DiscoveredResourceDetails(context.getResourceType(), RESOURCE_KEY,
            RESOURCE_NAME, null, RESOURCE_DESCRIPTION, pluginConfig, null));
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails

                PluginContainerDeployment.AGENT);

            Set<DiscoveredResourceDetails> results = discoveryComponent.discoverResources(context);

            if (!results.isEmpty()) {
                DiscoveredResourceDetails details = results.iterator().next();

                Resource platform = new Resource();

                platform.setDescription(details.getResourceDescription());
                platform.setResourceKey(details.getResourceKey());
                platform.setName(details.getResourceName());
                platform.setVersion(details.getResourceVersion());
                platform.setPluginConfiguration(details.getPluginConfiguration());
                platform.setResourceType(rt);
                platform.setUuid(UUID.randomUUID().toString());
                platform.setId(1);

                return platform;
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails

                        if (m.matches()) {
                            Configuration pluginConfig = context.getDefaultPluginConfiguration();
                            pluginConfig.put(new PropertySimple("prefix", "/usr/bin/sudo"));
                            pluginConfig.put(new PropertySimple("command", smartctl.getAbsolutePath()));

                            DiscoveredResourceDetails detail =
                                    new DiscoveredResourceDetails(
                                            context.getResourceType(),
                                            driveName,
                                            driveName,
                                            null,
                                            model,
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails

                List<String> matches = augeas.match("/files/etc/samba/smb.conf/target[. != 'global']");
                for (String match : matches) {
                    String name = augeas.get(match);
                    Configuration pluginConfig = discoveryContext.getDefaultPluginConfiguration();
                    pluginConfig.put(new PropertySimple("targetName", name));
                    DiscoveredResourceDetails detail = new DiscoveredResourceDetails(discoveryContext.getResourceType(),
                        name, name + " share", null, "Samba Share [" + name + "]", pluginConfig, null);
                    details.add(detail);
                }
            }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails

        throws Exception {

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

        for (Object keyspaceName : getKeyspaces(context.getParentResourceComponent().getEmsConnection())) {
            details.add(new DiscoveredResourceDetails(context.getResourceType(), keyspaceName.toString(), keyspaceName
                .toString(), null, null, null, null));
        }

        return details;
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails

    @Override
    public DiscoveredResourceDetails discoverResource(Configuration pluginConfig,
        ResourceDiscoveryContext discoveryContext) throws InvalidPluginConfigurationException {

        DiscoveredResourceDetails details;

        DetectionMechanism detectionMechanism = getDetectionMechanism(pluginConfig);
        log.debug("resource will have detection mechanism of [" + detectionMechanism + "]");

        switch (detectionMechanism) {
        case INTERNAL:
            if (SystemInfoFactory.isNativeSystemInfoDisabled()) {
                throw new InvalidPluginConfigurationException(
                    "The native system is disabled - cannot use the internal detection mechanism");
            }
            if (!SystemInfoFactory.isNativeSystemInfoAvailable()) {
                throw new InvalidPluginConfigurationException(
                    "The native system is not available - cannot use the internal detection mechanism");
            }
            String version = LsofComponent.VERSION;
            details = new DiscoveredResourceDetails(discoveryContext.getResourceType(), "*lsof-internal*",
                DEFAULT_NAME, version, DEFAULT_DESCRIPTION, pluginConfig, null);
            break;
        case EXTERNAL:
            // do all that we can to make sure we have a valid full path to the executable
            PropertySimple executable = pluginConfig.getSimple(LsofComponent.PLUGINCONFIG_EXECUTABLE);
            executable.setStringValue(findExecutable(executable.getStringValue()));

            details = super.discoverResource(pluginConfig, discoveryContext);
            details.setResourceName(DEFAULT_NAME);
            break;
        default:
            throw new InvalidPluginConfigurationException("Unknown detection mechanism: " + detectionMechanism);
        }

View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails

            Configuration config2 = context.getDefaultPluginConfiguration();
            //add path component to config as well.
            PropertySimple pathProp = new PropertySimple("path", path);
            config2.put(pathProp);

            DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), // DataType
                path, // Key
                name, // Name
                null, // Version
                context.getResourceType().getDescription(), // Description
                config2, null);
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails

                    + "].  This is not allowed and they will be removed from discovery.  This is typically caused by "
                    + "having multiple versions of the same Deployment deployed.  To solve the problem either remove "
                    + "all but one version of the problem deployment or disable versioned deployment handling by "
                    + "setting -Drhq.as7.VersionedSubsystemDiscovery.pattern=disable for the agent.");
                for (Iterator<DiscoveredResourceDetails> i = updatedDetails.iterator(); i.hasNext();) {
                    DiscoveredResourceDetails detail = i.next();
                    if (detail.getResourceKey().equals(entry.getKey())) {
                        i.remove();
                    }
                }
            }
        }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails

    @Test
    public void testResourceKeyParsing() throws Exception {
        // Mock discovered resources
        Configuration pluginConfiguration = mock(Configuration.class);

        DiscoveredResourceDetails details = new DiscoveredResourceDetails(mock(ResourceType.class),
                "org.apache.cassandra.db:type=ColumnFamilies,keyspace=rhq,columnfamily=raw_metrics", "1", "2", "3",
                mock(Configuration.class), mock(ProcessInfo.class));
        DiscoveredResourceDetails details2 = new DiscoveredResourceDetails(mock(ResourceType.class),
                "org.apache.cassandra.db:type=ColumnFamilies,columnfamily=raw_metrics", "1", "2", "3",
                mock(Configuration.class), mock(ProcessInfo.class));
        final Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
        discoveredResources.add(details);
        discoveredResources.add(details2);
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.