private List<ProcessScanResult> performProcessScans(List<ProcessInfo> processInfos, ResourceType serverType) { if (processInfos == null || processInfos.isEmpty()) return Collections.emptyList(); List<ProcessScanResult> scanResults = new ArrayList<ProcessScanResult>(); Set<ProcessScan> processScans = serverType.getProcessScans(); if (processScans != null && !processScans.isEmpty()) { log.debug("Executing process scans for server type " + serverType + "..."); ProcessInfoQuery piq = new ProcessInfoQuery(processInfos); for (ProcessScan processScan : processScans) { List<ProcessInfo> queryResults = piq.query(processScan.getQuery()); if ((queryResults != null) && (queryResults.size() > 0)) { for (ProcessInfo autoDiscoveredProcess : queryResults) { scanResults.add(new ProcessScanResult(processScan, autoDiscoveredProcess)); if (log.isDebugEnabled()) { log.debug("Process scan auto-detected potential new server Resource: scan=[" + processScan + "], discovered-process=[" + autoDiscoveredProcess + "]"); } } } } } return scanResults; }
private ResourceType parsePlatformDescriptor(PlatformDescriptor platformDescriptor) throws InvalidPluginDescriptorException { ResourceType platformResourceType = new ResourceType(platformDescriptor.getName(), pluginDescriptor.getName(), ResourceCategory.PLATFORM, null); platformResourceType.setDescription(platformDescriptor.getDescription()); platformResourceType.setDisplayName(platformDescriptor.getDisplayName()); LOG.debug("Parsed platform resource type: " + platformResourceType); parseResourceDescriptor(platformDescriptor, platformResourceType, null, null, null); if ((platformResourceType.getProcessScans() != null) && (platformResourceType.getProcessScans().size() > 0)) { LOG.warn("Platforms are not auto-discovered via process scans. " + "The <process-scan> elements will be ignored in resource type: " + platformResourceType); } RunsInsideType runsInside = platformDescriptor.getRunsInside(); if (runsInside != null) { LOG.warn("Platforms do not currently support running inside other resources. " + "The <runs-inside> information will be ignored in resource type: " + platformResourceType); } platformResourceType.setCreateDeletePolicy(CreateDeletePolicy.NEITHER); return platformResourceType; }
/** * Update the set of process scans for a given resource type * * @param resourceType * @param existingType */ private void updateProcessScans(ResourceType resourceType, ResourceType existingType) { Set<ProcessScan> existingScans = existingType.getProcessScans(); Set<ProcessScan> newScans = resourceType.getProcessScans(); Set<ProcessScan> scansToPersist = CollectionsUtil.missingInFirstSet(existingScans, newScans); Set<ProcessScan> scansToDelete = CollectionsUtil.missingInFirstSet(newScans, existingScans); Set<ProcessScan> scansToUpdate = CollectionsUtil.intersection(existingScans, newScans); // update scans that may have changed for (ProcessScan scan : scansToUpdate) { for (ProcessScan nScan : newScans) { if (scan.equals(nScan)) { scan.setName(nScan.getName()); } } } // persist new scans for (ProcessScan scan : scansToPersist) { existingType.addProcessScan(scan); } // remove deleted ones for (ProcessScan scan : scansToDelete) { existingScans.remove(scan); entityManager.remove(scan); } }
if (resourceType.getProcessScans() != null) { for (ProcessScan processScan : resourceType.getProcessScans()) { exportWriter.printf("%s <process-scans>%s</process-scans>\n", indent, processScan);
Set<ProcessScan> processScans = this.resource.getResourceType().getProcessScans(); if (processScans != null && !processScans.isEmpty()) { ProcessInfoQuery piq = new ProcessInfoQuery(systemInfo.getAllProcesses());
LOG.debug("Parsed service Resource type: " + serviceResourceType); if ((serviceResourceType.getProcessScans() != null) && (serviceResourceType.getProcessScans().size() > 0)) { LOG.warn("Child services are not auto-discovered via process scans. " + "The <process-scan> elements will be ignored in resource type: " + serviceResourceType);