Package org.rhq.core.domain.bundle

Examples of org.rhq.core.domain.bundle.ResourceTypeBundleConfiguration$BundleDestinationSpecification


        // are types that support bundles, we only allow someone to traverse the relationship from group to type
        // if that someone has access to the group.
        if (authorizationManager.canViewGroup(subject, compatGroupId)) {
            Query q = entityManager.createNamedQuery(ResourceType.QUERY_GET_BUNDLE_CONFIG_BY_GROUP_ID);
            q.setParameter("groupId", compatGroupId);
            ResourceTypeBundleConfiguration bundleConfig = null;
            try {
                Configuration config = (Configuration) q.getSingleResult();
                if (config != null) {
                    bundleConfig = new ResourceTypeBundleConfiguration(config);
                }
            } catch (EntityNotFoundException enfe) {
                // ignore this - this is just a group that isn't a compatible group
                // or it is, but its type cannot be a target for bundle deployments
            }
View Full Code Here


        }

        // check that the destination specification is compatible with the bundle type
        String bundleType = bundle.getBundleType().getName();
        ResourceType rt = group.getResourceType();
        ResourceTypeBundleConfiguration bundleConfig = rt.getResourceTypeBundleConfiguration();
        boolean found = false;
        for (ResourceTypeBundleConfiguration.BundleDestinationSpecification spec : bundleConfig
            .getAcceptableBundleDestinationSpecifications(bundleType)) {

            if (destinationSpecification.equals(spec.getName())) {
                found = true;
                break;
View Full Code Here

            }
            existingType.setBundleType(null);
        }

        // set the bundle configuration if the new type is a potential bundle deployment target
        ResourceTypeBundleConfiguration newBundleConfiguration = newType.getResourceTypeBundleConfiguration();
        ResourceTypeBundleConfiguration existingBundleConfiguration = existingType.getResourceTypeBundleConfiguration();
        if (newBundleConfiguration != null) {
            if (existingBundleConfiguration == null) {
                // the new type has now become a bundle target where the old type was not
                existingType.setResourceTypeBundleConfiguration(newBundleConfiguration);
            } else {
                // the old type was already a bundle target, we need to merge the new bundle config with the existing old one
                if (!existingBundleConfiguration.equals(newBundleConfiguration)) {
                    entityMgr.remove(existingBundleConfiguration.getBundleConfiguration());
                    entityMgr.persist(newBundleConfiguration.getBundleConfiguration());
                    existingType.setResourceTypeBundleConfiguration(newBundleConfiguration);
                }
            }
        } else {
            if (existingBundleConfiguration != null) {
                if (log.isDebugEnabled()) {
                    log.debug("Removing bundle configuration");
                }
                entityMgr.remove(existingBundleConfiguration.getBundleConfiguration());
                existingType.setResourceTypeBundleConfiguration(null);
            }
        }

        // Easy case: If there are no package definitions in the new type, null out any in the existing and return
View Full Code Here

        ResourceContainer container = inventoryManager.getResourceContainer(resource);
        resource = container.getResource();

        // find out the type of base location that is specified by the bundle destination
        BundleDestinationBaseDirectory bundleDestBaseDir = null;
        ResourceTypeBundleConfiguration rtbc = resource.getResourceType().getResourceTypeBundleConfiguration();
        if (rtbc == null) {
            throw new IllegalArgumentException("The resource type doesn't support bundle deployments: " + resource);
        }
        for (BundleDestinationBaseDirectory bdbd : rtbc.getBundleDestinationBaseDirectories()) {
            if (bdbd.getName().equals(destBaseDirName)) {
                bundleDestBaseDir = bdbd;
                break;
            }
        }
View Full Code Here

            // each different resource type that supports bundle deployments needs to define its
            // bundle configuration to denote where the base directory location is found.
            // Today we support four ways: via plugin config property, resource config property,
            // measurement trait value, or strictly on the root file system (using no resource specific value)
            ResourceTypeBundleConfiguration rtbc = new ResourceTypeBundleConfiguration(new Configuration());
            rtbc.addBundleDestinationBaseDirectory(BUNDLE_CONFIG_NAME_FS, Context.fileSystem.name(),
                BUNDLE_CONFIG_CONTEXT_VALUE_FS, null);
            serverTypeFS.setResourceTypeBundleConfiguration(rtbc);

            rtbc = new ResourceTypeBundleConfiguration(new Configuration());
            rtbc.addBundleDestinationBaseDirectory(BUNDLE_CONFIG_NAME_PC, Context.pluginConfiguration.name(),
                BUNDLE_CONFIG_CONTEXT_VALUE_PC, null);
            serverTypePC.setResourceTypeBundleConfiguration(rtbc);

            rtbc = new ResourceTypeBundleConfiguration(new Configuration());
            rtbc.addBundleDestinationBaseDirectory(BUNDLE_CONFIG_NAME_RC, Context.resourceConfiguration.name(),
                BUNDLE_CONFIG_CONTEXT_VALUE_RC, null);
            serverTypeRC.setResourceTypeBundleConfiguration(rtbc);

            rtbc = new ResourceTypeBundleConfiguration(new Configuration());
            rtbc.addBundleDestinationBaseDirectory(BUNDLE_CONFIG_NAME_MT, Context.measurementTrait.name(),
                BUNDLE_CONFIG_CONTEXT_VALUE_MT, null);
            serverTypeMT.setResourceTypeBundleConfiguration(rtbc);

            // each different resource needs to specify where exactly it wants the bundles deployed
            // using the different contexts that are supported.
View Full Code Here

        assert t.getConfiguration().getSimple("delta").getIntegerValue() == 42;

        assert serverType.getBundleType() == null : "bundle should not be defined for type: " + serverType;

        // ensure the bundle target metadata is correct
        ResourceTypeBundleConfiguration bundleTargetConfig = serverType.getResourceTypeBundleConfiguration();
        assert bundleTargetConfig != null;
        Set<ResourceTypeBundleConfiguration.BundleDestinationBaseDirectory> set = bundleTargetConfig
            .getBundleDestinationBaseDirectories();
        assert set.size() == 2;
        for (BundleDestinationBaseDirectory bdbd : set) {
            if (bdbd.getName().equals("basedir1")) {
                assert bdbd.getValueContext() == Context.pluginConfiguration : bdbd;
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.bundle.ResourceTypeBundleConfiguration$BundleDestinationSpecification

Copyright © 2018 www.massapicom. 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.