Package org.rhq.enterprise.server.agentclient

Examples of org.rhq.enterprise.server.agentclient.AgentClient


        abortResourceManualAddIfExistingSingleton(parentResource, resourceType);

        MergeResourceResponse mergeResourceResponse;
        try {
            AgentClient agentClient = this.agentManager.getAgentClient(parentResource.getAgent());
            DiscoveryAgentService discoveryAgentService = agentClient.getDiscoveryAgentService();
            mergeResourceResponse = discoveryAgentService.manuallyAddResource(resourceType, parentResourceId,
                importResourceRequest.getPluginConfiguration(), subject.getId());
        } catch (CannotConnectException e) {
            throw new CannotConnectToAgentException("Error adding [" + resourceType + "] Resource to inventory as "
                + "a child of " + parentResource + " - cause: " + e.getMessage(), e);
View Full Code Here


        ConfigurationUpdateResponse response = null;

        try {
            // now let's tell the agent to actually update the resource component's plugin configuration
            AgentClient agentClient = this.agentManager.getAgentClient(resource.getAgent());

            agentClient.getDiscoveryAgentService().updatePluginConfiguration(resource.getId(), configuration);
            try {
                agentClient.getDiscoveryAgentService().executeServiceScanDeferred(resource.getId());
            } catch (Exception e) {
                LOG.warn("Failed to execute service scan - cannot detect children of the newly connected resource ["
                    + resource + "]", e);
            }
View Full Code Here

        if (!authorizationManager.canViewResource(subject, resource.getId())) {
            throw new PermissionException("User [" + subject.getName()
                + "] does not have permission to view resource configuration for [" + resource + "]");
        }
        Agent agent = resource.getAgent();
        AgentClient agentClient = this.agentManager.getAgentClient(agent);
        ConfigurationAgentService configService = agentClient.getConfigurationAgentService();
        return configService.validate(configuration, resourceId, isStructured);
    }
View Full Code Here

     * Tells the Agent to asynchronously update a managed resource's configuration as per the specified
     * <code>ResourceConfigurationUpdate</code>.
     */
    private void executeResourceConfigurationUpdate(ResourceConfigurationUpdate update) {
        try {
            AgentClient agentClient = agentManager.getAgentClient(update.getResource().getAgent());
            ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(update.getId(),
                update.getConfiguration(), update.getResource().getId());
            agentClient.getConfigurationAgentService().updateResourceConfiguration(request);
        } catch (RuntimeException e) {
            // Any exception means the remote call itself failed - make sure to change the status on the update to FAILURE
            // and set its error message field.
            if (null != update) {
                update.setStatus(ConfigurationUpdateStatus.FAILURE);
View Full Code Here

    @RequiredPermission(Permission.MANAGE_INVENTORY)
    public InputStream getSnapshotReportStream(Subject subject, int resourceId, String name, String description)
        throws Exception {

        AgentClient agentClient = this.agentManager.getAgentClient(subjectManager.getOverlord(), resourceId);
        SupportAgentService supportService = agentClient.getSupportAgentService();
        InputStream snapshotStream = supportService.getSnapshotReport(resourceId, name, description);

        return snapshotStream;
    }
View Full Code Here

        CreateResourceRequest request = new CreateResourceRequest(persistedHistory.getId(), parentResourceId,
            resourceName, resourceType.getName(), resourceType.getPlugin(), pluginConfiguration, resourceConfiguration,
            timeout);

        try {
            AgentClient agentClient = agentManager.getAgentClient(agent);
            ResourceFactoryAgentService resourceFactoryAgentService = agentClient.getResourceFactoryAgentService();
            resourceFactoryAgentService.createResource(request);

            return persistedHistory;
        } catch (Exception e) {
            LOG.error("Error while sending create resource request to agent service", e);
View Full Code Here

        CreateResourceRequest request = new CreateResourceRequest(persistedHistory.getId(), parentResource.getId(),
            newResourceName, newResourceType.getName(), newResourceType.getPlugin(), pluginConfiguration,
            packageDetails, timeout);

        try {
            AgentClient agentClient = agentManager.getAgentClient(agent);
            ResourceFactoryAgentService resourceFactoryAgentService = agentClient.getResourceFactoryAgentService();
            resourceFactoryAgentService.createResource(request);

            return persistedHistory;
        } catch (NoResultException nre) {
            return null;
View Full Code Here

        // Package into transfer object
        DeleteResourceRequest request = new DeleteResourceRequest(persistedHistory.getId(), resourceId);

        try {
            AgentClient agentClient = agentManager.getAgentClient(agent);
            ResourceFactoryAgentService resourceFactoryAgentService = agentClient.getResourceFactoryAgentService();
            resourceFactoryAgentService.deleteResource(request);

            return persistedHistory;
        } catch (CannotConnectException e) {
            LOG.error("Error while sending delete resource request to agent service", e);
View Full Code Here

        return agent;
    }

    @ExcludeDefaultInterceptors
    public AgentClient getAgentClient(Agent agent) {
        AgentClient client = null;

        try {
            ServerCommunicationsServiceMBean bootstrap = ServerCommunicationsServiceUtil.getService();
            client = bootstrap.getKnownAgentClient(agent);

            if (client != null) {
                // We assume the caller is asking for a client so it can send the agent messages,
                // so let's start the sender automatically for the caller so it doesn't need to remember to do it
                client.startSending();
            } else {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("There is no agent client for agent: " + agent);
                }
            }
View Full Code Here

        try {
            //insert call to method doing logged in check and view resources perm check as method calld from GWT*Service
            agent = getAgentByResourceId(subject, resourceId);

            //now ping
            AgentClient client = getAgentClient(agent);
            pingResults = client.pingService(5000L);

        } catch (NoResultException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Failed to lookup agent for resource with ID of [" + resourceId + "] : " + e);
            }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.agentclient.AgentClient

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.