Package org.rhq.core.domain.content

Examples of org.rhq.core.domain.content.PackageType


        query.setParameter("packageTypeId", packageTypeId);
        ConfigurationDefinition configurationDefinition = null;
        try {
            configurationDefinition = (ConfigurationDefinition) query.getSingleResult();
        } catch (NoResultException e) {
            PackageType packageType = entityManager.find(PackageType.class, packageTypeId);
            if (packageType == null) {
                throw new EntityNotFoundException("A package type with id " + packageTypeId + " does not exist.");
            }
        }
View Full Code Here


        InstalledPackage installedPackage = entityManager.find(InstalledPackage.class, id);
        return installedPackage;
    }

    public PackageType getPackageType(int id) {
        PackageType packageType = entityManager.find(PackageType.class, id);
        return packageType;
    }
View Full Code Here

            throw new PermissionException("User [" + user.getName()
                + "] does not have permission to create a child resource for resource [" + parentResource + "]");
        }

        ResourceType newResourceType = entityManager.find(ResourceType.class, newResourceTypeId);
        PackageType newPackageType = contentManager.getResourceCreationPackageType(newResourceTypeId);

        if (!newResourceType.isCreatable()
            || (newResourceType.getCreationDataType() != ResourceCreationDataType.CONTENT)) {
            throw new RuntimeException("Cannot create " + newResourceType + " child Resource under parent "
                + parentResource + ", since the " + newResourceType
                + " type does not support content-based Resource creation.");
        }

        abortResourceCreationIfExistingSingleton(parentResource, newResourceType);

        // unless version is set start versioning the package by timestamp
        packageVersionNumber = (null == packageVersionNumber) ? Long.toString(System.currentTimeMillis())
            : packageVersionNumber;

        // default to no required architecture
        architectureId = (null != architectureId) ? architectureId : contentManager.getNoArchitecture().getId();

        // Create/locate package and package version
        PackageVersion packageVersion = null;
        if (packageUploadDetails == null) {
            packageVersion = contentManager.createPackageVersionWithDisplayVersion(user, packageName,
                newPackageType.getId(), packageVersionNumber, null, architectureId, packageBitStream);
        } else {
            packageVersion = contentManager.getUploadedPackageVersion(user, packageName, newPackageType.getId(),
                packageVersionNumber, architectureId, packageBitStream, packageUploadDetails, null);
        }

        return doCreatePackageBackedResource(user, parentResource, newResourceType, newResourceName,
            pluginConfiguration, deploymentTimeConfiguration, packageVersion, timeout);
View Full Code Here

     * @param packageVersion populated domain entity for a package version
     * @return transfer object populated with the necessary data to request package deployment related activities
     */
    public static ResourcePackageDetails toResourcePackageDetails(PackageVersion packageVersion) {
        Package pkg = packageVersion.getGeneralPackage();
        PackageType pkgType = pkg.getPackageType();

        PackageDetailsKey key = new PackageDetailsKey(pkg.getName(), packageVersion.getVersion(), pkgType.getName(),
            packageVersion.getArchitecture().getName());

        ResourcePackageDetails details = new ResourcePackageDetails(key);
        details.setClassification(pkg.getClassification());
        details.setDisplayName(packageVersion.getDisplayName());
View Full Code Here

    private PackageType lookupPackageType() {
        if (resourceType == null) {
            resourceType = lookupResourceType();
        }
        ContentManagerLocal contentManager = LookupUtil.getContentManager();
        PackageType packageType = contentManager.getResourceCreationPackageType(this.resourceType.getId());
        return packageType;
    }
View Full Code Here

            // string to "", in which case this exception is triggered
            return null;
        }

        ContentUIManagerLocal contentUIManager = LookupUtil.getContentUIManager();
        PackageType packageType = contentUIManager.getPackageType(packageTypeId);

        return packageType;
    }
View Full Code Here

        return packageType;
    }

    public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object object) {
        PackageType packageType = (PackageType) object;
        return Integer.toString(packageType.getId());
    }
View Full Code Here

                    + env.getPluginKey().getPluginName() + "' does not inherit from AbstractPackageTypeBehavior class.");
            }

            //check that all the package types defined by this plugin exist
            for (PackageTypeDefinitionType def : descriptor.getPackageType()) {
                PackageType pt = ensurePackageTypeExists(def);
                pluginsByPackageTypeId.put(pt, env);
            }
        } catch (Exception e) {
            // do not deploy this plugin - its stinky
            try {
View Full Code Here

    private PackageType ensurePackageTypeExists(PackageTypeDefinitionType def) throws InvalidPluginDescriptorException {
        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
        ContentManagerLocal cm = LookupUtil.getContentManager();

        PackageType packageType = cm.findPackageType(subjectManager.getOverlord(), null, def.getName());

        if (packageType == null) {
            //TODO support tying the package type to the resource types?
            packageType = new PackageType(def.getName(), null);
            packageType.setDescription(def.getDescription());
            packageType.setDisplayName(def.getDisplayName());
            packageType.setSupportsArchitecture(def.isSupportsArchitecture());
            packageType.setCreationData(false);
            packageType.setDeploymentConfigurationDefinition(ConfigurationMetadataParser.parse(def.getName(),
                def.getConfiguration()));
            packageType.setDiscoveryInterval(-1);
            packageType.setPackageExtraPropertiesDefinition(null);

            packageType = cm.persistServersidePackageType(packageType);
        }

        return packageType;
View Full Code Here

    @Override
    public ContentDiscoveryReport executeResourcePackageDiscoveryImmediately(int resourceId, String packageTypeName)
        throws PluginContainerException {
        // Load the package type object
        PackageType packageType = findPackageType(resourceId, packageTypeName);
        if (packageType == null) {
            throw new PluginContainerException("Could not load package type [" + packageTypeName + "] for resource: "
                + resourceId);
        }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.content.PackageType

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.