Examples of AgentConfiguration


Examples of org.rhq.enterprise.agent.AgentConfiguration

     *
     * @throws Exception
     */
    private AgentConfiguration prepareConfigurationPreferences() throws Exception {
        Preferences prefNode = getPreferencesNode();
        AgentConfiguration config = new AgentConfiguration(prefNode);

        if (config.getAgentConfigurationVersion() == 0) {
            config = loadConfigurationFile();
        }

        // now that the configuration preferences are loaded, we need to override them with any bootstrap override properties
        Map<String, String> overrides = configurationOverrides;
        if (overrides != null) {
            for (Map.Entry<String, String> entry : overrides.entrySet()) {
                String key = entry.getKey();
                String value = entry.getValue();

                // allow ${var} notation in the values so we can provide variable replacements in the values
                value = StringPropertyReplacer.replaceProperties(value);

                prefNode.put(key, value);
            }
        }

        // let's make sure our configuration is upgraded to the latest schema
        AgentConfigurationUpgrade.upgradeToLatest(config.getPreferences());

        return config;
    }
View Full Code Here

Examples of org.rhq.enterprise.agent.AgentConfiguration

            StreamUtil.copy(rawConfigInputStream, rawConfigFile, true);
            String newConfig = StringPropertyReplacer.replaceProperties(rawConfigFile.toString());
            ByteArrayInputStream newConfigInputStream = new ByteArrayInputStream(newConfig.getBytes());
            Preferences.importPreferences(newConfigInputStream);

            AgentConfiguration newAgentConfig = new AgentConfiguration(prefNode);
            if (newAgentConfig.getAgentConfigurationVersion() == 0) {
                throw new IllegalArgumentException("Bad preferences node");
            }

            // If we had a security token, restore it so we can maintain our known registration with the server.
            // Note that if the configuration file already had a security token defined, it will be used and the old
            // token we had will be thrown away.
            if (securityToken != null) {
                if (newAgentConfig.getAgentSecurityToken() == null) {
                    log.debug("Restoring embedded agent security token");
                    newAgentConfig.setAgentSecurityToken(securityToken);
                } else {
                    log.debug("Not restoring embedded agent security token, the config file was preconfigured with one");
                }
            }

            prefNode.flush();

        } catch (Exception e) {
            // a problem occurred importing the config file; let's restore our original values
            try {
                Preferences.importPreferences(new ByteArrayInputStream(backup.toByteArray()));
            } catch (Exception e1) {
                // its conceivable the same problem occurred here as with the original exception (backing store problem?)
                // let's throw the original exception, not this one
            }
            throw e;
        }

        AgentConfiguration agentConfig = new AgentConfiguration(prefNode);
        return agentConfig;
    }
View Full Code Here

Examples of org.wso2.carbon.databridge.agent.thrift.conf.AgentConfiguration

    @Override
    public void setProperties(Map<String, String> arg0) {}
   
    private static void createDataPublisher(){
        //creating the agent
        AgentConfiguration agentConfiguration = new AgentConfiguration();

        ServerConfiguration serverConfig =  CarbonUtils.getServerConfiguration();
        String trustStorePath = serverConfig.getFirstProperty("Security.TrustStore.Location");
        String trustStorePassword = serverConfig.getFirstProperty("Security.TrustStore.Password");
        String bamServerUrl = serverConfig.getFirstProperty("BamServerURL");
View Full Code Here

Examples of org.wso2.carbon.databridge.agent.thrift.conf.AgentConfiguration

        this.setDataPublisherInitialized(false);
    }

    public void initialize () {

        AgentConfiguration agentConfiguration = new AgentConfiguration();
        //System.setProperty("javax.net.ssl.trustStore", "/home/isuru/wso2/S2/apache/stratos/alpha/wso2bam-2.4.0/repository/resources/security/client-truststore.jks");
        //System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
        Agent agent = new Agent(agentConfiguration);

        dataPublisher = new AsyncDataPublisher(dataPublisherConfig.getMonitoringServerUrl(), dataPublisherConfig.getAdminUsername(),
View Full Code Here

Examples of org.wso2.carbon.databridge.agent.thrift.conf.AgentConfiguration

            init();
        }
    }

    private void init() {
        AgentConfiguration agentConfiguration = new AgentConfiguration();
        Agent agent = new Agent(agentConfiguration);

        // Initialize asynchronous data publisher
        asyncDataPublisher = new AsyncDataPublisher("tcp://" + ip + ":" + port + "", username, password, agent);
        asyncDataPublisher.addStreamDefinition(streamDefinition);
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.