Changeset 307 for kraken-filter

Show
Ignore:
Timestamp:
06/15/09 00:22:04 (14 months ago)
Author:
xeraph
Message:

Added missing event callback notifications.

Location:
kraken-filter/src/main/java/org/krakenapps/filter
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • kraken-filter/src/main/java/org/krakenapps/filter/ActiveFilter.java

    r306 r307  
    4343 
    4444        /** 
    45          * Initialize an active filter instance. ActiveFilterRunner calls this 
    46          * method before the run loop. 
     45         * Initialize callback. ActiveFilterRunner calls this method before the run 
     46         * loop. Override this. 
    4747         *  
    4848         * @throws ConfigurationException 
     
    5353 
    5454        /** 
    55          * Finalize an active filter instance. ActiveFilterRunner calls this method 
    56          * after the run loop. 
     55         * Finalize callback. ActiveFilterRunner calls this method after the run 
     56         * loop. Override this. 
    5757         */ 
    5858        public void close() { 
     
    6060 
    6161        /** 
    62          * ActiveFilterRunner calls this method in each loop. Thread will sleep some 
    63          * milliseconds after run. 
     62         * ActiveFilterRunner calls this callback in each loop. Thread will sleep 
     63         * some milliseconds after run. 
    6464         *  
    6565         * @throws InterruptedException 
  • kraken-filter/src/main/java/org/krakenapps/filter/DefaultFilter.java

    r306 r307  
    4040 
    4141        /** 
    42          * No input message specifications are supported. 
     42         * No input message specifications are supported by default. Override this. 
    4343         */ 
    4444        @Override 
     
    4848 
    4949        /** 
    50          * No output message specification is supported. 
     50         * No output message specification is supported by default. Override this. 
    5151         */ 
    5252        @Override 
     
    5656 
    5757        /** 
    58          * Empty message processing. 
     58         * Empty message processing by default. Override this. 
    5959         */ 
    6060        @Override 
     
    7979 
    8080        /** 
    81          *  
     81         * Sets a property. 
    8282         */ 
    8383        @Override 
     
    8686        } 
    8787 
     88        /** 
     89         * Removes the property. 
     90         */ 
    8891        @Override 
    8992        public void unsetProperty(String key) { 
     
    9194        } 
    9295 
     96        /** 
     97         * Validates current configuration. No check by default. Override this. 
     98         */ 
    9399        @Override 
    94100        public void validateConfiguration() throws ConfigurationException { 
  • kraken-filter/src/main/java/org/krakenapps/filter/FilterEventListener.java

    r306 r307  
    2424public interface FilterEventListener { 
    2525        /** 
    26          * Invoked when a filter is loaded. 
     26         * Invoked synchronously when a filter is loaded. 
    2727         */ 
    2828        void onFilterLoaded(String filterId); 
    2929 
    3030        /** 
    31          * Invoked when a filter is unloading. 
     31         * Invoked synchronously when a filter is unloading. 
    3232         */ 
    3333        void onFilterUnloading(String filterId); 
    3434 
    3535        /** 
    36          * Invoked when filters are bound. 
     36         * Invoked synchronously when filters are bound. 
    3737         *  
    3838         * @param fromFilterId 
     
    4444 
    4545        /** 
    46          * Invoked when filters are unbounding. 
     46         * Invoked synchronously when filters are unbounding. 
    4747         *  
    4848         * @param fromFilterId 
     
    5454 
    5555        /** 
    56          * Invoked when a property is set. 
     56         * Invoked synchronously when a property is set. 
    5757         *  
    5858         * @param filterId 
     
    6666 
    6767        /** 
    68          * Invoked when a property is removed. 
     68         * Invoked synchronously when a property is removed. 
    6969         *  
    7070         * @param filterId 
  • kraken-filter/src/main/java/org/krakenapps/filter/impl/DefaultFilterManager.java

    r306 r307  
    414414                        FilterHandler handler = handlerMap.get(fromFilterId); 
    415415                        handler.stateChanged(convertToArray(bindedFilters)); 
     416                         
     417                        // notify event handlers 
     418                        for (FilterEventListener listener : listeners) { 
     419                                listener.onFilterBound(fromFilterId, toFilterId); 
     420                        } 
    416421                } 
    417422        } 
     
    440445                        // validation 
    441446                        Filter toFilter = getFilterInstance(toFilterId); 
     447                         
     448                        // notify event handlers 
     449                        for (FilterEventListener listener : listeners) { 
     450                                listener.onFilterUnbinding(fromFilterId, toFilterId); 
     451                        } 
    442452 
    443453                        // unbind it. 
     
    526536                                throw new FilterNotFoundException(filterId); 
    527537                        } 
     538                         
     539                        // notify event handlers 
     540                        for (FilterEventListener listener : listeners) { 
     541                                listener.onFilterSet(filterId, key, value); 
     542                        } 
    528543                } 
    529544        } 
     
    541556                        } else { 
    542557                                throw new FilterNotFoundException(filterId); 
     558                        } 
     559                         
     560                        // notify event handlers 
     561                        for (FilterEventListener listener : listeners) { 
     562                                listener.onFilterUnset(filterId, key); 
    543563                        } 
    544564                }