Examples of BundleType


Examples of org.rhq.core.domain.bundle.BundleType

        ResourceType resourceType = entityManager.find(ResourceType.class, resourceTypeId);
        if (null == resourceType) {
            throw new IllegalArgumentException("Invalid resourceeTypeId: " + resourceTypeId);
        }

        BundleType bundleType = new BundleType(name, resourceType);
        entityManager.persist(bundleType);
        return bundleType;
    }
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

        }

        checkCreateBundleVersionAuthz(subject, bundle.getId());

        // parse the recipe (validation occurs here) and get the config def and list of files
        BundleType bundleType = bundle.getBundleType();
        RecipeParseResults results;

        try {
            results = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
                .parseRecipe(bundleType.getName(), recipe);
        } catch (Exception e) {
            // ensure that we throw a runtime exception to force a rollback
            throw new RuntimeException("Failed to parse recipe", e);
        }
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

        }

        checkCreateBundleVersionAuthz(subject, bundleId);

        // parse the recipe (validation occurs here) and get the config def and list of files
        BundleType bundleType = bundle.getBundleType();
        RecipeParseResults results;

        try {
            results = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
                .parseRecipe(bundleType.getName(), recipe);
        } catch (Exception e) {
            // ensure that we throw a runtime exception to force a rollback
            throw new RuntimeException("Failed to parse recipe", e);
        }
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

        if (info.getBundleFiles() == null && info.getRecipeParseResults().getBundleFileNames() == null) {
            throw new IllegalArgumentException("Cannot create a bundle version without files determined by the recipe" +
                " or provided explicitly during bundle version creation.");
        }

        BundleType bundleType = bundleManager.getBundleType(subject, info.getBundleTypeName());
        String bundleName = info.getRecipeParseResults().getBundleMetadata().getBundleName();
        String bundleDescription = info.getRecipeParseResults().getBundleMetadata().getDescription();
        String name = bundleName;
        String description = bundleDescription;
        String version = info.getRecipeParseResults().getBundleMetadata().getBundleVersion();
        String recipe = info.getRecipe();

        // first see if the bundle exists or not
        boolean createdBundle;
        BundleCriteria criteria = new BundleCriteria();
        criteria.setStrict(true);
        criteria.addFilterBundleTypeId(bundleType.getId());
        criteria.addFilterName(bundleName);

        PageList<Bundle> bundles = bundleManager.findBundlesByCriteria(subject, criteria);
        Bundle bundle;
        boolean isInitialVersion = (bundles.getTotalSize() == 0);

        if (!isInitialVersion && mustBeInitialVersion) {
            throw new PermissionException("This must be the initial version of a new Bundle.");
        }

        if (isInitialVersion) {
            bundle = bundleManager.createBundle(subject, bundleName, bundleDescription, bundleType.getId(),
                initialBundleGroupIds);
            createdBundle = true;
        } else {
            bundle = bundles.get(0);
            checkCreateBundleVersionAuthz(subject, bundle.getId());
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

        Set<String> result = null;

        //new in 4.13 - we no longer throw an exception on failure to parse
        try {
            // parse the recipe (validation occurs here) and get the config def and list of files
            BundleType bundleType = bundleVersion.getBundle().getBundleType();
            RecipeParseResults parseResults = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
                .parseRecipe(bundleType.getName(), bundleVersion.getRecipe());

            result = parseResults.getBundleFileNames();
        } catch (Exception e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Failed to parse the recipe of bundle version " + bundleVersionId
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

        log.debug("Updating bundle type and package types for " + existingType);

        existingType = entityMgr.find(ResourceType.class, existingType.getId());

        // set the bundle type if one is defined
        BundleType newBundleType = newType.getBundleType();

        if (newBundleType != null) {
            BundleType existingBundleType = existingType.getBundleType();

            Set<ResourceType> targetedResourceTypes = new HashSet<ResourceType>(
                newBundleType.getExplicitlyTargetedResourceTypes().size());

            if (!newBundleType.getExplicitlyTargetedResourceTypes().isEmpty()) {
                for (ResourceType targetType : newBundleType.getExplicitlyTargetedResourceTypes()) {
                    ResourceType existingTargetType = resourceTypeMgr
                        .getResourceTypeByNameAndPlugin(targetType.getName(), targetType.getPlugin());

                    if (existingTargetType == null) {
                        throw new IllegalStateException(
                            "Cannot find a resource type explicitly targeted by bundle type " + newBundleType +
                                ". This should not happen because such type should always be persisted prior to the bundle type.");
                    }

                    targetedResourceTypes.add(existingTargetType);
                }
            }

            // If bundleType is not null then this in a bundle plugin and we do not need to do any further
            // processing because a bundle plugin cannot define any other content.

            // Also note that ANY changes to the newBundleType need to be made in here and NOT in the code
            // above. This is because the above code can query the database during which the changes might
            // be flushed to the DB (if at least 1 of those changes involved associating the new bundle type
            // with an entity from the persistence context.
            if (existingBundleType != null) {
                newBundleType.setId(existingBundleType.getId());
            }

            newBundleType.setResourceType(existingType);
            newBundleType.getExplicitlyTargetedResourceTypes().clear();
            newBundleType.getExplicitlyTargetedResourceTypes().addAll(targetedResourceTypes);
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

            throw new RuntimeException("Failed to delete bundles for " + resourceType, e);
        }
    }

    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) {
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

        try {
            final BundleResourceDeployment resourceDeployment = request.getBundleResourceDeployment();
            final BundleDeployment bundleDeployment = resourceDeployment.getBundleDeployment();

            // find the resource that will handle the bundle processing
            BundleType bundleType = bundleDeployment.getBundleVersion().getBundle().getBundleType();
            ResourceType resourceType = bundleType.getResourceType();
            Set<Resource> resources = inventoryManager.getResourcesWithType(resourceType);
            if (resources.isEmpty()) {
                throw new Exception("No bundle plugin supports bundle type [" + bundleType + "]");
            }
            final int bundleHandlerResourceId = resources.iterator().next().getId();
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

        try {
            final BundleResourceDeployment resourceDeployment = request.getLiveBundleResourceDeployment();
            final BundleDeployment bundleDeployment = resourceDeployment.getBundleDeployment();

            // find the resource that will purge the bundle
            BundleType bundleType = bundleDeployment.getBundleVersion().getBundle().getBundleType();
            ResourceType resourceType = bundleType.getResourceType();
            Set<Resource> resources = inventoryManager.getResourcesWithType(resourceType);
            if (resources.isEmpty()) {
                throw new Exception("No bundle plugin supports bundle type [" + bundleType + "]");
            }
            final int bundleHandlerResourceId = resources.iterator().next().getId();
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

        pcConfig = null;
    }

    public void testNonPlatformBundleDeploy_FileSystem_AbsolutePath() throws Exception {

        BundleType bundleType = new BundleType("bundleTypeName", im.bundleHandlerType);
        Bundle bundle = new Bundle("bundleName", bundleType, null, null);
        BundleVersion bundleVersion = new BundleVersion("bundleVersionName", "1.0", bundle, "");
        BundleDestination destination = new BundleDestination(bundle, "destName", null,
            MockInventoryManager.BUNDLE_CONFIG_NAME_FS, getPath("/tmp/dest")); // ABSOLUTE PATH
        BundleDeployment bundleDeployment = new BundleDeployment(bundleVersion, destination, "deploymentName");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.