Package org.rhq.enterprise.server.plugin.pc.content

Examples of org.rhq.enterprise.server.plugin.pc.content.ContentProviderPackageDetails


        String resourceTypeName = supportedPackageType.resourceTypeName;
        String resourceTypePluginName = supportedPackageType.resourceTypePluginName;

        ContentProviderPackageDetailsKey key = new ContentProviderPackageDetailsKey(name, version, packageTypeName,
            architectureName, resourceTypeName, resourceTypePluginName);
        ContentProviderPackageDetails pkg = new ContentProviderPackageDetails(key);

        pkg.setDisplayName(name);
        pkg.setFileName(name);
        pkg.setFileCreatedDate(file.lastModified());
        pkg.setFileSize(file.length());
        pkg.setSHA256(sha256);
        pkg.setDisplayVersion(displayVersion);
        pkg.setLocation(getRelativePath(file));
        pkg.setShortDescription(fileInfo.getDescription(null));

        return pkg;
    }
View Full Code Here


        Map<String, RemotePackageInfo> fileList = new HashMap<String, RemotePackageInfo>();

        List<PackageDetailsType> allPackages = packagesXml.getValue().getPackage();
        for (PackageDetailsType pkg : allPackages) {
            URL locationUrl = new URL(rootUrlString + pkg.getLocation());
            ContentProviderPackageDetails details = translateXmlToDomain(pkg);
            FullRemotePackageInfo rpi = new FullRemotePackageInfo(locationUrl, details);
            fileList.put(stripLeadingSlash(rpi.getLocation()), rpi);
        }

        return fileList;
View Full Code Here

        try {
            String version = "[sha256=" + pkg.getSha256() + "]";
            ContentProviderPackageDetailsKey key = new ContentProviderPackageDetailsKey(keyType.getName(), version,
                keyType.getPackageTypeName(), keyType.getArchitectureName(), keyType
                .getResourceTypeName(), keyType.getResourceTypePlugin());
            ContentProviderPackageDetails details = new ContentProviderPackageDetails(key);
            details.setDisplayName(pkg.getDisplayName());
            details.setDisplayVersion(pkg.getDisplayVersion());
            details.setShortDescription(pkg.getShortDescription());
            details.setLongDescription(pkg.getLongDescription());
            details.setClassification(pkg.getClassification());
            details.setFileName(pkg.getFileName());
            details.setFileSize(pkg.getFileSize());
            details.setFileCreatedDate(pkg.getFileCreatedDate());
            details.setSHA256(pkg.getSha256());
            details.setMD5(pkg.getMd5());
            details.setLicenseName(pkg.getLicenseName());
            details.setLicenseVersion(pkg.getLicenseVersion());
            if (pkg.getMetadata() != null) {
                details.setMetadata(pkg.getMetadata().getBytes());
            }
            details.setLocation(pkg.getLocation());

            ResourceVersionsType resourceVersions = pkg.getResourceVersions();
            if (resourceVersions != null) {
                details.setResourceVersions(new HashSet<String>(resourceVersions.getResourceVersion()));
            }

            ConfigurationType extraPropertiesXml = pkg.getExtraProperties();
            if (extraPropertiesXml != null) {
                Configuration config = new Configuration();
                List<Object> configXml = extraPropertiesXml.getSimplePropertyOrListPropertyOrMapProperty();
                for (Object object : configXml) {
                    if (object instanceof SimplePropertyType) {
                        config.put(translateSimpleProperty((SimplePropertyType) object, null));
                    } else if (object instanceof ListPropertyType) {
                        config.put(translateListProperty((ListPropertyType) object, null));
                    } else if (object instanceof MapPropertyType) {
                        config.put(translateMapProperty((MapPropertyType) object, null));
                    } else {
                        throw new IllegalStateException("Unknown JAXB type: " + object); // did the schema change?
                    }
                }
                details.setExtraProperties(config);
            }
            return details;
        } catch (Exception e) {
            log.error("Failed to process package [" + keyType.getName() + " v" + keyType.getVersion() + ']');
            throw e;
View Full Code Here

                    if (existingPackageMap.get(key) != null) {
                        existingPackageMap.remove(key);
                        continue;
                    }

                    ContentProviderPackageDetails packageDetails = new ContentProviderPackageDetails(key);

                    packageDetails.setClassification(softwareType);
                    packageDetails.setDisplayName(packageName);
                    packageDetails.setFileCreatedDate(dublinCore.getDate().getTime());
                    packageDetails.setFileName(patch.getFileName());
                    packageDetails.setFileSize(Long.parseLong(patch.getFileSize()));
                    packageDetails.setLicenseName(patch.getLicenseName());
                    packageDetails.setLicenseVersion(patch.getLicenseVersion());
                    packageDetails.setLocation(patch.getAutomatedDownloadUrl());
                    packageDetails.setMD5(patch.getMd5());
                    packageDetails.setSHA256(patch.getSha256());
                    packageDetails.setDisplayVersion(displayVersion);

                    packageDetails.setShortDescription(patch.getShortDescription());
                    packageDetails.setLongDescription(patch.getLongDescription());

                    if (patch.getAutomatedInstallation() != null) {
                        String instructions = patch.getAutomatedInstallation();

                        // JOPR-51, remove some of the xml elements which wrap the automated installation
                        // instructions but which aren't needed by JBPM
                        try {
                            Document document = builder.parse(new ByteArrayInputStream(instructions.getBytes()));
                            String choppedInstructions = xpath.evaluate(instructionExpression, document);
                            // The JBPM XML processor doesn't like whitespace at the beginning, so trim it.
                            // Bytes will be retrieved using platform encoding on the agent side, so use the same
                            // on the server side and assume they are identical.
                            packageDetails.setMetadata(choppedInstructions.trim().getBytes());
                        } catch (Exception e) {
                            log.error("Could not parse or set automated installation instructions for package: "
                                + packageName);
                            continue;
                        }
                    }

                    packageDetails.setExtraProperties(extraProperties);

                    // For each product listed for the patch, add an entry for its resource version.
                    for (Object productObj : products) {
                        RssJbnDependency product = (RssJbnDependency) productObj;

                        // The CSP feed will include an optional JON version that maps up to how the resource
                        // version will be identified by RHQ. If this is specified, we'll want to use the mapped
                        // version instead.
                        String productVersion = product.getJonResourceVersion();

                        if (product.getProductVersion().equals("4.0.4")) {
                            productVersion = "4.0.4.GA";
                        }

                        if ((null == productVersion) || ("".equals(productVersion.trim()))) {
                            productVersion = product.getProductVersion();
                        }

                        packageDetails.addResourceVersion(productVersion);
                    }

                    report.addNewPackage(packageDetails);
                }
            }
View Full Code Here

        String sha256 = p.getChildText("checksum", Repodata.yumns);
        String version = "[sha256=" + sha256 + "]";
        String arch = p.getChildText("arch", Repodata.yumns);
        ContentProviderPackageDetailsKey key = new ContentProviderPackageDetailsKey(name, version, "rpm", arch,
            "Linux", "Platforms");
        ContentProviderPackageDetails pkg = new ContentProviderPackageDetails(key);
        String filename = filename(p);
        pkg.setDisplayName(filename);
        pkg.setShortDescription(p.getChildText("summary", Repodata.yumns));
        pkg.setLongDescription(p.getChildText("description", Repodata.yumns));
        pkg.setFileName(filename);
        pkg.setFileSize(Long.parseLong(p.getChild("size", Repodata.yumns).getAttributeValue("package")));
        pkg.setFileCreatedDate(filedate(p));
        pkg.setLicenseName(p.getChild("format", Repodata.yumns).getChildText("license", Repodata.rpmns));
        pkg.setSHA256(p.getChildText("checksum", Repodata.yumns));
        pkg.setDisplayVersion(displayVersion);
        pkg.setLocation(location(p));
        pkg.setMetadata(gzip(p));
        return pkg;
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.plugin.pc.content.ContentProviderPackageDetails

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.