RSE
Release 1.0

org.eclipse.rse.core.filters
Class SystemFilterPoolManager

java.lang.Object
  extended byorg.eclipse.rse.core.filters.SystemFilterPoolManager
All Implemented Interfaces:
org.eclipse.rse.core.persistance.IRSEPersistableContainer, ISystemFilterPoolManager

public class SystemFilterPoolManager
extends Object
implements ISystemFilterPoolManager


Field Summary
protected  boolean _isDirty
           
static boolean debug
           
protected  String name
           
protected static String NAME_EDEFAULT
          The default value of the 'Name' attribute
protected  List pools
           
protected static boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT
          The default value of the 'Single Filter String Only' attribute
protected  boolean singleFilterStringOnly
          The cached value of the 'Single Filter String Only' attribute
protected static boolean STRINGS_CASE_SENSITIVE_EDEFAULT
          The default value of the 'Strings Case Sensitive' attribute
protected  boolean stringsCaseSensitive
           
protected static boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT
          The default value of the 'Supports Duplicate Filter Strings' attribute
protected static boolean SUPPORTS_NESTED_FILTERS_EDEFAULT
          The default value of the 'Supports Nested Filters' attribute
protected  boolean supportsDuplicateFilterStrings
           
protected  boolean supportsDuplicateFilterStringsESet
          This is true if the Supports Duplicate Filter Strings attribute has been set
protected  boolean supportsNestedFilters
           
 
Constructor Summary
protected SystemFilterPoolManager(ISystemProfile profile)
          Constructor
 
Method Summary
 ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString)
          Append a new filter string to the given filter's list Does the following: Adds the filter string to the in-memory cache Saves parent filter pool to disk.
 ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString, int position)
          Insert a new filter string to the its filters' list, at the given zero-based position Does the following: Adds the filter string to the in-memory cache Saves parent filter pool to disk.
 boolean areStringsCaseSensitive()
          Same as isStringsCaseSensitive() Are filter strings in this filter case sensitive?
 boolean commit()
          Save all the filter pools to disk.
 boolean commit(ISystemFilterPool pool)
          Save all the filter pools to disk.
 ISystemFilter copySystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName)
          Copy a system filter to a pool in this or another filter manager.
 ISystemFilterPool copySystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool oldPool, String newName)
          Copy the specified filter pool from this manager to this manager or another manager.
 void copySystemFilterPools(ISystemFilterPoolManager targetMgr)
          Copy all filter pools from this manager to another manager.
 ISystemFilterString copySystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString)
          Copy a system filter string to a filter in this or another filter pool manager.
static SystemFilterPoolManager createManager(ISystemProfile profile)
           
 ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, Vector filterStrings)
          Creates a new system filter within the given filter container (either a filter pool, or a filter).
 ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, Vector filterStrings, String type)
          Creates a new system filter that is typed.
 ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, Vector filterStrings, String type, boolean promptable)
          Creates a new system filter that is typed and promptable Same as createSystemFilter(ISystemFilterContainer, String ,Vector, String) but takes a boolean indicating if it is promptable.
 ISystemFilterPool createSystemFilterPool(String poolName, boolean isDeletable)
          Create a new filter pool.
static ISystemFilterPoolManager createSystemFilterPoolManager(ISystemProfile profile, Logger logger, ISystemFilterPoolManagerProvider caller, String name, boolean allowNestedFilters, int savePolicy, IRSEFilterNamingPolicy namingPolicy)
          Factory to create a filter pool manager.
 void deleteAllSystemFilterPools()
          Delete all existing filter pools.
 boolean deleteSystemFilter(ISystemFilter filter)
          Delete an existing system filter.
 void deleteSystemFilterPool(ISystemFilterPool pool)
          Delete a given filter pool.
 ISystemFilterPool getFirstDefaultSystemFilterPool()
          Return the first pool that has the default attribute set to true.
 Logger getLogger()
          Return our logger
 String getName()
          Return the name of this manager.
 List getPools()
           
 ISystemFilterPoolManagerProvider getProvider()
          Return the caller which instantiated the filter pool manager
 IFile getSaveFile(ISystemFilterPool pool)
          Return the save file that will be written for the given filter pool.
 ISystemFilterPool getSystemFilterPool(String name)
          Given a filter pool name, return that filter pool object.
 Object getSystemFilterPoolManagerData()
          Return transient data set via setFilterPoolData.
 String[] getSystemFilterPoolNames()
          Get list of filter pool names currently existing.
 Vector getSystemFilterPoolNamesVector()
          Get list of filter pool names currently existing.
 ISystemFilterPool[] getSystemFilterPools()
          Return array of SystemFilterPools managed by this manager.
 int getSystemFilterPosition(ISystemFilter filter)
          Return the zero-based position of a SystemFilter object within its container
 int getSystemFilterStringPosition(ISystemFilterString filterString)
          Return the zero-based position of a SystemFilterString object within its filter
 ISystemProfile getSystemProfile()
          Return the owning profile for this provider
 void initialize(Logger logger, ISystemFilterPoolManagerProvider caller, String name)
           
 void initialize(Logger logger, ISystemFilterPoolManagerProvider caller, String name, boolean allowNestedFilters)
           
 boolean isDirty()
          An object is dirty if a change has been made to it that requires it to be persisted.
 boolean isSetSupportsDuplicateFilterStrings()
           
 boolean isSingleFilterStringOnly()
           
 boolean isStringsCaseSensitive()
           
 boolean isSupportsDuplicateFilterStrings()
           
 boolean isSupportsNestedFilters()
           
 void logDebugMessage(String prefix, String message)
          Helper method for logging debug messages
 void logError(String message, Throwable exception)
          Helper method for logging errors (exceptions)
 void logInfo(String message)
          Helper method for logging information
 void logMessage(String msg)
          Deprecated. Use either logInfo, logWarning, logError, or logDebugMessage. This method now calls logInfo.
 void logWarning(String message)
          Helper method for logging warnings
 ISystemFilter moveSystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName)
          Move a system filter to a pool in this or another filter manager.
 ISystemFilterPool moveSystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool oldPool, String newName)
          Move the specified filter pool from this manager to another manager.
 void moveSystemFilters(ISystemFilter[] filters, int delta)
          Move existing filters a given number of positions in the same container.
 ISystemFilterString moveSystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString)
          Move a system filter string to a filter in this or another filter pool manager.
 void moveSystemFilterStrings(ISystemFilterString[] filterStrings, int delta)
          Move existing filter strings a given number of positions in the same filter If the delta is negative, they are all moved up by the given amount.
 void orderSystemFilters(ISystemFilterPool pool, String[] names)
          Order filters according to user preferences.
 boolean preTestRenameFilterPool(ISystemFilterPool pool)
          Pre-test if we are going to run into any trouble renaming any of the files or folders used to persist a filter pool.
 boolean removeSystemFilterString(ISystemFilter filter, int position)
          Remove a filter string from the given filter's list, given its zero-based position Does the following: Removes the filter string from the in-memory cache Saves parent filter pool to disk.
 boolean removeSystemFilterString(ISystemFilter filter, ISystemFilterString filterString)
          Remove a filter string from this filter's list, given its SystemFilterString object.
 boolean removeSystemFilterString(ISystemFilter filter, String oldString)
          Delete a filter string from the given filter's list Does the following: Removes the filter string from the in-memory cache Saves parent filter pool to disk.
 void renameSystemFilter(ISystemFilter filter, String newName)
          Renames a filter.
 void renameSystemFilterPool(ISystemFilterPool pool, String newName)
          Rename a given filter pool.
protected static ISystemFilterPoolManager restoreFromOneFile(Logger logger, IFolder mgrFolder, String name, IRSEFilterNamingPolicy namingPolicy)
          Restore filter pools when all are stored in one file
 void setDirty(boolean flag)
          An object is dirty if a change has been made to it that requires it to be persisted.
protected  void setFilterPoolManager()
          Set transient variable pointing back to us.
 void setLogger(Logger logger)
          Set our logger
 void setName(String name)
          Set the name of this manager.
 void setNameGen(String newName)
           
 void setProvider(ISystemFilterPoolManagerProvider caller)
          Set the caller instance which instantiated the filter pool manager.
 void setSingleFilterStringOnly(boolean newSingleFilterStringOnly)
           
 void setStringsCaseSensitive(boolean newStringsCaseSensitive)
          Set attribute indicating if filters managed by this manager support case-sensitive filter strings, by default.
 void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive)
           
 void setSupportsDuplicateFilterStrings(boolean newSupportsDuplicateFilterStrings)
          Set attribute indicating if filters managed by this manager support duplicate filter strings, by default.
 void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings)
           
 void setSupportsNestedFilters(boolean newSupportsNestedFilters)
          Set attribute indicating if filter pools managed by this manager support nested filters, by default.
 void setSupportsNestedFiltersGen(boolean newSupportsNestedFilters)
           
 void setSystemFilterPoolManagerData(Object data)
          This is to set transient data that is subsequently queryable.
 void setSystemFilterType(ISystemFilter filter, String newType)
          Sets a filter's type.
 void setWasRestored(boolean flag)
          The the "restored" state of the object.
 boolean supportsDuplicateFilterStrings()
          Return attribute indicating if filters managed by this manager support nested duplicate filter strings.
 boolean supportsNestedFilters()
          Return attribute indicating if filter pools managed by this manager support nested filters.
 void suspendCallbacks(boolean suspend)
          Suspend callbacks to the provider
 String toString()
           
 void unsetSupportsDuplicateFilterStrings()
           
 void updateSystemFilter(ISystemFilter filter, String newName, String[] strings)
          Updates a filter.
 void updateSystemFilterString(ISystemFilterString filterString, String newValue)
          Update a filter string's string vale Does the following: Update the filter string in the in-memory cache Saves parent filter pool to disk.
 boolean wasRestored()
          Return false if the instantiation of this filter pool manager resulting in a new manager versus a restoration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_isDirty

protected boolean _isDirty

debug

public static boolean debug

NAME_EDEFAULT

protected static final String NAME_EDEFAULT
The default value of the 'Name' attribute.

See Also:
getName()

name

protected String name

SUPPORTS_NESTED_FILTERS_EDEFAULT

protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT
The default value of the 'Supports Nested Filters' attribute.

See Also:
isSupportsNestedFilters(), Constant Field Values

supportsNestedFilters

protected boolean supportsNestedFilters

STRINGS_CASE_SENSITIVE_EDEFAULT

protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT
The default value of the 'Strings Case Sensitive' attribute.

See Also:
isStringsCaseSensitive(), Constant Field Values

stringsCaseSensitive

protected boolean stringsCaseSensitive

SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT

protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT
The default value of the 'Supports Duplicate Filter Strings' attribute.

See Also:
isSupportsDuplicateFilterStrings(), Constant Field Values

supportsDuplicateFilterStrings

protected boolean supportsDuplicateFilterStrings

supportsDuplicateFilterStringsESet

protected boolean supportsDuplicateFilterStringsESet
This is true if the Supports Duplicate Filter Strings attribute has been set.


SINGLE_FILTER_STRING_ONLY_EDEFAULT

protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT
The default value of the 'Single Filter String Only' attribute.

See Also:
isSingleFilterStringOnly(), Constant Field Values

singleFilterStringOnly

protected boolean singleFilterStringOnly
The cached value of the 'Single Filter String Only' attribute.

See Also:
isSingleFilterStringOnly()

pools

protected List pools
Constructor Detail

SystemFilterPoolManager

protected SystemFilterPoolManager(ISystemProfile profile)
Constructor

Method Detail

getSystemProfile

public ISystemProfile getSystemProfile()
Description copied from interface: ISystemFilterPoolManager
Return the owning profile for this provider

Specified by:
getSystemProfile in interface ISystemFilterPoolManager

createSystemFilterPoolManager

public static ISystemFilterPoolManager createSystemFilterPoolManager(ISystemProfile profile,
                                                                     Logger logger,
                                                                     ISystemFilterPoolManagerProvider caller,
                                                                     String name,
                                                                     boolean allowNestedFilters,
                                                                     int savePolicy,
                                                                     IRSEFilterNamingPolicy namingPolicy)
Factory to create a filter pool manager.

Parameters:
logger - A logging object into which to log errors as they happen in the framework
caller - Objects which instantiate this class should implement the SystemFilterPoolManagerProvider interface, and pass "this" for this parameter. Given any filter framework object, it is possible to retrieve the caller's object via the getProvider method call.
name - the name of the filter pool manager. Typically this is also the name of the given folder, but this is not required. For the save policy of one file per manager, the name of the file is derived from this. For other save policies, the name is not used.
allowNestedFilters - true if filters inside filter pools in this manager are to allow nested filters. This is the default, but can be overridden at the individual filter pool level.
savePolicy - The save policy for the filter pools and filters. One of the following constants from the SystemFilterConstants interface:
  • SAVE_POLICY_NONE - no files, all save/restore handled elsewhere
  • SAVE_POLICY_ONE_FILE_PER_MANAGER - one file: mgrName.xmi
  • SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool
  • SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder
  • SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool
namingPolicy - The names to use for file and folders when persisting to disk. Pass null to just use the defaults, or if using SAVE_POLICY_NONE.

createManager

public static SystemFilterPoolManager createManager(ISystemProfile profile)

initialize

public void initialize(Logger logger,
                       ISystemFilterPoolManagerProvider caller,
                       String name,
                       boolean allowNestedFilters)

initialize

public void initialize(Logger logger,
                       ISystemFilterPoolManagerProvider caller,
                       String name)

getProvider

public ISystemFilterPoolManagerProvider getProvider()
Return the caller which instantiated the filter pool manager

Specified by:
getProvider in interface ISystemFilterPoolManager

setProvider

public void setProvider(ISystemFilterPoolManagerProvider caller)
Set the caller instance which instantiated the filter pool manager. This is only recorded to enable getProvider from any filter framework object.

Specified by:
setProvider in interface ISystemFilterPoolManager

setName

public void setName(String name)
Set the name of this manager. Intercepted so the file get be renamed for SAVE_POLICY_ONE_FILE_PER_MANAGER.

Specified by:
setName in interface ISystemFilterPoolManager

supportsNestedFilters

public boolean supportsNestedFilters()
Return attribute indicating if filter pools managed by this manager support nested filters. Same as isSupportsNestedFilters()

Specified by:
supportsNestedFilters in interface ISystemFilterPoolManager

supportsDuplicateFilterStrings

public boolean supportsDuplicateFilterStrings()
Return attribute indicating if filters managed by this manager support nested duplicate filter strings. Same as isSupportsDuplicateFilterStrings()

Specified by:
supportsDuplicateFilterStrings in interface ISystemFilterPoolManager

setSupportsNestedFilters

public void setSupportsNestedFilters(boolean newSupportsNestedFilters)
Set attribute indicating if filter pools managed by this manager support nested filters, by default. Cascaded down to all pools, and all filters in all pools. Alternatively, just call it on the particular pool or filter it applies to.

Specified by:
setSupportsNestedFilters in interface ISystemFilterPoolManager

setSupportsDuplicateFilterStrings

public void setSupportsDuplicateFilterStrings(boolean newSupportsDuplicateFilterStrings)
Set attribute indicating if filters managed by this manager support duplicate filter strings, by default. Cascaded down to all pools, and all filters in all pools. Alternatively, just call it on the particular pool or filter it applies to.

Specified by:
setSupportsDuplicateFilterStrings in interface ISystemFilterPoolManager

setSupportsDuplicateFilterStringsGen

public void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings)


isStringsCaseSensitive

public boolean isStringsCaseSensitive()

Specified by:
isStringsCaseSensitive in interface ISystemFilterPoolManager
Returns:
The value of the StringsCaseSensitive attribute Are filter strings in this filter case sensitive?

areStringsCaseSensitive

public boolean areStringsCaseSensitive()
Same as isStringsCaseSensitive() Are filter strings in this filter case sensitive?

Specified by:
areStringsCaseSensitive in interface ISystemFilterPoolManager
Returns:
The value of the StringsCaseSensitive attribute

setStringsCaseSensitive

public void setStringsCaseSensitive(boolean newStringsCaseSensitive)
Set attribute indicating if filters managed by this manager support case-sensitive filter strings, by default. Cascaded down to all pools, and all filters in all pools. Alternatively, just call it on the particular pool or filter it applies to.

Specified by:
setStringsCaseSensitive in interface ISystemFilterPoolManager
Parameters:
newStringsCaseSensitive - The new value of the StringsCaseSensitive attribute

setStringsCaseSensitiveGen

public void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive)


setFilterPoolManager

protected void setFilterPoolManager()
Set transient variable pointing back to us. Called after restoring. Cascaded down to all pools, and all filters in all pools.


setSystemFilterPoolManagerData

public void setSystemFilterPoolManagerData(Object data)
This is to set transient data that is subsequently queryable.

Specified by:
setSystemFilterPoolManagerData in interface ISystemFilterPoolManager

getSystemFilterPoolManagerData

public Object getSystemFilterPoolManagerData()
Return transient data set via setFilterPoolData.

Specified by:
getSystemFilterPoolManagerData in interface ISystemFilterPoolManager

getSystemFilterPools

public ISystemFilterPool[] getSystemFilterPools()
Return array of SystemFilterPools managed by this manager.

Specified by:
getSystemFilterPools in interface ISystemFilterPoolManager

getSystemFilterPoolNames

public String[] getSystemFilterPoolNames()
Get list of filter pool names currently existing.

Specified by:
getSystemFilterPoolNames in interface ISystemFilterPoolManager

getSystemFilterPoolNamesVector

public Vector getSystemFilterPoolNamesVector()
Get list of filter pool names currently existing.

Specified by:
getSystemFilterPoolNamesVector in interface ISystemFilterPoolManager

createSystemFilterPool

public ISystemFilterPool createSystemFilterPool(String poolName,
                                                boolean isDeletable)
                                         throws Exception
Create a new filter pool. Inherits the following attributes from this manager:

If a pool of this name already exists, null will be returned.

Depending on the save policy, a new folder to hold the pool may be created. Its name will be derived from the pool name.

If the operation is successful, the pool will be saved to disk.

If this operation fails unexpectedly, an exception will be thrown.

Calls back to inform provider of this event

Specified by:
createSystemFilterPool in interface ISystemFilterPoolManager
Throws:
Exception

deleteSystemFilterPool

public void deleteSystemFilterPool(ISystemFilterPool pool)
                            throws Exception
Delete a given filter pool. Dependending on the save policy, the appropriate file or folder on disk will also be deleted.

Does the following:

Specified by:
deleteSystemFilterPool in interface ISystemFilterPoolManager
Parameters:
pool - The filter pool object to physically delete
Throws:
Exception

deleteAllSystemFilterPools

public void deleteAllSystemFilterPools()
Delete all existing filter pools. Call this when you are about to delete this manager, say.

Specified by:
deleteAllSystemFilterPools in interface ISystemFilterPoolManager

preTestRenameFilterPool

public boolean preTestRenameFilterPool(ISystemFilterPool pool)
                                throws Exception
Pre-test if we are going to run into any trouble renaming any of the files or folders used to persist a filter pool.

Specified by:
preTestRenameFilterPool in interface ISystemFilterPoolManager
Returns:
true if everything seems ok, false if a file/folder is in use.
Throws:
Exception

renameSystemFilterPool

public void renameSystemFilterPool(ISystemFilterPool pool,
                                   String newName)
                            throws Exception
Rename a given filter pool. Dependending on the save policy, the appropriate file or folder on disk will also be renamed.

Does the following:

Specified by:
renameSystemFilterPool in interface ISystemFilterPoolManager
Parameters:
pool - The filter pool object to physically rename
newName - The new name to give the pool
Throws:
Exception

copySystemFilterPool

public ISystemFilterPool copySystemFilterPool(ISystemFilterPoolManager targetMgr,
                                              ISystemFilterPool oldPool,
                                              String newName)
                                       throws Exception
Copy the specified filter pool from this manager to this manager or another manager.

Does the following:

Specified by:
copySystemFilterPool in interface ISystemFilterPoolManager
Parameters:
targetMgr - The target manager to copy our filter pool to. Can be this manager, but target pool name must be unique.
oldPool - The filter pool to copy
newName - The new name to give the copied pool
Returns:
the new copy
Throws:
Exception

moveSystemFilterPool

public ISystemFilterPool moveSystemFilterPool(ISystemFilterPoolManager targetMgr,
                                              ISystemFilterPool oldPool,
                                              String newName)
                                       throws Exception
Move the specified filter pool from this manager to another manager.

Does the following:

Specified by:
moveSystemFilterPool in interface ISystemFilterPoolManager
Parameters:
targetMgr - The target manager to move our filter pool to. Cannot be this manager.
oldPool - The filter pool to move
newName - The new name to give the moved pool
Returns:
the new copy of the moved system filter pool
Throws:
Exception

copySystemFilterPools

public void copySystemFilterPools(ISystemFilterPoolManager targetMgr)
                           throws Exception
Copy all filter pools from this manager to another manager.

Does the following:

Specified by:
copySystemFilterPools in interface ISystemFilterPoolManager
Parameters:
targetMgr - The target manager to copy our filter pools to
Throws:
Exception

getSystemFilterPool

public ISystemFilterPool getSystemFilterPool(String name)
Given a filter pool name, return that filter pool object. If not found, returns null.

Specified by:
getSystemFilterPool in interface ISystemFilterPoolManager

getFirstDefaultSystemFilterPool

public ISystemFilterPool getFirstDefaultSystemFilterPool()
Return the first pool that has the default attribute set to true. If none found, returns null.

Specified by:
getFirstDefaultSystemFilterPool in interface ISystemFilterPoolManager

createSystemFilter

public ISystemFilter createSystemFilter(ISystemFilterContainer parent,
                                        String aliasName,
                                        Vector filterStrings)
                                 throws Exception
Creates a new system filter within the given filter container (either a filter pool, or a filter). This creates the filter, and then saves the filter pool.

Calls back to inform provider of this event (filterEventFilterCreated)

Specified by:
createSystemFilter in interface ISystemFilterPoolManager
Parameters:
parent - The parent which is either a SystemFilterPool or a SystemFilter
aliasName - The name to give the new filter. Must be unique for this pool.
filterStrings - The list of String objects that represent the filter strings.
Throws:
Exception

createSystemFilter

public ISystemFilter createSystemFilter(ISystemFilterContainer parent,
                                        String aliasName,
                                        Vector filterStrings,
                                        String type)
                                 throws Exception
Creates a new system filter that is typed. Same as createSystemFilter(ISystemFilterContainer, String, Vector) but takes a filter type as an additional parameter.

A filter's type is an arbitrary string that is not interpreted or used by the base framework. This is for use entirely by tools who wish to support multiple types of filters and be able to launch unique actions per type, say.

Specified by:
createSystemFilter in interface ISystemFilterPoolManager
Parameters:
parent - The parent which is either a SystemFilterPool or a SystemFilter
aliasName - The name to give the new filter. Must be unique for this pool.
filterStrings - The list of String objects that represent the filter strings.
type - The type of this filter
Throws:
Exception

createSystemFilter

public ISystemFilter createSystemFilter(ISystemFilterContainer parent,
                                        String aliasName,
                                        Vector filterStrings,
                                        String type,
                                        boolean promptable)
                                 throws Exception
Creates a new system filter that is typed and promptable Same as createSystemFilter(ISystemFilterContainer, String ,Vector, String) but takes a boolean indicating if it is promptable.

A promptable filter is one in which the user is prompted for information at expand time. There is no base filter framework support for this, but tools can query this attribute and do their own thing at expand time.

Specified by:
createSystemFilter in interface ISystemFilterPoolManager
Parameters:
parent - The parent which is either a SystemFilterPool or a SystemFilter
aliasName - The name to give the new filter. Must be unique for this pool.
filterStrings - The list of String objects that represent the filter strings.
type - The type of this filter
promptable - Pass true if this is a promptable filter
Throws:
Exception

deleteSystemFilter

public boolean deleteSystemFilter(ISystemFilter filter)
                           throws Exception
Delete an existing system filter. Does the following:

Specified by:
deleteSystemFilter in interface ISystemFilterPoolManager
Throws:
Exception

renameSystemFilter

public void renameSystemFilter(ISystemFilter filter,
                               String newName)
                        throws Exception
Renames a filter. This is better than filter.setName(String newName) as it saves the parent pool to disk.

Does the following:

Does fire an event.

Specified by:
renameSystemFilter in interface ISystemFilterPoolManager
Throws:
Exception

updateSystemFilter

public void updateSystemFilter(ISystemFilter filter,
                               String newName,
                               String[] strings)
                        throws Exception
Updates a filter. This is better than doing it directly as it saves it to disk.

Does the following:

Specified by:
updateSystemFilter in interface ISystemFilterPoolManager
Throws:
Exception

setSystemFilterType

public void setSystemFilterType(ISystemFilter filter,
                                String newType)
                         throws Exception
Sets a filter's type. This is better than calling filter.setType(String) directly as it saves the filter to disk after.

A filter's type is an arbitrary string that is not interpreted or used by the base framework. This is for use entirely by tools who wish to support multiple types of filters and be able to launch unique actions per type, say.

Specified by:
setSystemFilterType in interface ISystemFilterPoolManager
Throws:
Exception

copySystemFilter

public ISystemFilter copySystemFilter(ISystemFilterPool targetPool,
                                      ISystemFilter oldFilter,
                                      String newName)
                               throws Exception
Copy a system filter to a pool in this or another filter manager.

Specified by:
copySystemFilter in interface ISystemFilterPoolManager
Throws:
Exception

moveSystemFilter

public ISystemFilter moveSystemFilter(ISystemFilterPool targetPool,
                                      ISystemFilter oldFilter,
                                      String newName)
                               throws Exception
Move a system filter to a pool in this or another filter manager. Does this by first copying the filter, and only if successful, deleting the old copy.

Specified by:
moveSystemFilter in interface ISystemFilterPoolManager
Throws:
Exception

getSystemFilterPosition

public int getSystemFilterPosition(ISystemFilter filter)
Return the zero-based position of a SystemFilter object within its container

Specified by:
getSystemFilterPosition in interface ISystemFilterPoolManager

moveSystemFilters

public void moveSystemFilters(ISystemFilter[] filters,
                              int delta)
                       throws Exception
Move existing filters a given number of positions in the same container. If the delta is negative, they are all moved up by the given amount. If positive, they are all moved down by the given amount.

Does the following:

Specified by:
moveSystemFilters in interface ISystemFilterPoolManager
Parameters:
filters - Array of SystemFilters to move.
Throws:
Exception

orderSystemFilters

public void orderSystemFilters(ISystemFilterPool pool,
                               String[] names)
                        throws Exception
Order filters according to user preferences.

While the framework has all the code necessary to arrange filters and save/restore that arrangement, you may choose to use preferences instead of this support. In this case, call this method and pass in the saved and sorted filter name list.

Called by someone after restore.

Specified by:
orderSystemFilters in interface ISystemFilterPoolManager
Throws:
Exception

addSystemFilterString

public ISystemFilterString addSystemFilterString(ISystemFilter filter,
                                                 String newString)
                                          throws Exception
Append a new filter string to the given filter's list

Does the following:

Specified by:
addSystemFilterString in interface ISystemFilterPoolManager
Throws:
Exception

addSystemFilterString

public ISystemFilterString addSystemFilterString(ISystemFilter filter,
                                                 String newString,
                                                 int position)
                                          throws Exception
Insert a new filter string to the its filters' list, at the given zero-based position

Does the following:

Specified by:
addSystemFilterString in interface ISystemFilterPoolManager
Throws:
Exception

removeSystemFilterString

public boolean removeSystemFilterString(ISystemFilter filter,
                                        String oldString)
                                 throws Exception
Delete a filter string from the given filter's list

Does the following:

Specified by:
removeSystemFilterString in interface ISystemFilterPoolManager
Returns:
true if given string was found and hence was deleted.
Throws:
Exception

removeSystemFilterString

public boolean removeSystemFilterString(ISystemFilter filter,
                                        ISystemFilterString filterString)
                                 throws Exception
Remove a filter string from this filter's list, given its SystemFilterString object.

Does the following:

Specified by:
removeSystemFilterString in interface ISystemFilterPoolManager
Returns:
true if the given string existed and hence was deleted.
Throws:
Exception

removeSystemFilterString

public boolean removeSystemFilterString(ISystemFilter filter,
                                        int position)
                                 throws Exception
Remove a filter string from the given filter's list, given its zero-based position

Does the following:

Specified by:
removeSystemFilterString in interface ISystemFilterPoolManager
Returns:
true if a string existed at the given position and hence was deleted.
Throws:
Exception

updateSystemFilterString

public void updateSystemFilterString(ISystemFilterString filterString,
                                     String newValue)
                              throws Exception
Update a filter string's string vale

Does the following:

Specified by:
updateSystemFilterString in interface ISystemFilterPoolManager
Throws:
Exception

getSystemFilterStringPosition

public int getSystemFilterStringPosition(ISystemFilterString filterString)
Return the zero-based position of a SystemFilterString object within its filter

Specified by:
getSystemFilterStringPosition in interface ISystemFilterPoolManager

copySystemFilterString

public ISystemFilterString copySystemFilterString(ISystemFilter targetFilter,
                                                  ISystemFilterString oldFilterString)
                                           throws Exception
Copy a system filter string to a filter in this or another filter pool manager.

Specified by:
copySystemFilterString in interface ISystemFilterPoolManager
Throws:
Exception

moveSystemFilterString

public ISystemFilterString moveSystemFilterString(ISystemFilter targetFilter,
                                                  ISystemFilterString oldFilterString)
                                           throws Exception
Move a system filter string to a filter in this or another filter pool manager. Does this by doing a copy operation, then if successful doing a delete operation.

Specified by:
moveSystemFilterString in interface ISystemFilterPoolManager
Throws:
Exception

moveSystemFilterStrings

public void moveSystemFilterStrings(ISystemFilterString[] filterStrings,
                                    int delta)
                             throws Exception
Move existing filter strings a given number of positions in the same filter If the delta is negative, they are all moved up by the given amount. If positive, they are all moved down by the given amount.

Does the following:

Specified by:
moveSystemFilterStrings in interface ISystemFilterPoolManager
Parameters:
filterStrings - Array of SystemFilterStrings to move.
Throws:
Exception

suspendCallbacks

public void suspendCallbacks(boolean suspend)
Suspend callbacks to the provider

Specified by:
suspendCallbacks in interface ISystemFilterPoolManager

getSaveFile

public IFile getSaveFile(ISystemFilterPool pool)
Return the save file that will be written for the given filter pool. Will depend on this manager's save policy.


commit

public boolean commit()
Save all the filter pools to disk. Uses the save policy specified in this manager's factory method.

Specified by:
commit in interface org.eclipse.rse.core.persistance.IRSEPersistableContainer
Returns:
true if the object was persisted.

commit

public boolean commit(ISystemFilterPool pool)
Save all the filter pools to disk. Uses the save policy specified in this manager's factory method.


restoreFromOneFile

protected static ISystemFilterPoolManager restoreFromOneFile(Logger logger,
                                                             IFolder mgrFolder,
                                                             String name,
                                                             IRSEFilterNamingPolicy namingPolicy)
                                                      throws Exception
Restore filter pools when all are stored in one file

Parameters:
logger - The logging object to log errors to
mgrFolder - The folder containing the file to restore from.
name - The name of the manager, from which the file name is derived.
namingPolicy - Naming prefix information for persisted data file names.
Throws:
Exception

getLogger

public Logger getLogger()
Return our logger


setLogger

public void setLogger(Logger logger)
Set our logger


logInfo

public void logInfo(String message)
Helper method for logging information

Parameters:
message - Message to be written to the log file

logWarning

public void logWarning(String message)
Helper method for logging warnings

Parameters:
message - Message to be written to the log file

logError

public void logError(String message,
                     Throwable exception)
Helper method for logging errors (exceptions)

Parameters:
message - Message to be written to the log file
exception - Any exception that generated the error condition, this will be used to print a stack trace in the log file.

logDebugMessage

public void logDebugMessage(String prefix,
                            String message)
Helper method for logging debug messages

Parameters:
message - Message to be written to the log file

logMessage

public void logMessage(String msg)
Deprecated. Use either logInfo, logWarning, logError, or logDebugMessage. This method now calls logInfo.

Helper method for logging trace information


toString

public String toString()

getName

public String getName()
Description copied from interface: ISystemFilterPoolManager
Return the name of this manager. This matches the name of the folder, which is the parent of the individual filter pool folders.

Specified by:
getName in interface ISystemFilterPoolManager

isSupportsNestedFilters

public boolean isSupportsNestedFilters()
Specified by:
isSupportsNestedFilters in interface ISystemFilterPoolManager
Returns:
The value of the SupportsNestedFilters attribute

getPools

public List getPools()
Specified by:
getPools in interface ISystemFilterPoolManager
Returns:
The list of Pools references

setNameGen

public void setNameGen(String newName)

setSupportsNestedFiltersGen

public void setSupportsNestedFiltersGen(boolean newSupportsNestedFilters)

isSupportsDuplicateFilterStrings

public boolean isSupportsDuplicateFilterStrings()
Specified by:
isSupportsDuplicateFilterStrings in interface ISystemFilterPoolManager
Returns:
The value of the SupportsDuplicateFilterStrings attribute

unsetSupportsDuplicateFilterStrings

public void unsetSupportsDuplicateFilterStrings()
Specified by:
unsetSupportsDuplicateFilterStrings in interface ISystemFilterPoolManager

isSetSupportsDuplicateFilterStrings

public boolean isSetSupportsDuplicateFilterStrings()
Specified by:
isSetSupportsDuplicateFilterStrings in interface ISystemFilterPoolManager
Returns:
true if the SupportsDuplicateFilterStrings attribute has been set

isSingleFilterStringOnly

public boolean isSingleFilterStringOnly()

Specified by:
isSingleFilterStringOnly in interface ISystemFilterPoolManager
Returns:
the value of the 'Single Filter String Only' attribute.
See Also:
ISystemFilterPoolManager.setSingleFilterStringOnly(boolean), org.eclipse.rse.filters.FiltersPackage#getSystemFilterPoolManager_SingleFilterStringOnly()

setSingleFilterStringOnly

public void setSingleFilterStringOnly(boolean newSingleFilterStringOnly)

Specified by:
setSingleFilterStringOnly in interface ISystemFilterPoolManager
Parameters:
newSingleFilterStringOnly - the new value of the 'Single Filter String Only' attribute.
See Also:
ISystemFilterPoolManager.isSingleFilterStringOnly()

isDirty

public boolean isDirty()
Description copied from interface: org.eclipse.rse.core.persistance.IRSEPersistableContainer
An object is dirty if a change has been made to it that requires it to be persisted.

Specified by:
isDirty in interface org.eclipse.rse.core.persistance.IRSEPersistableContainer
Returns:
true if the object is dirty

setDirty

public void setDirty(boolean flag)
Description copied from interface: org.eclipse.rse.core.persistance.IRSEPersistableContainer
An object is dirty if a change has been made to it that requires it to be persisted. Objects should usually mark themselves dirty when a persistable change is made. However, there may be a need to mark related objects dirty as well. Setting this value to false should be done only in the persistence manager after the object has been written to the DOM.

Specified by:
setDirty in interface org.eclipse.rse.core.persistance.IRSEPersistableContainer
Parameters:
flag - true if the object must be persisted.

wasRestored

public boolean wasRestored()
Description copied from interface: ISystemFilterPoolManager
Return false if the instantiation of this filter pool manager resulting in a new manager versus a restoration

Specified by:
wasRestored in interface ISystemFilterPoolManager

setWasRestored

public void setWasRestored(boolean flag)
Description copied from interface: org.eclipse.rse.core.persistance.IRSEPersistableContainer
The the "restored" state of the object. Only persistence managers should do this.

Specified by:
setWasRestored in interface org.eclipse.rse.core.persistance.IRSEPersistableContainer
Parameters:
flag - true if the object was restored.

RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.