Examples of ClientCommandSender


Examples of org.rhq.enterprise.communications.command.client.ClientCommandSender

     * @throws FileNotFoundException
     */
    private void downloadFromServer(AgentMain agent, PrintWriter out, String file_to_download, File storage_dir)
        throws FileNotFoundException {
        // make sure our agent is currently in communications with the server
        ClientCommandSender sender = agent.getClientCommandSender();
        if (sender == null) {
            out.println(MSG.getMsg(AgentI18NResourceKeys.DOWNLOAD_ERROR_NOT_SENDING, file_to_download));
        } else {
            // now let's ask the server for the file's stream
            ClientRemotePojoFactory factory = sender.getClientRemotePojoFactory();
            CoreServerService server = factory.getRemotePojo(CoreServerService.class);
            InputStream in = server.getFileContents(file_to_download);
            downloadStream(out, storage_dir, file_to_download, in);
        }
    }
View Full Code Here

Examples of org.rhq.enterprise.communications.command.client.ClientCommandSender

            }

            guaranteed = ClientRemotePojoFactory.GuaranteedDelivery.YES;
        }

        ClientCommandSender sender = agent.getClientCommandSender();

        if (sender != null) {
            if (numberOfTimes == 1) {
                // if executing it just one time, then do so synchronously
                Ping ping = sender.getClientRemotePojoFactory().getRemotePojo(Ping.class);
                agent.getOut().println(MSG.getMsg(AgentI18NResourceKeys.PING_PINGING));
                String ping_results = ping.ping("PING", "Ack: ");
                agent.getOut().println(MSG.getMsg(AgentI18NResourceKeys.PING_PING_RESULTS, ping_results));
            } else {
                ClientRemotePojoFactory factory = sender.getClientRemotePojoFactory();
                factory.setDeliveryGuaranteed(guaranteed);
                factory.setAsynch(true, new Callback(agent));

                Ping ping = factory.getRemotePojo(Ping.class);
View Full Code Here

Examples of org.rhq.enterprise.communications.command.client.ClientCommandSender

        boolean recyclePC = agent.isPluginContainerStarted();

        PrintWriter out = agent.getOut();

        // make sure our agent is currently in communications with the server
        ClientCommandSender clientCommandSender = agent.getClientCommandSender();
        if (clientCommandSender == null || !clientCommandSender.isSending()) {
            out.println(MSG.getMsg(AgentI18NResourceKeys.PLUGINS_ERROR_NOT_SENDING));
            return;
        }

        // use the PC prompt command to stop the PC - needed because the PC cannot hot-deploy plugins
View Full Code Here

Examples of org.rhq.enterprise.communications.command.client.ClientCommandSender

     * @param  agent
     *
     * @return plugin updater
     */
    private PluginUpdate getPluginUpdateObject(AgentMain agent) {
        ClientCommandSender sender = agent.getClientCommandSender();
        CoreServerService server = null;

        if (sender != null) {
            ClientRemotePojoFactory factory = sender.getClientRemotePojoFactory();
            server = factory.getRemotePojo(CoreServerService.class);
        }

        PluginContainerConfiguration pc_config = agent.getConfiguration().getPluginContainerConfiguration();
        PluginUpdate plugin_update = new PluginUpdate(server, pc_config);
View Full Code Here

Examples of org.rhq.enterprise.communications.command.client.ClientCommandSender

    private void syncInventory(AgentMain agent, PrintWriter out) {
        // if the PC is already started, we need to shut it down and restart it after we get the new plugins
        boolean recyclePC = agent.isPluginContainerStarted();

        // make sure our agent is currently in communications with the server
        ClientCommandSender clientCommandSender = agent.getClientCommandSender();
        if (clientCommandSender == null || !clientCommandSender.isSending()) {
            out.println(MSG.getMsg(AgentI18NResourceKeys.INVENTORY_ERROR_NOT_SENDING));
            return;
        }

        // use the PC prompt command to stop the PC - needed because the PC cannot hot-deploy plugins
View Full Code Here

Examples of org.rhq.enterprise.communications.command.client.ClientCommandSender

     * Returns the client-side metrics from the agent's sender.
     *
     * @return client side metrics
     */
    private ClientCommandSenderMetrics getClientSideMetrics() {
        ClientCommandSender sender = m_agent.getClientCommandSender();
        ClientCommandSenderMetrics metrics;

        if (sender != null) {
            metrics = sender.getMetrics();
        } else {
            metrics = new ClientCommandSenderMetrics(); // simulate an empty and idle sender (all metrics are zeroed out)
        }

        return metrics;
View Full Code Here

Examples of org.rhq.enterprise.communications.command.client.ClientCommandSender

     * Builds a {@link PluginUpdate} object that can be used to update the plugins or get information about the plugins.
     *
     * @return plugin updater
     */
    private PluginUpdate getPluginUpdateObject() {
        ClientCommandSender sender = m_agent.getClientCommandSender();
        CoreServerService server = null;

        if (sender != null) {
            ClientRemotePojoFactory factory = sender.getClientRemotePojoFactory();
            server = factory.getRemotePojo(CoreServerService.class);
        }

        PluginContainerConfiguration pc_config = m_agent.getConfiguration().getPluginContainerConfiguration();
        PluginUpdate plugin_update = new PluginUpdate(server, pc_config);
View Full Code Here

Examples of org.rhq.enterprise.communications.command.client.ClientCommandSender

    static InputStream remoteStream(InputStream stream) {
        RemoteInputStream remoteStream = (RemoteInputStream) stream;
        ServiceContainer serviceContainer = ServerCommunicationsServiceUtil.getService().getServiceContainer();
        ClientCommandSenderConfiguration config = serviceContainer.getClientConfiguration();
        ClientCommandSender sender = serviceContainer.createClientCommandSender(remoteStream.getServerEndpoint(),
            config);
        sender.startSending();
        remoteStream.setClientCommandSender(sender);

        return stream;
    }
View Full Code Here

Examples of org.rhq.enterprise.communications.command.client.ClientCommandSender

                        remote_uri = "socket://" + agent_address + ":" + agent_port;
                    }
                }

                ClientCommandSenderConfiguration client_config = getSenderConfiguration(agent);
                ClientCommandSender sender = getServiceContainer().createClientCommandSender(remote_uri, client_config);
                agent_client = new AgentClientImpl(agent, sender);

                // add the new cache entry, or replace the dirty cache entry (note that dirty cache entries don't
                // need to be destroyed as the new one is "logically" the same, but with updated auth info.)
                m_knownAgentClients.put(getEndpointKey(agent_address, agent_port), agent_client);
View Full Code Here

Examples of org.rhq.enterprise.communications.command.client.ClientCommandSender

        return;
    }

    @Override
    public boolean pingEndpoint(String endpoint, long timeoutMillis) {
        ClientCommandSender sender = null;
        boolean pinged = false;

        try {
            ServerConfiguration server_config = getConfiguration();
            ClientCommandSenderConfiguration client_config = server_config.getClientCommandSenderConfiguration();

            // prepare this sender to simply send a ping - do not need any advanced features
            client_config.commandSpoolFileName = null;
            client_config.enableQueueThrottling = false;
            client_config.enableSendThrottling = false;
            client_config.serverPollingIntervalMillis = -1;

            sender = getServiceContainer().createClientCommandSender(endpoint, client_config);
            sender.startSending();

            // create our own factory so we can customize the timeout
            ClientRemotePojoFactory factory = sender.getClientRemotePojoFactory();
            factory.setTimeout(timeoutMillis);
            Ping pinger = factory.getRemotePojo(Ping.class);
            pinger.ping("", null);
            return true;
        } catch (Exception e) {
            LOG.debug(ServerI18NResourceKeys.PING_FAILED, endpoint, ThrowableUtil.getAllMessages(e, true));
            pinged = false;
        } finally {
            if (sender != null) {
                sender.stopSending(false);
            }
        }

        return pinged;
    }
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.