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

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


            }
        }

        // We have changed http port to 8081 and https to 9443, lets write back

        ConfigurationWriteDelegate cwd = new ConfigurationWriteDelegate(configDef, getDomainControllerASConnection(), a);
        ConfigurationUpdateReport report = new ConfigurationUpdateReport(conf);
        cwd.updateResourceConfiguration(report);
        assert report.getStatus() == ConfigurationUpdateStatus.SUCCESS;

        // now check the result (and change back)

        Configuration conf2 = loadDelegate.loadResourceConfiguration();
        assert conf2 != null : "Did not get a configuration back";
        List<Property> pl2 = conf.getList("*").getList();
        for (Property p : pl2) {
            PropertyMap pm = (PropertyMap) p;
            Map<String, Property> pmap = pm.getMap();
            PropertySimple name = (PropertySimple) pmap.get("name");
            assert name != null;
            assert name.getStringValue() != null;
            if ("http".equals(name.getStringValue())) {
                PropertySimple portProp = (PropertySimple) pmap.get("port");
                assert portProp != null;
                assert portProp.getStringValue() != null;

                portProp.setStringValue("8080");
            }
            if ("https".equals(name.getStringValue())) {
                PropertySimple portProp = (PropertySimple) pmap.get("port");
                assert portProp != null;
                assert portProp.getStringValue() != null;

                portProp.setStringValue("8443");
            }
        }
        report = new ConfigurationUpdateReport(conf);
        cwd.updateResourceConfiguration(report);
        assert report.getStatus() == ConfigurationUpdateStatus.SUCCESS;
    }
View Full Code Here


      if (!name.startsWith(INTERNAL))
         return;

      name = name.substring(INTERNAL_SIZE);

      PluginStats stats = PluginStats.getInstance();
      MeasurementDataNumeric data;
      Double val;
      if (name.equals("mgmtRequests")) {
         val = (double) stats.getRequestCount();
      } else if (name.equals("requestTime")) {
         val = (double) stats.getRequestTime();
      } else if (name.equals("maxTime")) {
         val = (double) stats.getMaxTime();
      } else
         val = Double.NaN;

      data = new MeasurementDataNumeric(req, val);
      report.addData(data);
View Full Code Here

         * stay the same when the resource is discovered the next
         * time
         */

        ResourceComponent parent = discoveryContext.getParentResourceComponent();
        StandaloneASComponent parentComponent = (StandaloneASComponent) parent;
        File homeDir = parentComponent.getServerPluginConfiguration().getHomeDir();
        if (homeDir==null || !homeDir.exists()) {
            return Collections.EMPTY_SET;
        }
        String home = homeDir.getAbsolutePath();

View Full Code Here

                Thread.sleep(SECONDS.toMillis(1));
            }
        }

        // BZ 893802: wait until server (the process) is really down
        HostConfiguration hostConfig = getHostConfig();
        // commandLine instance is not important for determining whether the HostPort is local or not
        AS7CommandLine commandLine = new AS7CommandLine(new String[] { "java", "foo.Main",
            "org.jboss.as.host-controller" });
        HostPort hostPort = hostConfig.getDomainControllerHostPort(commandLine);

        if (hostPort.isLocal) {
            // lets be paranoid here
            for (ProcessInfo processInfo = context.getNativeProcess();; processInfo = context.getNativeProcess()) {
                if (processInfo == null) {
View Full Code Here

            result.setErrorMessage("'" + ServerPluginConfiguration.Property.BASE_DIR
                + "' plugin config prop is not set.");
            return result;
        }

        HostConfiguration hostConfig = getHostConfig();
        String realm = pluginConfig.getSimpleValue("realm", "ManagementRealm");
        File propertiesFile = hostConfig.getSecurityPropertyFile(serverPluginConfig, realm);
        if (!propertiesFile.canWrite()) {
            result.setErrorMessage("Management users properties file [" + propertiesFile + "] is not writable.");
            return result;
        }
View Full Code Here

        return null;
    }

    private HostConfiguration getHostConfig() {
        File configFile;
        HostConfiguration hostConfig;
        try {
            String config = readAttribute(getEnvironmentAddress(), getMode().getHostConfigAttributeName());
            configFile = new File(config);
        } catch (Exception e) {
            // This probably means the server is not running and/or authentication is not set up. Fallback to the
            // host config file set in the plugin config during discovery.
            // TODO (ips, 05/05/12): This is not ideal, because the user could have restarted the server with a
            //                       different config file, since the time it was imported into inventory. The better
            //                       thing to do here is to find the current server process and parse its command line
            //                       to find the current config file name.
            configFile = serverPluginConfig.getHostConfigFile();
            if (configFile == null) {
                throw new RuntimeException("Failed to determine config file path.", e);
            }
        }
        try {
            hostConfig = new HostConfiguration(configFile);
        } catch (Exception e) {
            throw new RuntimeException("Failed to parse configuration file [" + configFile + "].", e);
        }
        return hostConfig;
    }
View Full Code Here

        // BZ 893802: wait until server (the process) is really down
        HostConfiguration hostConfig = getHostConfig();
        // commandLine instance is not important for determining whether the HostPort is local or not
        AS7CommandLine commandLine = new AS7CommandLine(new String[] { "java", "foo.Main",
            "org.jboss.as.host-controller" });
        HostPort hostPort = hostConfig.getDomainControllerHostPort(commandLine);

        if (hostPort.isLocal) {
            // lets be paranoid here
            for (ProcessInfo processInfo = context.getNativeProcess();; processInfo = context.getNativeProcess()) {
                if (processInfo == null) {
View Full Code Here

public class XmlFileReadingTest {

    public void hostPort70() throws Exception {
        URL url = getClass().getClassLoader().getResource("standalone70.xml");
        HostConfiguration hostConfig = new HostConfiguration(new File(url.getPath()));
        HostPort hp = hostConfig.getManagementHostPort(
                new AS7CommandLine(new String [] {"java", "foo.Main", "org.jboss.as.standalone"}), AS7Mode.STANDALONE);
        System.out.println(hp);
        assert hp.host.equals("127.0.0.70") : "Host is " + hp.host;
        assert hp.port==19990 : "Port is " + hp.port;
    }
View Full Code Here

    }

    public void hostPort71() throws Exception {
        URL url = getClass().getClassLoader().getResource("standalone71.xml");
        HostConfiguration hostConfig = new HostConfiguration(new File(url.getPath()));
        HostPort hp = hostConfig.getManagementHostPort(
                new AS7CommandLine(new String[] {"java", "foo.Main", "org.jboss.as.standalone"}), AS7Mode.STANDALONE);
        System.out.println(hp);
        // hp : HostPort{host='localhost', port=9990, isLocal=true}
        assert hp.host.equals("127.0.0.71") : "Host is " + hp.host;
        assert hp.port==29990 : "Port is " + hp.port;
View Full Code Here

    }

    public void domainController1() throws Exception {
        URL url = getClass().getClassLoader().getResource("host1.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 hp.isLocal : "DC is not local as expected: " + hp;
    }
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.