@Override public String toString() { return "PackageType[id=" + id + ",name=" + name + ",resourceType=" + ((resourceType != null) ? resourceType.getName() : "?") + "]"; }
public AutoGroupComposite(Double availability, Resource parentResource, ResourceType resourceType, long memberCount, boolean isDuplicateResourceTypeName) { this.availability = availability; this.parentResource = parentResource; this.resourceType = resourceType; this.memberCount = memberCount; if (isDuplicateResourceTypeName) { this.name = this.resourceType.getName() + "(" + this.resourceType.getPlugin() + " plugin)"; } else { this.name = this.resourceType.getName(); } }
@Override public List<String> getUtilizedResourceTypeNamesByCategory(Subject subject, ResourceCategory category, String nameFilter, String pluginName) { List<ResourceType> types = getUtilizeTypes_helper(subject, category, nameFilter, pluginName); List<String> typeNames = new ArrayList<String>(); for (ResourceType type : types) { if (typeNames.contains(type.getName()) == false) { typeNames.add(type.getName()); } } return typeNames; }
@Override public String toString() { return this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".") + 1) + "[" + "id=" + this.id + ", " + "resourceType.name=" + ((this.resourceType != null) ? this.resourceType.getName() : "null") + ", " + "name=" + this.name + "]"; }
private void logErrorMsgs(List<String> errorMsgs, ResourceType resourceType) { for (String errorMessage : errorMsgs) { log.warn("Plugin Error: Invalid " + resourceType.getName() + " Resource configuration returned by " + resourceType.getPlugin() + " plugin - " + errorMessage); } }
private String createErrorMsg(int resourceId, String msg) throws PluginContainerException { ResourceType resourceType = componentService.getResourceType(resourceId); return "Plugin Error: Resource Component for [" + resourceType.getName() + "] Resource with id [" + resourceId + "]: " + msg; }
private void logErrorMsgs(List<String> errorMsgs, ResourceType resourceType) { for (String errorMessage : errorMsgs) { log.warn("Plugin Error: Invalid " + resourceType.getName() + " Resource configuration returned by " + resourceType.getPlugin() + " plugin - " + errorMessage); } }
public static Map<String, Integer> getResourceTypeCountMap(List<Resource> resources) { Map<String, Integer> mapping = new HashMap<String, Integer>(); for (Resource resource : resources) { String typeName = resource.getResourceType().getName(); if (!mapping.containsKey(typeName)) { mapping.put(typeName, 1); } else { mapping.put(typeName, mapping.get(typeName) + 1); } } return mapping; } }
private boolean isStorageNodeOperation(ResourceOperationHistory operationHistory) { if (operationHistory == null) { return false; } ResourceType resourceType = operationHistory.getOperationDefinition().getResourceType(); return resourceType.getName().equals(STORAGE_NODE_TYPE_NAME) && resourceType.getPlugin().equals(STORAGE_NODE_PLUGIN_NAME); }
public static String displayName(ResourceType resourceType) { if (resourceType == null) return null; return resourceType.getDisplayName() == null ? resourceType.getName() : resourceType.getDisplayName(); }
public CreateResourceReport createResource(CreateResourceReport report) { String resourceTypeName = report.getResourceType().getName(); try { if (TomcatWarComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName)) { warCreate(report); } else { throw new UnsupportedOperationException("Unsupported Resource type: " + resourceTypeName); } } catch (Exception e) { CreateResourceHelper.setErrorOnReport(report, e); } return report; }
@Override public LinkedHashMap<Integer, String> getResourceTypeDescendantsWithOperations(Subject subject, int resourceTypeId) { List<ResourceType> types = getAllResourceTypeDescendants(subject, resourceTypeId); excludeThoseWithoutOperations(types); LinkedHashMap<Integer, String> results = new LinkedHashMap<Integer, String>(types.size()); for (ResourceType type : types) { results.put(type.getId(), type.getPlugin() + " -> " + type.getName()); } return results; }
@Nullable public ResourceType getType(ResourceType resourceType) { if (TEST_PLATFORM_TYPE.equals(resourceType)) { return TEST_PLATFORM_TYPE; } return getType(resourceType.getName(), resourceType.getPlugin()); }
@Override public String toString() { return "ResourceTypeTemplateCountComposite[ " + "type[" + "id=" + getType().getId() + ", " + "name=" + getType().getName() + "], " + ", disabledMetricCount=" + disabledMetricCount + ", enabledAlertCount=" + enabledAlertCount + ", enabledMetricCount=" + enabledMetricCount + ", pluginDriftTemplates=" + pluginDriftTemplates + ", userDriftTemplates=" + userDriftTemplates + "]"; } }
@Override @RequiredPermission(Permission.MANAGE_INVENTORY) public void setResourceTypeIgnoreFlag(Subject subject, int resourceTypeId, boolean ignoreFlag) { ResourceType resourceType = getResourceTypeById(subject, resourceTypeId); // don't bother to do anything if the type's ignore flag is already set to the value the caller wants if (resourceType.isIgnored() == ignoreFlag) { return; } log.info("Changing ignore flag to [" + ignoreFlag + "] for resource type [" + resourceType.getName() + "] with id=[" + resourceTypeId + "]"); resourceType.setIgnored(ignoreFlag); return; }
public static void setResourceName(CreateResourceReport report, String baseName) { String resourceName; if (report.getUserSpecifiedResourceName() != null) { resourceName = report.getUserSpecifiedResourceName(); } else { resourceName = report.getResourceType().getName() + " (" + baseName + ")"; } report.setResourceName(resourceName); }
protected DiscoveredResourceDetails createResourceDetails(ResourceDiscoveryContext<T> discoveryContext, Configuration pluginConfig) { ResourceType resourceType = discoveryContext.getResourceType(); String resourceKey = composeResourceKey(pluginConfig); DiscoveredResourceDetails resource = new DiscoveredResourceDetails(resourceType, resourceKey, resourceType.getName(), null, resourceType.getDescription(), pluginConfig, null); return resource; }
@Override @RequiredPermission(Permission.MANAGE_INVENTORY) public void setResourceTypeMissingPolicy(Subject subject, int resourceTypeId, MissingPolicy policy) { ResourceType resourceType = getResourceTypeById(subject, resourceTypeId); // don't bother to do anything if the type's flag is already set to the value the caller wants if (resourceType.getMissingPolicy().equals(policy)) { return; } log.info("Changing Missing policy to [" + policy.name() + "] for resource type [" + resourceType.getName() + "] with id=[" + resourceTypeId + "]"); resourceType.setMissingPolicy(policy); return; }
public MetricTemplate(MeasurementDefinition definition) { resourceTypeName = definition.getResourceType().getName(); resourceTypePlugin = definition.getResourceType().getPlugin(); metricName = definition.getName(); defaultInterval = definition.getDefaultInterval(); enabled = definition.isDefaultOn(); perMinute = definition.getRawNumericType() != null; setReferencedEntityId(definition.getId()); }
private ResourceTypeRest resourceTypeToResourceTypeRest(ResourceType type) { ResourceTypeRest rtr = new ResourceTypeRest(); rtr.setId(type.getId()); rtr.setName(type.getName()); rtr.setPluginName(type.getPlugin()); rtr.setCreatePolicy(type.getCreateDeletePolicy()); rtr.setDataType(type.getCreationDataType()); return rtr; }