Package churchillobjects.rss4j

Examples of churchillobjects.rss4j.RssDublinCore


            while (repoItems.hasMoreElements()) {
                RssChannelItem item = (RssChannelItem) repoItems.nextElement();

                RssJbnPatch patch = item.getJbnPatch();
                RssDublinCore dublinCore = item.getDublinCore();

                // We need the data in these objects, so skip if either are null. I'm not sure this constitutes
                // an error, but leaving the log message at warn for now.
                if ((dublinCore == null) || (patch == null)) {
                    log.debug("Feed entry parsed data returned null. Skipping entry.  Patch: " + patch
                        + ", Dublin Core: " + dublinCore);
                    continue;
                }

                // If there are no products against which the software applies, punch out early
                Collection products = patch.getProducts();
                if ((products == null) || (products.size() == 0)) {
                    continue;
                }

                // First class properties
                String packageName = dublinCore.getSubject();
                String softwareType = patch.getType();

                // Extra properties
                String distributionStatus = patch.getDistributionStatus();
                String jiraId = patch.getJira();
                String downloadUrl = patch.getDownloadUrl();
                String instructionCompatibilityVersion = patch.getInstructionCompatibilityVersion();

                // If the distribution status indicates it's removed, don't do anything. Later in this method, if
                // this package was known to the server, it will still be in the existing packages map and marked
                // as deleted at the end. If the server didn't know about it, then nothing had to be done.
                if (distributionStatus.equals(DIST_STATUS_REMOVED)) {
                    continue;
                }

                Configuration extraProperties = new Configuration();
                extraProperties.put(new PropertySimple("jiraId", jiraId));
                extraProperties.put(new PropertySimple("distributionStatus", distributionStatus));
                extraProperties.put(new PropertySimple("downloadUrl", downloadUrl));
                extraProperties.put(new PropertySimple("instructionCompatibilityVersion",
                    instructionCompatibilityVersion));

                /* This will be refactored when we add support for the other types of data coming across in the feed,
                   such as product distributions and security/configuration advisories. For now, just leaving the
                   cumulative patch handling in here, but will clean up when the other types are supported.
                   jdobies, Jan 9, 2008
                 */

                // Technically, this is a check for installable patches. But for now, that's the same as a cumulative
                // patch
                if (softwareType.equals(RSS_SOFTWARE_TYPE_BUGFIX) && instructionCompatibilityVersion != null) {
                    String displayVersion = parseCumulativePatchVersion(packageName);
                    if (displayVersion == null) {
                        log.error("Could not parse version for package: " + packageName + ". Package skipped.");
                        continue;
                    }

                    if (patch.getSha256() == null) {
                        log.error("Could not parse SHA256 for package: " + packageName + ". Package skipped.");
                        continue;
                    }

                    String version = "[sha256=" + patch.getSha256() + "]";

                    ContentProviderPackageDetailsKey key = new ContentProviderPackageDetailsKey(packageName, version,
                        PACKAGE_TYPE_CUMULATIVE_PATCH, ARCHITECTURE, RESOURCE_TYPE_JBOSS_AS,
                        getPluginName(displayVersion));

                    // If this package is already known to the server, don't add it as a new package
                    // Remove from the map; entries still in the map will be returned as deleted packages
                    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());
View Full Code Here


     * @param name
     * @param value
     */
    protected void handleDublinCore(IUsesDublinCore dcobj, String name, String value) throws RssParseException{
        checkDublinCore();
        RssDublinCore dc = dcobj.getDublinCore();
        if(dc==null){
            dc = new RssDublinCore();
            dcobj.setDublinCore(dc);
        }
        if("title".equals(name)){
            dc.setTitle(value);
        }
        if("creator".equals(name)){
            dc.setCreator(value);
        }
        if("subject".equals(name)){
            dc.setSubject(value);
        }
        if("description".equals(name)){
            dc.setDescription(value);
        }
        if("publisher".equals(name)){
            dc.setPublisher(value);
        }
        if("contributor".equals(name)){
            dc.setContributor(value);
        }
        if("date".equals(name)){
            try{
                dc.setDate(value);
            }
            catch(ParseException e){
                throw new RssParseException( e );
//                throw new RssParseException("Dublin Core date value not convertible from ISO8601: '"+value+"'");
            }
        }
        if("type".equals(name)){
            dc.setType(value);
        }
        if("format".equals(name)){
            dc.setFormat(value);
        }
        if("identifier".equals(name)){
            dc.setIdentifier(value);
        }
        if("source".equals(name)){
            dc.setSource(value);
        }
        if("language".equals(name)){
            dc.setLanguage(value);
        }
        if("relation".equals(name)){
            dc.setRelation(value);
        }
        if("coverage".equals(name)){
            dc.setCoverage(value);
        }
        if("rights".equals(name)){
            dc.setRights(value);
        }
    }
View Full Code Here

TOP

Related Classes of churchillobjects.rss4j.RssDublinCore

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.