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

Examples of org.rhq.core.clientapi.server.discovery.DiscoveryServerService


            if (resource != null && resource.getId() > 0) {
                if (log.isDebugEnabled()) {
                    log.debug("Resource got finally activated, cleaning out config errors: " + resource);
                }

                DiscoveryServerService serverService = configuration.getServerServices().getDiscoveryServerService();
                if (serverService != null) {
                    serverService.clearResourceConfigError(resource.getId());
                }
            }
            removeInventoryEventListener(this);
        }
View Full Code Here


            }

            // NOTE: We don't mess with inventory status - that's the server's responsibility.

            // Tell the server to merge the resource into its inventory.
            DiscoveryServerService discoveryServerService = this.configuration.getServerServices()
                .getDiscoveryServerService();
            mergeResourceResponse = discoveryServerService.addResource(resource, ownerSubjectId);

            // Sync our local resource up with the one now in server inventory. Treat this like a newlyCommittedResource
            // - set mtime (same as ctime for a new resource) to ensure this does not get picked up in an inventory sync
            //   pass, we know we're currently in sync with the server.
            resource.setId(mergeResourceResponse.getResourceId());
View Full Code Here

        Collection<ResourceTypeFlyweight> ignoredTypes;
        try {
            String reportType = (report.isRuntimeReport()) ? "runtime" : "server";
            log.info("Sending [" + reportType + "] inventory report to Server...");
            long startTime = System.currentTimeMillis();
            DiscoveryServerService discoveryServerService = configuration.getServerServices()
                .getDiscoveryServerService();
            MergeInventoryReportResults results = discoveryServerService.mergeInventoryReport(report);
            if (results != null) {
                platformSyncInfo = results.getPlatformSyncInfo();
                ignoredTypes = results.getIgnoredResourceTypes();
            } else {
                platformSyncInfo = null;
View Full Code Here

        // then sync the top level servers by calling back to the server for the sync info for each. We
        // do this one at a time to avoid forcing the whole inventory into active memory at one time during the sync.
        Collection<Integer> topLevelServerIds = platformSyncInfo.getTopLevelServerIds();
        if (null != topLevelServerIds) {
            DiscoveryServerService service = configuration.getServerServices().getDiscoveryServerService();

            for (Integer topLevelServerId : topLevelServerIds) {
                syncInfos = service.getResourceSyncInfo(topLevelServerId);
                if (null != syncInfos) {
                    addAllUuids(syncInfos, allServerSideUuids);
                    log.info("Sync Starting: Top Level Server  [" + topLevelServerId + "]");
                    boolean serverHadSyncedResources = syncResources(topLevelServerId, syncInfos);
                    log.info("Sync Complete: Top Level Server  [" + topLevelServerId + "] Local inventory changed: ["
View Full Code Here

    public void mergeResourcesFromUpgrade(Set<ResourceUpgradeRequest> upgradeRequests) throws Exception {
        Set<ResourceUpgradeResponse> serverUpdates = null;
        try {
            ServerServices serverServices = this.configuration.getServerServices();
            if (serverServices != null) {
                DiscoveryServerService discoveryServerService = serverServices.getDiscoveryServerService();

                serverUpdates = discoveryServerService.upgradeResources(upgradeRequests);
            }
        } catch (Exception e) {
            log.error("Failed to process resource upgrades on the server.", e);
            throw e;
        }
View Full Code Here

    private boolean mergeExistingResourceVersionOnServer(Resource resource, String newVersion) {
        boolean versionUpdated = false;
        ServerServices serverServices = this.configuration.getServerServices();
        if (serverServices != null) {
            try {
                DiscoveryServerService discoveryServerService = serverServices.getDiscoveryServerService();
                discoveryServerService.updateResourceVersion(resource.getId(), newVersion);
                // Only update the version in local inventory if the server sync succeeded, otherwise we won't know
                // to try again the next time this method is called.
                versionUpdated = true;
                if (log.isDebugEnabled()) {
                    log.debug("New version for [" + resource + "] (" + newVersion
View Full Code Here

            return false;
        }

        boolean errorSent = false;

        DiscoveryServerService serverService = null;
        ServerServices serverServices = this.configuration.getServerServices();
        if (serverServices != null) {
            serverService = serverServices.getDiscoveryServerService();
        }

        if (serverService != null) {
            try {
                // use light-weight proxy to Resource, so that the entire hierarchy doesn't get serialized
                resourceError.setResource(new Resource(resource.getId()));
                serverService.setResourceError(resourceError);
                errorSent = true;
            } catch (RuntimeException e) {
                log.warn("Cannot inform the Server about a Resource error [" + resourceError + "]. Cause: " + e);
            }
        }
View Full Code Here

                PluginContainerLifecycle.class);

            // Get remote pojo's for server access and make them accessible in the configuration object
            ClientRemotePojoFactory factory = m_clientSender.getClientRemotePojoFactory();
            CoreServerService coreServerService = factory.getRemotePojo(CoreServerService.class);
            DiscoveryServerService discoveryServerService = factory.getRemotePojo(DiscoveryServerService.class);
            MeasurementServerService measurementServerService = factory.getRemotePojo(MeasurementServerService.class);
            OperationServerService operationServerService = factory.getRemotePojo(OperationServerService.class);
            ConfigurationServerService configurationServerService = factory
                .getRemotePojo(ConfigurationServerService.class);
            ResourceFactoryServerService resourceFactoryServerSerfice = factory
View Full Code Here

        PluginContainerConfiguration containerConfig = new PluginContainerConfiguration();
        containerConfig.setPluginFinder(new FileSystemPluginFinder(pluginDir));
        containerConfig.setPluginDirectory(pluginDir);
        containerConfig.setInsideAgent(false);
        // netservices plugin has resources which can only be manually added so we have to mock server integration.
        DiscoveryServerService discoveryServerService = Mockito.mock(DiscoveryServerService.class);
        when(discoveryServerService.addResource(any(Resource.class), anyInt())).thenAnswer(
            new Answer<MergeResourceResponse>() {

                @Override
                public MergeResourceResponse answer(InvocationOnMock invocation) throws Throwable {
                    return new MergeResourceResponse(resourceIdGenerator.decrementAndGet(), System.currentTimeMillis(),
View Full Code Here

        PluginContainerConfiguration containerConfig = new PluginContainerConfiguration();
        containerConfig.setPluginFinder(new FileSystemPluginFinder(pluginDir));
        containerConfig.setPluginDirectory(pluginDir);
        containerConfig.setInsideAgent(false);
        // JMX plugin has resources which can only be manually added so we have to mock server integration.
        DiscoveryServerService discoveryServerService = Mockito.mock(DiscoveryServerService.class);
        when(discoveryServerService.addResource(any(Resource.class), anyInt())).thenAnswer(
            new Answer<MergeResourceResponse>() {
                @Override
                public MergeResourceResponse answer(InvocationOnMock invocation) throws Throwable {
                    return new MergeResourceResponse(resourceIdGenerator.decrementAndGet(), System.currentTimeMillis(),
                        false);
View Full Code Here

TOP

Related Classes of org.rhq.core.clientapi.server.discovery.DiscoveryServerService

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.