Package churchillobjects.rss4j

Examples of churchillobjects.rss4j.RssJbnPatch


            Enumeration repoItems = repo.items();

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


     * @param name
     * @param value
     */
    protected void handleJbnPatch( IUsesJbnPatch dcobj, String name, String value) throws RssParseException{
        checkJbnPatch();
        RssJbnPatch jbn = dcobj.getJbnPatch();
        if(jbn == null){
            jbn = new RssJbnPatch();
            dcobj.setJbnPatch(jbn);
        }

        if( RssJbnPatch.ATTR_TYPE.equals(name)){
            jbn.setType( value);
        }
        else if( RssJbnPatch.ATTR_CREATOR.equals( name ) )
        {
            jbn.setCreator( value );
        }
        else if( RssJbnPatch.ATTR_JIRA.equals( name ))
        {
            jbn.setJira( value );
        }
        else if( RssJbnPatch.ATTR_MD5.equals( name ) )
        {
            jbn.setMd5( value );
        }
        else if( RssJbnPatch.ATTR_SHA256.equals( name ) )
        {
            jbn.setSha256( value );
        }
        else if( RssJbnPatch.ATTR_FILE_NAME.equals( name ) )
        {
            jbn.setFileName( value );
        }
        else if( RssJbnPatch.ATTR_FILE_SIZE.equals( name ) )
        {
            jbn.setFileSize( value );
        }
        else if( RssJbnPatch.ATTR_DOWNLOAD_URL.equals( name ) )
        {
            jbn.setDownloadUrl( value );
        }
        else if( RssJbnPatch.ATTR_AUTOMATED_DOWNLOAD_URL.equals( name ) )
        {
            jbn.setAutomatedDownloadUrl( value );
        }
        else if( RssJbnPatch.ATTR_INSTRUCTION_VERSION.equals( name ) )
        {
            jbn.setInstructionCompatibilityVersion( value );
        }
        else if( RssJbnPatch.ATTR_LONG_DESC.equals( name ) )
        {
            jbn.setLongDescription( value );
        }
        else if( RssJbnPatch.ATTR_SHORT_DESC.equals( name ) )
        {
            jbn.setShortDescription( value );
        }
        else if( RssJbnPatch.ATTR_MANUAL_INSTALL.equals( name ) )
        {
            jbn.setManualInstallation( value );
        }
        else if( RssJbnPatch.ATTR_AUTOMATED_INSTALL.equals( name ) )
        {
            jbn.setAutomatedInstallation( value );
        }
        else if( RssJbnPatch.ATTR_CASE_ID.equals( name ) )
        {
            jbn.setCaseId( value );
        }
        else if( RssJbnPatch.ATTR_LICENSE_NAME.equals( name ) )
        {
            jbn.setLicenseName( value );
        }
        else if( RssJbnPatch.ATTR_LICENSE_VERSION.equals( name ) )
        {
            jbn.setLicenseVersion( value );
        }
        else if( RssJbnPatch.ATTR_DISTRIBUTION_STATUS.equals( name ) )
        {
            jbn.setDistributionStatus( value );
        }
        else if( RssJbnPatch.ATTR_LAST_UPDATED.equals( name ) )
        {
            try
            {
                jbn.setLastUpdated( value );
            }
            catch ( ParseException e )
            {
                e.printStackTrace();
            }
        }
        else if( inJbnProducts && RssJbnPatch.ATTR_PRODUCT.equals( name ) )
        {
            currentJbnDependency.setName( value );
            jbn.addProduct( currentJbnDependency );
        }
        else if( inJbnRequires && RssJbnPatch.ATTR_PATCH.equals( name ) )
        {
            currentJbnDependency.setName( value );
            jbn.addRequires( currentJbnDependency );
        }
        else if( inJbnReplaces && RssJbnPatch.ATTR_PATCH.equals( name ) )
        {
            currentJbnDependency.setName( value );
            jbn.addReplaces( currentJbnDependency );
        }
        else if( inJbnIsReplacedBy && RssJbnPatch.ATTR_PATCH.equals( name ) )
        {
            currentJbnDependency.setName( value );
            jbn.addReplacedBy( currentJbnDependency );
        }
        else if( inJbnCompatibleWith && RssJbnPatch.ATTR_PATCH.equals( name ) )
        {
            currentJbnDependency.setName( value );
            jbn.addReplacedBy( currentJbnDependency );
        }
        else if( inJbnAutomatedInstallation && RssJbnPatch.ATTR_INSTRUCTION_SET.equals( name ) )
        {
           currentJbnDependency.setName( value );
           jbn.addAutomatedInstallationSet( currentJbnDependency );
        }
    }
View Full Code Here

TOP

Related Classes of churchillobjects.rss4j.RssJbnPatch

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.