@SuppressWarnings("rawtypes")
    @Override
    public void init(Map stormConf) {
        defaultfetchInterval = ConfUtils.getInt(stormConf,
                Constants.defaultFetchIntervalParamName, 1440);
        fetchErrorFetchInterval = ConfUtils.getInt(stormConf,
                Constants.fetchErrorFetchIntervalParamName, 120);
        errorFetchInterval = ConfUtils.getInt(stormConf,
                Constants.errorFetchIntervalParamName, 44640);

        // loads any custom key values
        // must be of form fetchInterval(.STATUS)?.keyname=value
        // e.g. fetchInterval.isFeed=true
        // e.g. fetchInterval.FETCH_ERROR.isFeed=true
        Map<String, CustomInterval> intervals = new HashMap<>();
        Pattern pattern = Pattern
                .compile("^fetchInterval(\\..+?)?\\.(.+)=(.+)");
        Iterator<String> keyIter = stormConf.keySet().iterator();
        while (keyIter.hasNext()) {
            String key = keyIter.next();
            Matcher m = pattern.matcher(key);
            if (!m.matches()) {
                continue;
            }
            Status status = null;
            // was a status specified?
            if (m.group(1) != null) {
                status = Status.valueOf(m.group(1).substring(1));
            }
            String mdname = m.group(2);
            String mdvalue = m.group(3);
            int customInterval = ConfUtils.getInt(stormConf, key, -1);
            if (customInterval != -1) {
                CustomInterval interval = intervals.get(mdname + mdvalue);
                if (interval == null) {
                    interval = new CustomInterval(mdname, mdvalue, status,
                            customInterval);
                } else {
                    interval.setDurationForStatus(status, customInterval);
                }
                // specify particular interval for this status
                intervals.put(mdname + mdvalue, interval);
            }
        }
        customIntervals = intervals.values().toArray(
                new CustomInterval[intervals.size()]);
    }
@SuppressWarnings("rawtypes")
    @Override
    public void init(Map stormConf) {
        defaultfetchInterval = ConfUtils.getInt(stormConf,
                Constants.defaultFetchIntervalParamName, 1440);
        fetchErrorFetchInterval = ConfUtils.getInt(stormConf,
                Constants.fetchErrorFetchIntervalParamName, 120);
        errorFetchInterval = ConfUtils.getInt(stormConf,
                Constants.errorFetchIntervalParamName, 44640);

        
        
        
        
        Map<String, CustomInterval> intervals = new HashMap<>();
        Pattern pattern = Pattern
                .compile("^fetchInterval(\\..+?)?\\.(.+)=(.+)");
        Iterator<String> keyIter = stormConf.keySet().iterator();
        while (keyIter.hasNext()) {
            String key = keyIter.next();
            Matcher m = pattern.matcher(key);
            if (!m.matches()) {
                continue;
            }
            Status status = null;
            
            if (m.group(1) != null) {
                status = Status.valueOf(m.group(1).substring(1));
            }
            String mdname = m.group(2);
            String mdvalue = m.group(3);
            int customInterval = ConfUtils.getInt(stormConf, key, -1);
            if (customInterval != -1) {
                CustomInterval interval = intervals.get(mdname + mdvalue);
                if (interval == null) {
                    interval = new CustomInterval(mdname, mdvalue, status,
                            customInterval);
                } else {
                    interval.setDurationForStatus(status, customInterval);
                }
                
                intervals.put(mdname + mdvalue, interval);
            }
        }
        customIntervals = intervals.values().toArray(
                new CustomInterval[intervals.size()]);
    }
@ SuppressWarnings ( "rawtypes" ) @ Override public void init ( Map stormConf ) { defaultfetchInterval = ConfUtils . getInt ( stormConf , Constants . defaultFetchIntervalParamName , 1440 ) ; fetchErrorFetchInterval = ConfUtils . getInt ( stormConf , Constants . fetchErrorFetchIntervalParamName , 120 ) ; errorFetchInterval = ConfUtils . getInt ( stormConf , Constants . errorFetchIntervalParamName , 44640 ) ; // loads any custom key values // must be of form fetchInterval(.STATUS)?.keyname=value // e.g. fetchInterval.isFeed=true // e.g. fetchInterval.FETCH_ERROR.isFeed=true Map < String , CustomInterval > intervals = new HashMap <> ( ) ; Pattern pattern = Pattern . compile ( "^fetchInterval(\\..+?)?\\.(.+)=(.+)" ) ; Iterator < String > keyIter = stormConf . keySet ( ) . iterator ( ) ; while ( keyIter . hasNext ( ) ) { String key = keyIter . next ( ) ; Matcher m = pattern . matcher ( key ) ; if ( ! m . matches ( ) ) { continue ; } Status status = null ; // was a status specified? if ( m . group ( 1 ) != null ) { status = Status . valueOf ( m . group ( 1 ) . substring ( 1 ) ) ; } String mdname = m . group ( 2 ) ; String mdvalue = m . group ( 3 ) ; int customInterval = ConfUtils . getInt ( stormConf , key , - 1 ) ; if ( customInterval != - 1 ) { CustomInterval interval = intervals . get ( mdname + mdvalue ) ; if ( interval == null ) { interval = new CustomInterval ( mdname , mdvalue , status , customInterval ) ; } else { interval . setDurationForStatus ( status , customInterval ) ; } // specify particular interval for this status intervals . put ( mdname + mdvalue , interval ) ; } } customIntervals = intervals . values ( ) . toArray ( new CustomInterval [ intervals . size ( ) ] ) ; }
/*
(non-Javadoc)

@see
com.digitalpebble.stormcrawler.persistence.Scheduler#init(java.util.Map)
/ * ( non - Javadoc )