org.krakenapps.filter
Interface FilterManager

All Known Implementing Classes:
DefaultFilterManager

public interface FilterManager

The interface for filter management.

Since:
1.0.0
Author:
xeraph

Method Summary
 void bindFilter(java.lang.String fromFilterId, java.lang.String toFilterId)
          Binds two filters.
 Filter getFilter(java.lang.String filterId)
          Returns the filter
 java.util.List<java.lang.String> getFilterFactoryNames()
          Returns a list of filter factory type name.
 java.util.List<ComponentDescription> getFilterInstanceDescriptions()
          Returns a list of all filter instance descriptions.
 Filter[] getInputFilters(java.lang.String filterId)
          Returns all bound input filters.
 Filter[] getOutputFilters(java.lang.String filterId)
          Returns all bound output filters.
 java.lang.Object getProperty(java.lang.String filterId, java.lang.String key)
          Returns the value of the property.
 java.util.Set<java.lang.String> getPropertyKeys(java.lang.String filterId)
          Returns a Set of property keys
 void loadFilter(int filterFactoryIndex, java.lang.String filterId)
          Loads a filter using filter factory index.
 void loadFilter(java.lang.String filterFactoryName, java.lang.String filterId)
          Loads a filter using the filter factory name.
 void registerFilter(FilterHandler filterHandler, java.lang.String filterId, Filter filter)
          Register the filter with filter id and handler.
 void runFilter(java.lang.String filterId, long period)
          Starts an ActiveFilter thread with specified milliseconds interval.
 void setProperty(java.lang.String filterId, java.lang.String key, java.lang.String value)
          Sets the property.
 void stopFilter(java.lang.String filterId)
          Stops the active filter.
 void subscribeFilterEvent(FilterEventListener listener)
          Subscribes filter events.
 void unbindFilter(java.lang.String fromFilterId, java.lang.String toFilterId)
          Unbind filters.
 void unloadFilter(java.lang.String filterId)
          Unloads the filter.
 void unregisterFilter(java.lang.String filterId)
          Unregister the filter.
 void unsetProperty(java.lang.String filterId, java.lang.String key)
          Removes the property.
 void unsubscribeFilterEvent(FilterEventListener listener)
          Unsubscribes filter events.
 

Method Detail

getFilterFactoryNames

java.util.List<java.lang.String> getFilterFactoryNames()
Returns a list of filter factory type name.


getFilterInstanceDescriptions

java.util.List<ComponentDescription> getFilterInstanceDescriptions()
Returns a list of all filter instance descriptions.


loadFilter

void loadFilter(int filterFactoryIndex,
                java.lang.String filterId)
                throws FilterFactoryNotFoundException,
                       DuplicatedFilterNameException
Loads a filter using filter factory index.

Parameters:
filterFactoryIndex - the filter factory index which is listed before.
filterId - the filter id
Throws:
FilterFactoryNotFoundException - if filter factory is not found
DuplicatedFilterNameException - if filter id is duplicated

loadFilter

void loadFilter(java.lang.String filterFactoryName,
                java.lang.String filterId)
                throws FilterFactoryNotFoundException,
                       DuplicatedFilterNameException
Loads a filter using the filter factory name.

Parameters:
filterFactoryName - the filter factory name
filterId - the filter id
Throws:
FilterFactoryNotFoundException - if filter factory is not found
DuplicatedFilterNameException - if filter id is duplicated

unloadFilter

void unloadFilter(java.lang.String filterId)
                  throws FilterNotFoundException
Unloads the filter.

Parameters:
filterId - the filter id
Throws:
FilterNotFoundException - if filter is not found

runFilter

void runFilter(java.lang.String filterId,
               long period)
               throws FilterNotFoundException,
                      java.lang.IllegalThreadStateException
Starts an ActiveFilter thread with specified milliseconds interval.

Parameters:
filterId - the ActiveFilter id
period - the sleep interval in milliseconds
Throws:
FilterNotFoundException - if active filter is not found
java.lang.IllegalThreadStateException - if active filter is already running

stopFilter

void stopFilter(java.lang.String filterId)
                throws FilterNotFoundException
Stops the active filter.

Parameters:
filterId - the ActiveFilter id
Throws:
FilterNotFoundException - if active filter is not found

bindFilter

void bindFilter(java.lang.String fromFilterId,
                java.lang.String toFilterId)
                throws FilterNotFoundException,
                       AlreadyBoundException,
                       MessageSpecMismatchException
Binds two filters.

Parameters:
fromFilterId - the source filter id
toFilterId - the destination filter id
Throws:
FilterNotFoundException - if source or destination filter is not found
AlreadyBoundException - if filters are already bound
MessageSpecMismatchException - if source filter's message specification and destinatino filter's message specification is not matched.

unbindFilter

void unbindFilter(java.lang.String fromFilterId,
                  java.lang.String toFilterId)
                  throws FilterNotFoundException,
                         FilterNotBoundException
Unbind filters.

Parameters:
fromFilterId - the source filter id
toFilterId - the destination filter id
Throws:
FilterNotFoundException - if source or destination filter is not found
FilterNotBoundException - if filters are not bound

getFilter

Filter getFilter(java.lang.String filterId)
Returns the filter

Parameters:
filterId - the filter id
Returns:
the filter. returns null if not exists.

getInputFilters

Filter[] getInputFilters(java.lang.String filterId)
Returns all bound input filters.

Parameters:
filterId - the filter id
Returns:
all bound input filters. empty array if input filter does not exists

getOutputFilters

Filter[] getOutputFilters(java.lang.String filterId)
Returns all bound output filters.

Parameters:
filterId - the filter id
Returns:
all bound output filters. empty array if output filter does not exists

registerFilter

void registerFilter(FilterHandler filterHandler,
                    java.lang.String filterId,
                    Filter filter)
Register the filter with filter id and handler. Can be used as sub-routine of loadFilter. Invoked from FilterHandler.

Parameters:
filterHandler - the filter handler
filterId - the filter id
filter - the filter

unregisterFilter

void unregisterFilter(java.lang.String filterId)
Unregister the filter. Can be used as sub-routine of unloadFilter. Invoked from FilterHandler.

Parameters:
filterId - the filter id

getPropertyKeys

java.util.Set<java.lang.String> getPropertyKeys(java.lang.String filterId)
                                                throws FilterNotFoundException
Returns a Set of property keys

Parameters:
filterId - the filter id
Returns:
a Set of property keys
Throws:
FilterNotFoundException - if filter is not found

getProperty

java.lang.Object getProperty(java.lang.String filterId,
                             java.lang.String key)
                             throws FilterNotFoundException
Returns the value of the property.

Parameters:
filterId - the filter id
key - the key of property
Returns:
the property value
Throws:
FilterNotFoundException - if filter is not found

setProperty

void setProperty(java.lang.String filterId,
                 java.lang.String key,
                 java.lang.String value)
                 throws FilterNotFoundException
Sets the property.

Parameters:
filterId - the filter id
key - the key of property
value - the value of property
Throws:
FilterNotFoundException - if filter is not found

unsetProperty

void unsetProperty(java.lang.String filterId,
                   java.lang.String key)
                   throws FilterNotFoundException
Removes the property.

Parameters:
filterId - the filter id
key - the key of property
Throws:
FilterNotFoundException - if filter is not found

subscribeFilterEvent

void subscribeFilterEvent(FilterEventListener listener)
Subscribes filter events.

Parameters:
listener - the filter event listener

unsubscribeFilterEvent

void unsubscribeFilterEvent(FilterEventListener listener)
Unsubscribes filter events.

Parameters:
listener - the filter event listener


Copyright © 2008-2009 Kraken Project. All Rights Reserved.