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 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); } }
/** * Directory where plugins can store persisted data that survives plugin container restarts. Each plugin will have their own * data directory. The returned directory may not yet exist - it is up to each individual plugin to manage this * directory as they see fit (this includes performing the initial creation when the directory is first needed). * * @return location for plugins to store persisted data */ public File getDataDirectory() { return new File(baseDataDirectory, resource.getResourceType().getPlugin()); }
private static void addResourceTypeRepresentation(ResourceType rt, StringBuilder bld) { bld.append(rt.getName()).append(rt.getPlugin()); }
public ResourceTypeFlyweight(ResourceType rt) { this(rt.getPlugin(), rt.getName()); }
private String getResourceLongName(String resourceName, ResourceType type) { return resourceName + " [" + type.getPlugin() + ", " + type.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(); } }
public String getComponentClass(ResourceType resourceType) throws ResourceTypeNotEnabledException { if (isDisabledOrIgnoredResourceType(resourceType)) { log.debug("resource type is disabled - rejecting request for component class name: " + resourceType); throw new ResourceTypeNotEnabledException(resourceType); } PluginMetadataParser parser = this.parsersByPlugin.get(resourceType.getPlugin()); return (parser != null) ? parser.getComponentClass(resourceType) : null; }
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 String getDiscoveryClass(ResourceType resourceType) throws ResourceTypeNotEnabledException { if (isDisabledOrIgnoredResourceType(resourceType)) { log.debug("resource type is disabled - rejecting request for discovery class name: " + resourceType); throw new ResourceTypeNotEnabledException(resourceType); } PluginMetadataParser parser = this.parsersByPlugin.get(resourceType.getPlugin()); return (parser != null) ? parser.getDiscoveryComponentClass(resourceType) : null; }
public String getAmpsVersion(int resourceId) throws PluginContainerException { ResourceType resourceType = getResourceType(resourceId); return pluginManager.getAmpsVersion(resourceType.getPlugin()); }
@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; }
protected static Set<ResourceType> getResourceTypes(String pluginName) { Set<ResourceType> ret = new HashSet<ResourceType>(); PluginManager pluginManager = PluginContainer.getInstance().getPluginManager(); PluginMetadataManager pluginMetadataManager = pluginManager.getMetadataManager(); for (ResourceType res : pluginMetadataManager.getAllTypes()) { if (pluginName.equals(res.getPlugin())) { ret.add(res); } } return ret; }
private static String toConciseString(ResourceType type) { return (type != null) ? (type.getPlugin() + ":" + type.getName() + "(id=" + type.getId() + ")") : "null"; }
@Nullable public ResourceType getType(ResourceType resourceType) { if (TEST_PLATFORM_TYPE.equals(resourceType)) { return TEST_PLATFORM_TYPE; } return getType(resourceType.getName(), resourceType.getPlugin()); }
KeyTypePlugin(String key, ResourceType type) throws PluginContainerException { if (key == null) { throw new PluginContainerException("key must not be null"); } if (type == null) { throw new PluginContainerException("type must not be null"); } if (type.getName() == null) { throw new PluginContainerException("type name must not be null"); } if (type.getPlugin() == null) { throw new PluginContainerException("plugin must not be null"); } this.key = key.intern(); this.type = type.getName().intern(); this.plugin = type.getPlugin().intern(); }
public String toString() { return "[" + resourceId + "] " + resource.getName() + " (" + resource.getResourceType().getName() + "::" + resource.getResourceType().getPlugin() + ")"; }
private boolean hydrateResourceType(Resource resourceFromServer) { ResourceType fullResourceType = this.pluginManager.getMetadataManager().getType( resourceFromServer.getResourceType()); if (fullResourceType == null) { log.error(resourceFromServer + " being synced from Server has an unknown type [" + resourceFromServer.getResourceType() + "] - the [" + resourceFromServer.getResourceType().getPlugin() + "] plugin is most likely not up to date in the Agent - try updating the Agent's plugins."); return false; } resourceFromServer.setResourceType(fullResourceType); return true; }
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; }