Package org.rhq.enterprise.communications

Examples of org.rhq.enterprise.communications.ServiceContainer


        return binaryFileTypes.contains(path.substring(index + 1, path.length()));
    }

    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


            // if we ever want to change this so the server does pick up
            // persisted preferences, replace the following line with:
            // config = prepareConfigurationPreferences();
            ServerConfiguration config = reloadConfiguration();

            ServiceContainer container = (null == m_container) ? new ServiceContainer() : m_container;
            AutoDiscoveryListener listener = new ServerAutoDiscoveryListener(m_knownAgents);
            container.addDiscoveryListener(listener);

            container.start(config.getServiceContainerPreferences().getPreferences(), config
                .getClientCommandSenderConfiguration(), m_mbs);

            // now let's add our additional handler to support the remote clients (e.g. CLI)
            m_remoteApiHandler = new RemoteSafeInvocationHandler();
            m_remoteApiHandler.registerMetricsMBean(container.getMBeanServer());
            container.addInvocationHandler(REMOTE_API_SUBSYSTEM, m_remoteApiHandler);

            m_container = container;
            m_configuration = config;
            m_started = true;
        }
View Full Code Here

    }

    @Override
    public synchronized ServiceContainer safeGetServiceContainer() {
        if (null == m_container) {
            m_container = new ServiceContainer();
        }

        return m_container;
    }
View Full Code Here

     * @return the input stream wrapped in the object that provides the remoting capabilities
     *
     * @throws Exception if ununable to make the given input stream remotely accessible for some reason
     */
    public static RemoteInputStream remoteInputStream(InputStream in) throws Exception {
        ServiceContainer sc = getService().getServiceContainer();
        return new RemoteInputStream(in, sc);
    }
View Full Code Here

     * @return the output stream wrapped in the object that provides the remoting capabilities
     *
     * @throws Exception if ununable to make the given output stream remotely accessible for some reason
     */
    public static RemoteOutputStream remoteInputStream(OutputStream out) throws Exception {
        ServiceContainer sc = getService().getServiceContainer();
        return new RemoteOutputStream(out, sc);
    }
View Full Code Here

            // the sender has started, which means we might have discovered the server and it is up
            // no need to listen for more commands
            synchronized (this) {
                this.senderListeningTo = null;

                ServiceContainer commServices = getServiceContainer(); // so we don't worry about synchronizing
                if (commServices != null) {
                    commServices.removeCommandListener(this);
                }
            }

            return true; // keep listening in case we stop and start again
        }
View Full Code Here

            // add ourselves as a command listener - if we here from the server, we'll start the sender again
            synchronized (this) {
                if (this.senderListeningTo == null) {
                    this.senderListeningTo = sender;

                    ServiceContainer commServices = getServiceContainer(); // so we don't worry about synchronizing
                    if (commServices != null) {
                        commServices.addCommandListener(this);
                    }
                }
            }

            return true; // keep listening in case we start and stop again
View Full Code Here

        // do this before we create our auto-discovery listener and start the server-side services
        // since it will be needed by the listener very quickly if the server is already online
        m_clientSender = createClientCommandSender();

        // this is our server-side container that will manage our connector, network register and other services
        m_commServices = new ServiceContainer();

        // this listener will enable the agent to complete the setup of the security token preprocessor
        m_commServices.addServiceContainerSenderCreationListener(new SenderCreationListener());

        // add the command listener that was passed to us
View Full Code Here

        LOG.debug(AgentI18NResourceKeys.REMOTING_NEW_AGENT_SERVICE, agent_service.getClass().getName(), agent_service
            .getClientInterface().getName());

        try {
            // make sure our agent is up and running; if it is shutdown, comm_services will be null
            ServiceContainer comm_services = m_agent.getServiceContainer();

            if (comm_services != null) {
                comm_services.addRemotePojo(agent_service, agent_service.getClientInterface());
            } else {
                throw new IllegalStateException(); // the agent is shutdown; we should never have been called
            }
        } catch (Exception e) {
            LOG.error(e, AgentI18NResourceKeys.ERROR_REMOTING_NEW_AGENT_SERVICE, agent_service.getClass().getName(),
View Full Code Here

        LOG.debug(AgentI18NResourceKeys.UNREMOTING_AGENT_SERVICE, agent_service.getClass().getName(), agent_service
            .getClientInterface().getName());

        // comm_services will be null if the agent has already shutdown the comm infrastructure;
        // if null, then all services that were remoted are already unremoted and we don't have to do anything
        ServiceContainer comm_services = m_agent.getServiceContainer();

        if (comm_services != null) {
            comm_services.removeRemotePojo(agent_service.getClientInterface());
        }

        return;
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.communications.ServiceContainer

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.