core/src/main/java/com/digitalpebble/stormcrawler/util/MetadataTransfer.java
public Metadata getMetaForOutlink(String targetURL, String sourceURL,
            Metadata parentMD) {
        Metadata md = _filter(parentMD, mdToTransfer);

        // keep the path?
        if (trackPath) {
            md.addValue(urlPathKeyName, sourceURL);
        }

        // track depth
        if (trackDepth) {
            String existingDepth = md.getFirstValue(depthKeyName);
            int depth;
            try {
                depth = Integer.parseInt(existingDepth);
            } catch (Exception e) {
                depth = 0;
            }
            md.setValue(depthKeyName, Integer.toString(++depth));
        }

        return md;
    }
public Metadata getMetaForOutlink(String targetURL, String sourceURL,
            Metadata parentMD) {
        Metadata md = _filter(parentMD, mdToTransfer);

        // keep the path?
        if (trackPath) {
            md.addValue(urlPathKeyName, sourceURL);
        }

        // track depth
        if (trackDepth) {
            String existingDepth = md.getFirstValue(depthKeyName);
            int depth;
            try {
                depth = Integer.parseInt(existingDepth);
            } catch (Exception e) {
                depth = 0;
            }
            md.setValue(depthKeyName, Integer.toString(++depth));
        }

        return md;
    }
public Metadata getMetaForOutlink ( String targetURL , String sourceURL , Metadata parentMD ) { Metadata md = _filter ( parentMD , mdToTransfer ) ; // keep the path? if ( trackPath ) { md . addValue ( urlPathKeyName , sourceURL ) ; } // track depth if ( trackDepth ) { String existingDepth = md . getFirstValue ( depthKeyName ) ; int depth ; try { depth = Integer . parseInt ( existingDepth ) ; } catch ( Exception e ) { depth = 0 ; } md . setValue ( depthKeyName , Integer . toString ( ++ depth ) ) ; } return md ; }
Determine which metadata should be transfered to an outlink. Adds
additional metadata like the URL path.
Determine which metadata should be transfered to an outlink . Adds additional metadata like the URL path .