Package org.rhq.core.clientapi.server.core

Examples of org.rhq.core.clientapi.server.core.AgentVersion


            } else {
                // we were given a regex of supported builds, check the agent build to see if it matches the regex
                isSupported = agentVersionInfo.getBuild().matches(supportedAgentBuilds);
            }

            return new AgentVersionCheckResults(isSupported, new AgentVersion(latestAgentVersion, latestAgentBuild));
        } catch (Exception e) {
            LOG.warn("Cannot determine if agent version [" + agentVersionInfo + "] is supported. Cause: " + e);
            return new AgentVersionCheckResults(false, null); // assume we can't talk to it
        }
    }
View Full Code Here


    private final boolean isSupported;
    private final AgentVersion latestAgentVersion;

    public AgentVersionCheckResults(boolean isSupported, AgentVersion latestAgentVersion) {
        this.isSupported = isSupported;
        this.latestAgentVersion = (AgentVersion) ((latestAgentVersion != null) ? latestAgentVersion : new AgentVersion("",""));

    }
View Full Code Here

    @Override
    public ConnectAgentResults connectAgent(ConnectAgentRequest request) throws AgentRegistrationException,
        AgentNotSupportedException {

        String agentName = request.getAgentName();
        AgentVersion agentVersion = request.getAgentVersion();

        log.info("Agent [" + agentName + "][" + agentVersion + "] would like to connect to this server");

        AgentVersionCheckResults agentVersionCheckResults = getAgentManager().isAgentVersionSupported(agentVersion);
        if (!agentVersionCheckResults.isSupported()) {
View Full Code Here

                            ServiceContainerConfiguration server_config = agent_config.getServiceContainerPreferences();
                            String agent_name = agent_config.getAgentName();
                            String address = server_config.getConnectorBindAddress();
                            int port = server_config.getConnectorBindPort();
                            String remote_endpoint = server_config.getConnectorRemoteEndpoint();
                            AgentVersion agentVersion = getAgentVersion();
                            String installId = System.getProperty(AgentRegistrationRequest.SYSPROP_INSTALL_ID);
                            String installLocation = getAgentHomeDirectory();
                            if (installLocation != null && installLocation.trim().length() == 0) {
                                installLocation = null; // tells the server we don't know it
                            }
View Full Code Here

                // version as the latest agent version as told to us by the server, then this agent should update now.
                // Notice we will only check the build number (hash), the version may be the same but the
                // build hashes will be different.
                boolean agentUpdateEnabled = getConfiguration().isAgentUpdateEnabled();
                if (agentUpdateEnabled) {
                    AgentVersion latestVersion = results.getLatestAgentVersion();
                    if (latestVersion != null && latestVersion.getBuild() != null) {
                        AgentVersion ourVersion = getAgentVersion();
                        if (!ourVersion.getBuild().equals(latestVersion.getBuild())) {
                            throw new AgentNotSupportedException(MSG.getMsg(
                                AgentI18NResourceKeys.AGENT_BUILD_DOES_NOT_MATCH_AUTO_UPDATE_NOW, ourVersion,
                                latestVersion));
                        }
                    }
View Full Code Here

     * @return agent version POJO
     */
    private AgentVersion getAgentVersion() {
        String version = Version.getProductVersion();
        String build = Version.getBuildNumber();
        AgentVersion agentVersion = new AgentVersion(version, build);
        return agentVersion;
    }
View Full Code Here

    private Command createConnectAgentCommand() throws Exception {
        AgentConfiguration config = getConfiguration();
        String agentName = config.getAgentName();
        boolean agentUpdateEnabled = config.isAgentUpdateEnabled();
        AgentVersion version = getAgentVersion();
        ConnectAgentRequest request = new ConnectAgentRequest(agentName, version, agentUpdateEnabled);

        RemotePojoInvocationCommand connectCommand = new RemotePojoInvocationCommand();
        Method connectMethod = CoreServerService.class.getMethod("connectAgent", ConnectAgentRequest.class);
        NameBasedInvocation inv = new NameBasedInvocation(connectMethod, new Object[] { request });
View Full Code Here

    // our agent manager to use to run the check - its the real AgentManagerBean that doesn't require any EE infrastructure for this test
    private AgentManagerBean agentManager = new AgentManagerStub();

    public void testLatestAgentBuildCheck() {
        AgentVersion agentVersionInfo = setLatestAgentVersionAndBuildToCheck("1.0.GA", "cafebabe0", "1.0.GA",
            "cafebabe0");
        assert true == agentManager.isAgentVersionSupported(agentVersionInfo).isSupported();
        agentVersionInfo = setLatestAgentVersionAndBuildToCheck("1.0.GA", "cafebabe0", "1.0.RC1", "cafebabe1");
        assert false == agentManager.isAgentVersionSupported(agentVersionInfo).isSupported();
        agentVersionInfo = setLatestAgentVersionAndBuildToCheck("1.0.GA", "nocafe", "2.0.GA", "cafebabe2");
View Full Code Here

        checkFail(regex, "cafebabe9");
    }

    public void testLatestAgentBuildCheckRegex() {
        String regexOptions = "cafebabe0|3degf01|cafebabe9";
        AgentVersion agentVersionInfo = setSupportedBuildsToCheck(regexOptions, "1.0.GA", "cafebabe0");
        assert true == agentManager.isAgentVersionSupported(agentVersionInfo).isSupported();
        agentVersionInfo = setSupportedBuildsToCheck(regexOptions, "1.0.RC1", "cafebabe1");
        assert false == agentManager.isAgentVersionSupported(agentVersionInfo).isSupported();
        agentVersionInfo = setSupportedBuildsToCheck(regexOptions, "2.0.GA", "3deg");
        assert false == agentManager.isAgentVersionSupported(agentVersionInfo).isSupported();
View Full Code Here

        check(supportedBuilds, agentBuildToCheck, false);
    }

    private void check(String supportedBuilds, String agentBuildToCheck, boolean expectedResult) {
        //Version string completely ignored in this case and only specific build identifier matters.
        AgentVersion agentVersionInfo = setSupportedBuildsToCheck(supportedBuilds, "", agentBuildToCheck);
        assert expectedResult == agentManager.isAgentVersionSupported(agentVersionInfo).isSupported() : "supportedBuilds="
            + supportedBuilds + "; agentBuildToCheck=" + agentBuildToCheck;
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.clientapi.server.core.AgentVersion

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.