From 54b801b1c9c13d6bc39a67f076ca7120f25891d7 Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Wed, 19 Dec 2007 19:56:44 +0000 Subject: [PATCH] [cleanup] javadoc and code style, remove dead code, mark methods deprecated --- .../rse/core/filters/ISystemFilter.java | 83 +++-- .../rse/core/filters/ISystemFilterPool.java | 18 +- .../rse/core/filters/SystemFilterSimple.java | 90 +---- .../internal/core/filters/SystemFilter.java | 344 ++++++------------ 4 files changed, 183 insertions(+), 352 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilter.java index d7ff35daad9..583a93caca3 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilter.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2007 IBM Corporation and others. + * Copyright (c) 2003, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,7 +12,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * David Dykstal (IBM) - cleanup format and javadoc *******************************************************************************/ package org.eclipse.rse.core.filters; @@ -24,40 +24,15 @@ import org.eclipse.rse.core.model.IRSEModelObject; import org.eclipse.rse.core.references.IRSEReferencedObject; /** - * A representation of the model object 'System Filter'. * A filter consists of filter strings and may be contained in a filter pool. - * Filter pools will be referenced by subsystems. + * Filter pools are referenced by subsystems. * Subsystems are responsible for interpreting the filters. Filters, in and * of themselves, provide no interpretation of themselves when applied * to the resources managed by a subsystem. - *

- * The following features are supported: - *

- *

- * - */ -/** - * @lastgen interface SystemFilterPool extends SystemReferencedObject, SystemFilterContainer {} */ + public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContainer, IRSEModelObject { + /** * Returns the value of the 'Name' attribute. * @@ -138,8 +113,11 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * Returns the value of the 'Relative Order' attribute. * *

- * If the meaning of the 'Relative Order' attribute isn't clear, - * there really should be more of a description here... + * The relative order of a filter is intended to be used + * by a persistence mechanism to keep the filters in a particular order + * when restoring them into a filter pool. Filters with higher numbers should + * occur later in the pool. It may be employed in the absence of another + * mechanism for maintaining order. *

* * @return the value of the 'Relative Order' attribute. @@ -150,6 +128,11 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getRelativeOrder Relative Order}' attribute. * + * The relative order of a filter is intended to be used + * by a persistence mechanism to keep the filters in a particular order + * when restoring them into a filter pool. Filters with higher numbers should + * occur later in the pool. It may be employed in the absence of another + * mechanism for maintaining order. * * @param value the new value of the 'Relative Order' attribute. * @see #getRelativeOrder() @@ -160,8 +143,11 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * Returns the value of the 'Default' attribute. * *

- * If the meaning of the 'Default' attribute isn't clear, - * there really should be more of a description here... + * This filter is a "default" filter in this filter pool. + * The meaning of "default" is determined by the subsystem in which it is deployed. + * It typically means that the filter is supplied by the subsystem at the time the subsystem is created. + * That is, the filter is "vendor supplied". + * There is no restriction on the number of default filters in a pool. *

* * @return the value of the 'Default' attribute. @@ -172,6 +158,11 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isDefault Default}' attribute. * + * Make this filter is a "default" filter in this filter pool. + * The meaning of "default" is determined by the subsystem in which it is deployed. + * It typically means that the filter is supplied by the subsystem at the time the subsystem is created. + * That is, the filter is "vendor supplied". + * There is no restriction on the number of default filters in a pool. * * @param value the new value of the 'Default' attribute. * @see #isDefault() @@ -187,6 +178,10 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * case sensitive. * This attribute is optional and may be known (set) or unknown (unset). *

+ *

+ * If unset the value + * returned is from the parent filter pool. + *

* * @return the value of the 'Strings Case Sensitive' attribute. * @see #isSetStringsCaseSensitive() @@ -204,6 +199,9 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * case sensitive. * This attribute is optional and may be known (set) or unknown (unset). *

+ *

+ * This will cause this attribute to be set in this filter. + *

* * @param value the new value of the 'Strings Case Sensitive' attribute. * @see #isSetStringsCaseSensitive() @@ -220,6 +218,8 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * to indicate whether or not comparisons involving the filter should be considered * case sensitive. * This attribute is optional and may be known (set) or unknown (unset). + *

+ * Causes this filter to use the value specified by the parent filter pool. *

* * @see #isSetStringsCaseSensitive() @@ -236,6 +236,9 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * to indicate whether or not comparisons involving the filter should be considered * case sensitive. * This attribute is optional and may be known (set) or unknown (unset). + *

+ * This will be true if this attribute is explicitly specified for this filter. It will be false if this + * is being inherited from the parent filter pool. *

* * @return whether the value of the 'Strings Case Sensitive' attribute is set. @@ -452,8 +455,8 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * filter contains only one string. May, alternatively, be enforced * by the filter implementation. *

- * This attribute may be set or unset. If unset then this value must not be - * relied upon. + * This attribute may be set or unset. If unset this value will be inherited + * from the parent filter pool. *

* * @return the value of the 'Single Filter String Only' attribute. @@ -472,8 +475,8 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * filter contains only one string. May, alternatively, be enforced * by the filter implementation. *

- * This attribute may be set or unset. If unset then this value must not be - * relied upon. + * This causes the attribute to be set for this filter, ignoring the value + * specified for the parent filter pool. *

* * @param value the new value of the 'Single Filter String Only' attribute. @@ -486,6 +489,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai /** * Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly Single Filter String Only}' attribute. * + * This causes the value of this attribute to be inherited from the parent filter pool. * * @see #isSetSingleFilterStringOnly() * @see #isSingleFilterStringOnly() @@ -496,6 +500,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai /** * Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly Single Filter String Only}' attribute is set. * + * If true then the value of this attribute is set in this filter. If false it is inherited from the parent filter pool. * * @return whether the value of the 'Single Filter String Only' attribute is set. * @see #unsetSingleFilterStringOnly() @@ -550,7 +555,7 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * * @return the value of the 'Strings' containment reference list. */ - java.util.List getStrings(); + List getStrings(); /** * @return the parent pool of this filter. For nested filters, this will walk up the parent chain diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPool.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPool.java index b08169a5f2b..f922e4bd62b 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPool.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPool.java @@ -194,19 +194,20 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys void setDefault(boolean value); /** - * @generated This field/method will be replaced during code generation + * Sets the attribute for this filter pool that determines whether strings of + * filters contained in this pool are case sensitive or not. If not set + * this attribute is inherited from the containing filter pool manager. * @param value The new value of the StringsCaseSensitive attribute */ void setStringsCaseSensitive(boolean value); /** - * @generated This field/method will be replaced during code generation - * Unsets the StringsCaseSensitive attribute + * Unsets the StringsCaseSensitive attribute. Causes the case sensitivity of the + * filter pool to be determined by its filter pool manager. */ void unsetStringsCaseSensitive(); /** - * @generated This field/method will be replaced during code generation * @return true if the StringsCaseSensitive attribute has been set */ boolean isSetStringsCaseSensitive(); @@ -247,8 +248,8 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys * Returns the value of the 'Single Filter String Only' attribute. * *

- * If the meaning of the 'Single Filter String Only' attribute isn't clear, - * there really should be more of a description here... + * If true then filters in this filter pool can have only a single filter string unless the + * filter has overriden this attribute. *

* * @return the value of the 'Single Filter String Only' attribute. @@ -261,6 +262,8 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#isSingleFilterStringOnly Single Filter String Only}' attribute. * + * If set to true filters in this filter pool can hold only a single filter string unless overridden by the filter itself. + * If false then the filter may hold more than one filter string. * * @param value the new value of the 'Single Filter String Only' attribute. * @see #isSetSingleFilterStringOnly() @@ -273,6 +276,7 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys /** * Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#isSingleFilterStringOnly Single Filter String Only}' attribute. * + * Causes the value of the single filter string attribute to be inherited from the containing filter pool manager. * * @see #isSetSingleFilterStringOnly() * @see #isSingleFilterStringOnly() @@ -284,6 +288,8 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys /** * Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilterPool#isSingleFilterStringOnly Single Filter String Only}' attribute is set. * + * This will be true if this attribute has been set for this filter pool. It will be false if this + * attribute is inherited from the filter pool manager. * * @return whether the value of the 'Single Filter String Only' attribute is set. * @see #unsetSingleFilterStringOnly() diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterSimple.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterSimple.java index 57e5c71f82f..9e2875f536f 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterSimple.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterSimple.java @@ -31,13 +31,11 @@ import org.eclipse.rse.core.model.ISystemContentsType; import org.eclipse.rse.internal.core.filters.SystemFilter; /** - * A lightweight override of the full-fledged persistable implementation of SystemFilter. - * This class replaces the heavy-weight MOF implementations with simple non-MOF - * implementations. + * A lightweight implementation of ISystemFilter. *

- * This flavour of SystemFilter implementation is for those cases where a simple in-memory - * SystemFilter is needed temporarily, perhaps to populate a GUI widget say, and the filter - * does not need to be savable/restorable. As a result there is no mof, and no need for a + * This flavor is for those cases where a simple in-memory + * ISystemFilter is needed temporarily, perhaps to populate a GUI widget say, and the filter + * does not need to be savable/restorable. As a result there is no need for a * parent SystemFilterPool or SystemFilterPoolManager. The class is small, simple and * directly instantiable. *

@@ -56,43 +54,27 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer private String type = null; private boolean caseSensitive = false; private boolean promptable = false; - private Object parent; - private boolean isStale; + private boolean isStale = true; + private Object parent = null; private List filterStrings = new ArrayList(3); - private HashMap cachedContents; + private HashMap cachedContents = new HashMap(); /** - * Constructor for SystemFilterSimpleImpl + * Constructor for SystemFilterSimple */ public SystemFilterSimple(String name) { - //super(); this.name = name; -// filterStringVector = new Vector(); - isStale = true; - cachedContents = new HashMap(); } -// protected void invalidateCache() -// { -// filterStringArray = null; -// filterStringObjectArray = null; -// //filterStringVector = null; -// } - - /** - * Return true if this a transient or simple filter that is only created temporary "on the fly" - * and not intended to be saved or part of the filter framework. Eg it has no manager or provider. - *

- * We always return true + /* (non-Javadoc) + * @see org.eclipse.rse.internal.core.filters.SystemFilter#isTransient() */ public boolean isTransient() { return true; } - /** - * Clones a given filter to the given target filter. - * All filter strings, and all nested filters, are copied. - * @param targetFilter new filter into which we copy all our data + /* (non-Javadoc) + * @see org.eclipse.rse.internal.core.filters.SystemFilter#clone(org.eclipse.rse.core.filters.ISystemFilter) */ public void clone(ISystemFilter targetFilter) { super.clone(targetFilter); @@ -104,15 +86,13 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer // contains a single filter string so these methods // make it easier to set/get that filter string // ------------------------------------------------------- + /** * Set the single filter string */ public void setFilterString(String filterString) { filterStrings.clear(); filterStrings.add(filterString); -// filterStringVector.clear(); -// filterStringVector.addElement(filterString); -// invalidateCache(); } /** @@ -122,10 +102,6 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer public String getFilterString() { String result = filterStrings.isEmpty() ? null : (String) filterStrings.get(0); return result; -// if (filterStringVector.size() == 0) -// return null; -// else -// return (String)filterStringVector.elementAt(0); } /** @@ -219,13 +195,6 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer String[] result = new String[filterStrings.size()]; filterStrings.toArray(result); return result; -// if (filterStringArray == null) -// { -// filterStringArray = new String[filterStringVector.size()]; -// for (int idx=0; idx 0; -// return (filterStringVector.size() > 0); } // --------------------- @@ -528,14 +474,14 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer isStale = false; } - /** + /* * @see org.eclipse.rse.core.model.ISystemContainer#getContents(org.eclipse.rse.core.model.ISystemContentsType) */ public Object[] getContents(ISystemContentsType contentsType) { return (Object[]) cachedContents.get(contentsType); } - /** + /* * @see org.eclipse.rse.core.model.ISystemContainer#hasContents(org.eclipse.rse.core.model.ISystemContentsType) */ public boolean hasContents(ISystemContentsType contentsType) { @@ -545,21 +491,21 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer return false; } - /** + /* * @see org.eclipse.rse.core.model.ISystemContainer#isStale() */ public boolean isStale() { return isStale; } - /** + /* * @see org.eclipse.rse.core.model.ISystemContainer#markStale(boolean) */ public void markStale(boolean isStale) { markStale(isStale, true); } - /** + /* * @see org.eclipse.rse.core.model.ISystemContainer#markStale(boolean) */ public void markStale(boolean isStale, boolean clearCache) { diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java index bdefd2c2d41..17a4b6a117a 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java @@ -47,9 +47,6 @@ import org.eclipse.rse.internal.references.SystemReferencedObject; * A filter is an encapsulation of a unique name, and a list of filter strings. * Filters can be referenced. */ -/** - * @lastgen class SystemFilterImpl extends SystemReferencedObjectImpl implements SystemFilter, SystemReferencedObject, SystemFilterContainer, IAdaptable {} - */ public class SystemFilter extends SystemReferencedObject implements ISystemFilter, IAdaptable { private SystemFilterContainerCommonMethods helpers = null; @@ -70,7 +67,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte private int release = 0; private boolean singleFilterStringOnly = false; private List nestedFilters = new ArrayList(3); -// private List strings = null; private ISystemFilter _parentFilter; /** @@ -106,20 +102,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte return type; } - /* - * Creates a new nested system filter within this filter - * @param parentPool the SystemFilterPool that owns the root filter. - * @param data Optional transient data to be stored in the new filter. Can be null. - * @param aliasName The name to give the new filter. Must be unique for this pool. - * @param filterStrings The list of String objects that represent the filter strings. - * - public SystemFilter createSystemFilter(SystemFilterPool parentPool, Object data, String aliasName, Vector filterStrings) - { - SystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), parentPool, data, aliasName, filterStrings); - newFilter.setSupportsNestedFilters(true); // presumably it does since it is nested itself. - return newFilter; - }*/ - /** * Creates a new nested system filter within this filter. * This filter will inherit/store the following attributes from this filter: @@ -157,7 +139,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte */ public void clone(ISystemFilter targetFilter) { // clone attributes - //targetFilter.setName(getName()); + // targetFilter.setName(getName()); name is not cloned, we assume the target filter already has a name targetFilter.setDefault(isDefault()); targetFilter.setType(getType()); targetFilter.setPromptable(isPromptable()); @@ -373,9 +355,11 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte public void setParentFilterPool(ISystemFilterPool parentPool) { this.parentPool = parentPool; ISystemFilter[] filters = getSystemFilters(); - if (filters != null) for (int idx = 0; idx < filters.length; idx++) - filters[idx].setParentFilterPool(parentPool); - // todo: decide if SystemFilterString objects need it too + if (filters != null) { + for (int idx = 0; idx < filters.length; idx++) { + filters[idx].setParentFilterPool(parentPool); + } + } } /** @@ -387,24 +371,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte return (parentFilter != null) ? (ISystemFilterContainer) parentFilter : (ISystemFilterContainer) getParentFilterPool(); } - /** - * Internal way to return emf-modelled list of filter strings. - * We use this so we can easily change to non-mof if we decide to. - */ -// private List internalGetFilterStrings() -// { -// return getStrings(); -// } - /** - * Clear internal cache so it will be rebuilt on next request. - */ -// protected void invalidateCache() -// { -// filterStringArray = null; -// filterStringObjectArray = null; -// filterStringVector = null; -// setDirty(true); -// } /** * Returns the filter strings of this filter as an array of String objects. * The array may be empty but will not be null. @@ -419,20 +385,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte return result; } -// public String[] getFilterStrings() -// { -// if (filterStringArray == null) -// { -// List el = internalGetFilterStrings(); -// filterStringArray = new String[el.size()]; -// Iterator i = el.iterator(); -// int idx = 0; -// while (i.hasNext()) -// filterStringArray[idx++] = ((ISystemFilterString)(i.next())).getString(); -// } -// return filterStringArray; -// } - /** * Return filter strings as a Vector of String objects. * This vector may be empty but will never be null. @@ -444,19 +396,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte return result; } -// public Vector getFilterStringsVector() -// { -// if (filterStringVector == null) -// { -// List el = internalGetFilterStrings(); -// Iterator i = el.iterator(); -// filterStringVector = new Vector(); -// while (i.hasNext()) -// filterStringVector.addElement(((ISystemFilterString)(i.next())).getString()); -// } -// return filterStringVector; -// } - /** * Get this filter's filter strings as a Vector of FilterString objects */ @@ -464,13 +403,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte Vector result = new Vector(filterStrings.size()); result.addAll(filterStrings); return result; -// -// List el = internalGetFilterStrings(); -// Iterator i = el.iterator(); -// Vector filterStringVector = new Vector(); -// while (i.hasNext()) -// filterStringVector.addElement(i.next()); -// return filterStringVector; } /** @@ -478,7 +410,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte */ public int getFilterStringCount() { return filterStrings.size(); -// return internalGetFilterStrings().size(); } /** @@ -514,38 +445,15 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte filterStrings.add(filterString); } setDirty(true); -// List strings = internalGetFilterStrings(); -// strings.clear(); -// for (int idx=0; idx