private void persistNewType(ResourceType resourceType) { log.info("Persisting new ResourceType [" + toConciseString(resourceType) + "]..."); // If the type didn't exist then we'll persist here which will cascade through // all child types as well as plugin and resource configs and their delegate types and // metric and operation definitions and their dependent types, // but first do some validity checking. // Ensure that the new type has any built-in metrics (like Availability Type) MeasurementMetadataManagerBean.getMetricDefinitions(resourceType); //Ensure any explicitly targeted resource types of a bundle type are refreshed with their //persisted counterparts (which should have been persisted before persisting the type //due to the dependency graph ordering) if (resourceType.getBundleType() != null && !resourceType.getBundleType().getExplicitlyTargetedResourceTypes().isEmpty()) { Set<ResourceType> existingTypes = new HashSet<ResourceType>( resourceType.getBundleType().getExplicitlyTargetedResourceTypes().size()); for (ResourceType targetedType : resourceType.getBundleType().getExplicitlyTargetedResourceTypes()) { ResourceType existingType = resourceTypeManager.getResourceTypeByNameAndPlugin(targetedType.getName(), targetedType.getPlugin()); existingTypes.add(existingType); } resourceType.getBundleType().getExplicitlyTargetedResourceTypes().clear(); resourceType.getBundleType().getExplicitlyTargetedResourceTypes().addAll(existingTypes); } entityManager.merge(resourceType); }
private void parseBundleTypeTarget(List<? extends ResourceDescriptor> resourceTypes) { for (ResourceDescriptor d : resourceTypes) { if (d.getBundle() != null) { ResourceType rt = getResourceTypeFromPlugin(d.getName(), pluginDescriptor.getName()); BundleType bt = rt.getBundleType(); parseBundleTypeTarget(bt, d.getBundle().getTargets()); } } }
BundleType newBundleType = newType.getBundleType(); BundleType existingBundleType = existingType.getBundleType();
private void deleteBundles(final Subject subject, ResourceType resourceType) throws Exception { BundleType bundleType = resourceType.getBundleType(); if (bundleType == null) { return; } BundleCriteria criteria = new BundleCriteria(); criteria.addFilterBundleTypeId(bundleType.getId()); //Use CriteriaQuery to automatically chunk/page through criteria query results CriteriaQueryExecutor<Bundle, BundleCriteria> queryExecutor = new CriteriaQueryExecutor<Bundle, BundleCriteria>() { @Override public PageList<Bundle> execute(BundleCriteria criteria) { return bundleMgr.findBundlesByCriteria(subject, criteria); } }; CriteriaQuery<Bundle, BundleCriteria> bundles = new CriteriaQuery<Bundle, BundleCriteria>(criteria, queryExecutor); for (Bundle bundle : bundles) { bundleMgr.deleteBundle(subject, bundle.getId()); } }
+ "] does not support the operations facet but defines operations."); if (resourceType.getBundleType() != null && !BundleFacet.class.isAssignableFrom(componentClazz)) { success = false; errorLog("Component class [" + componentClass + "] for resource type [" + resourceType.getName()