Examples of VHostSpec


Examples of org.rhq.plugins.apache.util.VHostSpec

        replacements.put("snmp.identifier",
            addressUtility.getHttpdInternalMainServerAddressRepresentation(runtimeConfig).toString(false, false));

        replacements.put("main.rhq4.resource.key", ApacheVirtualHostServiceComponent.MAIN_SERVER_RESOURCE_KEY);

        VHostSpec vhost1 = deploymentConfig.vhost1 == null ? null : deploymentConfig.vhost1.getVHostSpec(replacements);
        VHostSpec vhost2 = deploymentConfig.vhost2 == null ? null : deploymentConfig.vhost2.getVHostSpec(replacements);
        VHostSpec vhost3 = deploymentConfig.vhost3 == null ? null : deploymentConfig.vhost3.getVHostSpec(replacements);
        VHostSpec vhost4 = deploymentConfig.vhost4 == null ? null : deploymentConfig.vhost4.getVHostSpec(replacements);

        if (vhost1 != null) {
            replacements.put(
                "vhost1.snmp.identifier",
                addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost1.hosts.get(0),
View Full Code Here

Examples of org.rhq.plugins.apache.util.VHostSpec

   
    protected String[] getFullSuccessfulUpgradeResourceKeys(ApacheTestSetup setup) {
        DeploymentConfig dc = setup.getDeploymentConfig();
        Map<String, String> replacements = dc.getTokenReplacements();

        VHostSpec vh1 = dc.vhost1.getVHostSpec(replacements);
        VHostSpec vh2 = dc.vhost2.getVHostSpec(replacements);
        VHostSpec vh3 = dc.vhost3.getVHostSpec(replacements);
        VHostSpec vh4 = dc.vhost4.getVHostSpec(replacements);

        String[] ret = new String[5];

        ret[0] = ApacheVirtualHostServiceComponent.MAIN_SERVER_RESOURCE_KEY;
        ret[1] = ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(vh1.serverName, vh1.hosts);
View Full Code Here

Examples of org.rhq.plugins.apache.util.VHostSpec

        for(int i = 0; i < sucLen; ++i, ++retIdx) {
            int vhostNum = successfulUpgrades[i];
            if (vhostNum == 0) {
                ret[retIdx] = ApacheVirtualHostServiceComponent.MAIN_SERVER_RESOURCE_KEY;
            } else {
                VHostSpec vhost = setup.getDeploymentConfig().getVHost(vhostNum).getVHostSpec(replacements);
                ret[retIdx] = ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(vhost.serverName, vhost.hosts);
            }
        }

        for(int i = 0; i < failLen; ++i, ++retIdx) {
View Full Code Here

Examples of org.rhq.plugins.apache.util.VHostSpec

                                + (vhosts.size() + 1) + ". The upgrade will continue using the resource key matching.");
                        } else {
                            //k, this seems to be a correct value
                            //the SNMP indices are in the reverse order of the definitions in the config files
                            //+1, where the main server is always on index 1.
                            VHostSpec vhost = vhosts.get(vhosts.size() - snmpServiceIndex + 1);

                            //right, let's do a cross-check before we actually create the resource key so
                            //that we catch user-generated errors.
                            Set<String> legacyResourceKeys =
                                legacyResourceKeyUtil.getLegacyVirtualHostResourceKeys(vhost);
                            if (legacyResourceKeys.contains(resourceKey)) {
                                newResourceKey = createResourceKey(vhost.serverName, vhost.hosts);
                            } else {
                                log.debug("The cross-check of the SNMP WWW Service Index value and resource key failed for virtual host with old resource key: "
                                    + resourceKey + ". The upgrade will continue using resource key matching.");
                            }
                        }
                    }
                } else {
                    log.warn("The " + LEGACY_SNMP_SERVICE_INDEX_CONFIG_PROP
                        + " property should be a positive integer greater than zero but is " + snmpServiceIndex
                        + " instead. The upgrade will continue using the resource key matching.");
                }
            }
        }

        if (newResourceKey != null) {
            ResourceUpgradeReport report = new ResourceUpgradeReport();
            report.setNewResourceKey(newResourceKey);

            return report;
        }

        Map<String, Set<VHostSpec>> possibleMatchesPerRK = new HashMap<String, Set<VHostSpec>>();
        for (VHostSpec vhost : vhosts) {
            Set<String> legacyResourceKeys = legacyResourceKeyUtil.getLegacyVirtualHostResourceKeys(vhost);

            for (String legacyRK : legacyResourceKeys) {
                addPossibleRKMatch(legacyRK, vhost, possibleMatchesPerRK);
            }
        }

        for (String legacyRK : legacyResourceKeyUtil.getLegacyMainServerResourceKeys()) {
            addPossibleRKMatch(legacyRK, null, possibleMatchesPerRK);
        }

        Set<VHostSpec> matchingVhosts = possibleMatchesPerRK.get(resourceKey);
        if (matchingVhosts == null || matchingVhosts.isEmpty()) {
            throw new IllegalArgumentException(
                "Failed to identify the vhost resource with the old-style resource key '"
                    + resourceKey
                    + "' with any of the vhosts in the apache configuration files. This means that the vhost resource is stale and you can safely uninventory it.");
        } else if (matchingVhosts.size() > 1) {
            String message =
                "Failed to uniquely identify the vhost from the old-style resource key. The old resource key is '"
                    + resourceKey
                    + "' which could be matched with any of the following possible new-style resource keys: "
                    + matchingVhosts
                    + ". The plugin does not have enough information to successfully upgrade this resource."
                    + " Please take note of any alert definitions or operation schedules that you have defined for this resource and manually uninventory it.";

            throw new IllegalArgumentException(message);
        } else {
            VHostSpec vhost = matchingVhosts.iterator().next();
            if (vhost == null) {
                newResourceKey = ApacheVirtualHostServiceComponent.MAIN_SERVER_RESOURCE_KEY;
            } else {
                newResourceKey = createResourceKey(vhost.serverName, vhost.hosts);
            }
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.