Examples of AgentClient


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

                bundleManager.addBundleResourceDeploymentHistoryInNewTrans(subjectManager.getOverlord(),
                    resourceDeploy.getId(), history);

                // get a connection to the agent and tell it to purge the bundle from the file system
                Subject overlord = subjectManager.getOverlord();
                AgentClient agentClient = agentManager.getAgentClient(overlord, resourceDeploy.getResource().getId());
                BundleAgentService bundleAgentService = agentClient.getBundleAgentService();
                BundlePurgeRequest request = new BundlePurgeRequest(resourceDeploy);
                BundlePurgeResponse results = bundleAgentService.purge(request);
                if (!results.isSuccess()) {
                    String errorMessage = results.getErrorMessage();
                    failedToPurge.put(resourceDeploy, errorMessage);
View Full Code Here

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

    private BundleResourceDeployment scheduleBundleResourceDeployment(Subject subject, BundleDeployment deployment,
        Resource bundleTarget, boolean isCleanDeployment, boolean isRevert) throws Exception {

        int bundleTargetResourceId = bundleTarget.getId();
        AgentClient agentClient = agentManager.getAgentClient(subjectManager.getOverlord(), bundleTargetResourceId);
        BundleAgentService bundleAgentService = agentClient.getBundleAgentService();

        // The BundleResourceDeployment record must exist in the db before the agent request because the agent may try
        // to add History to it during immediate deployments. So, create and persist it (requires a new trans).
        BundleResourceDeployment resourceDeployment = bundleManager.createBundleResourceDeploymentInNewTrans(
            subjectManager.getOverlord(), deployment.getId(), bundleTargetResourceId);
View Full Code Here

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

     */
    public void updateAgentInventoryStatus(List<Resource> platforms, List<Resource> servers) {
        ResourceSyncInfo syncInfo;

        for (Resource platform : platforms) {
            AgentClient agentClient = agentManager.getAgentClient(platform.getAgent());
            if (agentClient != null) {
                try {
                    //syncInfo = entityManager.find(ResourceSyncInfo.class, platform.getId());
                    PlatformSyncInfo platformSyncInfo = getPlatformSyncInfo(platform.getAgent());
                    agentClient.getDiscoveryAgentService().synchronizePlatform(platformSyncInfo);
                } catch (Exception e) {
                    LOG.warn("Could not perform commit synchronization with agent for platform [" + platform.getName()
                        + "]", e);
                }
            } else {
                LOG.warn("Could not perform commit sync with agent for platform [" + platform.getName()
                    + "]; will expect agent to do it later");
            }
        }
        for (Resource server : servers) {
            // Only update servers if they haven't already been updated at the platform level
            if (!platforms.contains(server.getParentResource())) {
                AgentClient agentClient = agentManager.getAgentClient(server.getAgent());
                if (agentClient != null) {
                    try {
                        //syncInfo = entityManager.find(ResourceSyncInfo.class, server.getId());
                        Collection<ResourceSyncInfo> syncInfos = getResourceSyncInfo(server.getId());
                        agentClient.getDiscoveryAgentService().synchronizeServer(server.getId(), syncInfos);
                    } catch (Exception e) {
                        LOG.warn("Could not perform commit synchronization with agent for server [" + server.getName()
                            + "]", e);
                    }
                } else {
View Full Code Here

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

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

        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

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

        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

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

     * 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

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

    @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

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

        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

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

        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
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.