Package org.rhq.modules.plugins.jbossas7.helper

Examples of org.rhq.modules.plugins.jbossas7.helper.HostPort


    }

    public void domainController2() throws Exception {
        URL url = getClass().getClassLoader().getResource("host2.xml");
        HostConfiguration hostConfig = new HostConfiguration(new File(url.getPath()));
        HostPort hp = hostConfig.getDomainControllerHostPort(new AS7CommandLine(new String[]{"java", "foo.Main",
                "org.jboss.as.host-controller"}));
        assert "192.168.100.1".equals(hp.host) : "DC is at " + hp.host;
        assert hp.port == 9559 : "DC port is at " + hp.port;
    }
View Full Code Here


    }

    public void domainController3() throws Exception {
        URL url = getClass().getClassLoader().getResource("host3.xml");
        HostConfiguration hostConfig = new HostConfiguration(new File(url.getPath()));
        HostPort hp = hostConfig.getDomainControllerHostPort(new AS7CommandLine(new String[]{"java", "foo.Main",
                "org.jboss.as.host-controller", "--master-address=192.168.123.123"}));
        assert "192.168.123.123".equals(hp.host) : "DC is at " + hp.host;
        assert hp.port == 1234 : "DC port is at " + hp.port;
    }
View Full Code Here

        serverPluginConfig.setLogDir(logDir);

        File logFile = getLogFile(logDir);
        initLogEventSourcesConfigProp(logFile.getPath(), pluginConfig);

        HostPort managementHostPort = hostConfig.getManagementHostPort(commandLine, getMode());
        serverPluginConfig.setHostname(managementHostPort.host);
        serverPluginConfig.setPort(managementHostPort.port);
        serverPluginConfig.setSecure(managementHostPort.isSecure);
        HostPort nativeHostPort = hostConfig.getNativeHostPort(commandLine, getMode());
        serverPluginConfig.setNativeHost(nativeHostPort.host);
        serverPluginConfig.setNativePort(nativeHostPort.port);
        pluginConfig.setSimpleValue("realm", hostConfig.getManagementSecurityRealm());
        String apiVersion = hostConfig.getDomainApiVersion();
        JBossProductType productType = JBossProductType.determineJBossProductType(homeDir, apiVersion);
        serverPluginConfig.setProductType(productType);
        pluginConfig.setSimpleValue("expectedRuntimeProductName", productType.PRODUCT_NAME);
        pluginConfig.setSimpleValue("hostXmlFileName", getHostXmlFileName(commandLine));

        ProcessInfo agentProcess = discoveryContext.getSystemInformation().getThisProcess();
        setStartScriptPluginConfigProps(process, commandLine, pluginConfig, agentProcess);
        setUserAndPasswordPluginConfigProps(serverPluginConfig, hostConfig);

        String key = createKeyForLocalResource(serverPluginConfig);
        HostPort hostPort = hostConfig.getDomainControllerHostPort(commandLine);
        String name = buildDefaultResourceName(hostPort, managementHostPort, productType, hostConfig.getHostName());
        String description = buildDefaultResourceDescription(hostPort, productType);
        String version = getVersion(homeDir, productType);

        pluginConfig.setSimpleValue("supportsPatching", Boolean.toString(supportsPatching(productType, version)));
View Full Code Here

        if (productType == null) {
            throw new InvalidPluginConfigurationException("Can not connect to [" + hostname + ":" + port
                + "] as user [" + user + "]. Did you provide the correct credentials?");
        }

        HostPort hostPort = new HostPort(false);
        HostPort managementHostPort = new HostPort(false);
        managementHostPort.host = hostname;
        managementHostPort.port = port;
        String key = createKeyForRemoteResource(hostname + ":" + port);
        String name = buildDefaultResourceName(hostPort, managementHostPort, productType, null);
        //FIXME this is inconsistent with how the version looks like when autodiscovered
View Full Code Here

    private long lastManagementInterfaceReply = 0;

    @Override
    public void start(ResourceContext<T> resourceContext) throws Exception {
        super.start(resourceContext);
        serverPluginConfig = new ServerPluginConfiguration(pluginConfiguration);
        serverPluginConfig.validate();
        connection = new ASConnection(ASConnectionParams.createFrom(serverPluginConfig));
        setASHostName(findASDomainHostName());
        getAvailability();
        logFileEventDelegate = new LogFileEventResourceComponentHelper(context);
View Full Code Here

    private ServerControl(Configuration pluginConfiguration, AS7Mode serverMode, SystemInfo systemInfo) {
        this.pluginConfiguration = pluginConfiguration;
        this.serverMode = serverMode;
        this.systemInfo = systemInfo;
        serverPluginConfig = new ServerPluginConfiguration(pluginConfiguration);

        StartScriptConfiguration startScriptConfiguration = new StartScriptConfiguration(pluginConfiguration);

        startScriptPrefix = startScriptConfiguration.getStartScriptPrefix();
View Full Code Here

        // Since our properties are can be added at parent resource creation time, we have to make sure they are added.
        if (report.getStatus() == CreateResourceStatus.SUCCESS) {
            // Now we have to send this as an update, so the properties are created properly
            ConfigurationUpdateReport updateReport = new ConfigurationUpdateReport(report.getResourceConfiguration());
            ConfigurationDefinition configDef = report.getResourceType().getResourceConfigurationDefinition();
            Address address = new Address(getAddress());
            address.add(report.getPluginConfiguration().getSimpleValue("path"),report.getUserSpecifiedResourceName());
            ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef, getASConnection(), address);
            delegate.updateResourceConfiguration(updateReport);

            if (updateReport.getStatus() != ConfigurationUpdateStatus.SUCCESS) {
                report.setErrorMessage(updateReport.getErrorMessage());
View Full Code Here

            report.setErrorMessage("No flavor given");

            return report;
        }
        String newName = report.getUserSpecifiedResourceName();
        Address address = new Address(this.getAddress());
        address.add(flavor,newName);
        Operation add = new Operation("add",address);
        for (Property prop: config.getProperties()) {
            if (prop.getName().equals(FLAVOR)) {
                continue;
            }
            PropertySimple ps = (PropertySimple) prop;
            add.addAdditionalProperty(prop.getName(),ps.getStringValue()); // TODO format conversion?

        }
        Result result = getASConnection().execute(add);
        if (result.isSuccess()) {
            report.setResourceKey(address.getPath());
            report.setResourceName(address.getPath());
            report.setStatus(CreateResourceStatus.SUCCESS);
        }
        else {
            report.setErrorMessage(result.getFailureDescription());
            report.setStatus(CreateResourceStatus.FAILURE);
View Full Code Here

        if ((parentConfPath != null) && (!parentConfPath.isEmpty())) {
            path = parentConfPath + "," + confPath;//Ex. profile=standalone-ha,subsystem=security
        }

        String name;//name=security
        Address address = new Address(path);

        //process the specific nodes
        //Then we need to find out which of subchildren of ModOpsComponent is used i)security-domain=*
        //ii)[Authentication*,etc] or iii)[ModOptions]

        //path should already be right
        if (path.endsWith("security-domain")) {//individual security domain entries
            //ex. path => /subsystem=security/security-domain=(entry name)
            //find all children and iterate over and update name appropriately
            Address typeAddress = new Address(path);
            String childType = "security-domain";
            Result result = connection.execute(new ReadChildrenNames(typeAddress, childType));

            if (result.isSuccess()) {

                @SuppressWarnings("unchecked")
                List<String> children = (List<String>) result.getResult();
                for (String child : children) {
                    //update the components for discovery
                    name = child;//ex. basic, databaseDomain
                    String currentChildPath = path + //ex. /subsystem=security,security-domain=jboss-web
                        "=" + child;
                    address = new Address(currentChildPath);
                    addDiscoveredResource(context, details, connection, currentChildPath, name, address);
                }
            }
        } else if (ifResourceIsSupportedModuleType(path)) {//is ModOptions map child
            //ex. path => /subsystem=security/security-domain=(entry name)/authentication=classic/login-modules
            //Ex. String attribute = "login-modules";
            String attribute = lookupAttributeType(path);
            //query all the module-options defined and discover them here
            //Ex. String typeAddress = "subsystem=security,security-domain=testDomain2,authentication=classic";
            String typeAddress = parentConfPath;
            ReadAttribute readModuleOptionType = new ReadAttribute(new Address(typeAddress), attribute);
            Result result = connection.execute(readModuleOptionType);
            if (result.isSuccess()) {
                List<Value> loadedLoginModuleTypes = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
                    ModuleOptionsComponent.loadModuleOptionType(attribute));
                for (int moduleIndex = 0; moduleIndex < loadedLoginModuleTypes.size(); moduleIndex++) {
View Full Code Here

    }

    protected boolean waitUntilDown() throws InterruptedException {
        boolean notAnswering = false;
        while (!notAnswering) {
            Operation op = new ReadAttribute(new Address(), "release-version");

            try {
                Result res = getASConnection().execute(op);
                if (!res.isSuccess()) { // If op succeeds, server is not down
                    notAnswering = true;
View Full Code Here

TOP

Related Classes of org.rhq.modules.plugins.jbossas7.helper.HostPort

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.