Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.comm.filters
Class ISeriesObjectFilterString

java.lang.Object
  extended by com.ibm.etools.iseries.comm.filters.ISeriesAbstractFilterString
      extended by com.ibm.etools.iseries.comm.filters.ISeriesObjectFilterString
Direct Known Subclasses:
ISeriesLibraryFilterString

public class ISeriesObjectFilterString
extends ISeriesAbstractFilterString

A class representing an AS/400 Object filter string. This is a name pattern for returning lists of AS/400 objects when used as input to the ISeriesListObjects class (specifically the getList methods in this class).

Getting a list of objects requires the library name to list in, the name pattern for the objects and optionally one or more object type and object attribute pairs to use in subsetting the list.

All this information can be specified by calling setLibrary(String), setObject(String) and the setObjectType(String) methods. Alternatively, it can be set by passing in a filter string in the constructor.

Filter strings for objects are of the form: lib/obj OBJTYPE(type:attr type:attr ...) where:

Valid generic library names, object names and attributes are names with one or two asterisks anywhere in the name, as in: ABC* or *ABC or A*C *ABC* or *A*C or A*C*

To get the actual filter string back from objects of this class, just call toString().

Objects of this class are used in the ISeriesListObjects class for returning a list of information about each object meeting the filter's criteria.

See Also:
ISeriesListObjects

Field Summary
static String ALL
          Default value for object name is *
static String Copyright
           
static String DEFAULT_LIBRARY
          Default library name is *CURLIB
static String DEFAULT_OBJTYPE
          Default value for OBJTYPE is *:*
 
Fields inherited from class com.ibm.etools.iseries.comm.filters.ISeriesAbstractFilterString
WILDCARD
 
Constructor Summary
ISeriesObjectFilterString()
          Constructor to use when there is no existing filter string.
ISeriesObjectFilterString(String input)
          Constructor to use when filter string already exists.
Filter strings for objects are of the form: lib/obj OBJTYPE(type:attr type:attr ...).
 
Method Summary
 String getLibrary()
          Return the library name part of this filter string.
 String getObject()
          Return the object name part of this filter string.
 String getObjectType()
          Return the object type as a blank-delimited list of type:attr pairs.
 String[] getObjectTypeArray()
          Return this filter string's type:attr values as an array of strings.
 ISeriesObjectTypeAttrList getObjectTypeAttrList()
          Return this filter string's type:attr values as an ISeriesObjectTypeAttrList object.
 boolean isGeneric()
          Returns true if current filter represents a generic name versus a scalar name.
 boolean isMultiGeneric()
          Returns true if current filter represents a generic name that has more than one generic name part.
 boolean isMultiTyped()
          Return true if this is a multi-typed filter.
 boolean matchesType(String type)
          Given an object type, attempt to determine if this type will match this filter, ignoring all other information such as attributes.
 void setLibrary(String lib)
          Set the library name part of this filter string.
 void setObject(String obj)
          Set the object name part of this filter string.
 void setObjectType(String type)
          Set the object type part of this filter string.
 void setObjectTypeAttrList(ISeriesObjectTypeAttrList types)
          Set the object type part of this filter string, given an ISeriesObjectTypeAttrList object.
 void setObjectTypes(String[] types)
          Set the object type part of this filter string, given an array of type:attr strings.
 String toString()
          Convert this filter into a filter string.
 String toStringFull()
          Same as toString(), but allows one method that works consistently for us and our child class ISeriesLibraryFilterString.
static boolean verifyObjectType(String type)
          Utility method to ensure an object type is syntactically valid.
 
Methods inherited from class com.ibm.etools.iseries.comm.filters.ISeriesAbstractFilterString
addQuotes, clone, countHostOccurrencesOf, countOccurrencesOf, createFilterStringObject, equals, hashCode, hostIndexOf, hostIndexOf, isGenericLibraryName, isGenericName, isQuoted, stripQuotes, verifyGenericName, verifyGenericNameAdvanced, verifyGenericNameAdvancedQuoted, verifyGenericNameQuoted
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

DEFAULT_LIBRARY

public static final String DEFAULT_LIBRARY
Default library name is *CURLIB

See Also:
Constant Field Values

DEFAULT_OBJTYPE

public static final String DEFAULT_OBJTYPE
Default value for OBJTYPE is *:*

See Also:
Constant Field Values

ALL

public static final String ALL
Default value for object name is *

See Also:
Constant Field Values
Constructor Detail

ISeriesObjectFilterString

public ISeriesObjectFilterString()
Constructor to use when there is no existing filter string. This results in a default filter of *CURLIB/* OBJTYPE(*:*). To change any of the default values call:
  • setLibrary(String) to set the library name. Note this can be generic too, but this will result in a call to retrieve objects in every library matching the library name pattern.
  • setObject(String) to set the object name. This can be a simple or generic name. Valid generic names have one or two asterisks anywhere in the name.
  • setObjectType(String) to set the object type and attribute pairs. This will result in a list of objects subsetted to only those which match one of the given type and attribute pairs.


  • ISeriesObjectFilterString

    public ISeriesObjectFilterString(String input)
    Constructor to use when filter string already exists.
    Filter strings for objects are of the form: lib/obj OBJTYPE(type:attr type:attr ...).
  • lib is the library containing the objects to list. This can be a single library name or a generic library name like *ABC or *ROLL*. Special values supported for library are *LIBL, *CURLIB, *USRLIBL and *ALLUSR.
  • obj is the name or generic name of the objects to list.
  • TYPE specifies a single or generic member type to subset the list, as in RPGLE or RPG* or * for no subsetting by type.
  • OBJTYPE is optional and used to refine the returned list. The parms to OBJTYPE are one or more space-delimited type:attr pairs identifying the object type and attribute. Only items matching one of the type:attr pairs are returned. The :attr part is optional and if omitted is the same as type:*. Note the type must be a valid AS/400 object type, while the attribute must be a valid attribute for that type or a generic attribute as in PF-*. Valid generic library names, file names and types are names with one or two asterisks anywhere in the name, as in: ABC* or *ABC or A*C *ABC* or *A*C or A*C* To get the actual filter string from object of this class, just call toString().

  • Method Detail

    isMultiTyped

    public boolean isMultiTyped()
    Return true if this is a multi-typed filter. A multi-typed filter supplies more than one type, each with an optional filter. Eg: OBJTYPE("*FILE:PF* *PGM:RPG* *PGM:CBLLE"). If multiple types are specified then OBJATTR is ignored.


    getLibrary

    public String getLibrary()
    Return the library name part of this filter string.


    getObject

    public String getObject()
    Return the object name part of this filter string.


    getObjectType

    public String getObjectType()
    Return the object type as a blank-delimited list of type:attr pairs. You may find it easier to use getObjectTypeArray().

    See Also:
    setObjectType(String)

    getObjectTypeArray

    public String[] getObjectTypeArray()
    Return this filter string's type:attr values as an array of strings.


    getObjectTypeAttrList

    public ISeriesObjectTypeAttrList getObjectTypeAttrList()
    Return this filter string's type:attr values as an ISeriesObjectTypeAttrList object.

    See Also:
    ISeriesObjectTypeAttrList

    setLibrary

    public void setLibrary(String lib)
    Set the library name part of this filter string. This can be simple or generic, where generic is a name containing one or two asterisks anywhere in the name. If a generic library, such as *LIBL or A*, is specified then you will have a "multi-generic" name that will result in one trip to the host for every library matching the filter. For each trip, the same object filter will be passed. The results will be concatenated together.

    See Also:
    ISeriesListObjects

    setObject

    public void setObject(String obj)
    Set the object name part of this filter string. This can be simple or generic, where generic is a name containing one or two asterisks anywhere in the name.


    setObjectType

    public void setObjectType(String type)
    Set the object type part of this filter string. This must be a valid AS/400 object type such as *FILE. This is used to refine the list. Object filters can be multi-typed. A multi-typed filter supplies more than one type, each with an optional filter. Eg: OBJTYPE("*FILE *PGM *MSGF"). Optionally, an attribute can be appended to some or all types, as in: OBJTYPE("*FILE:PF* *PGM:RPG* *MSGF"). The attribute can be generic. The same type can also be specified multiple times, each with a different attribute, as in: OBJTYPE("*PGM:RPG* *PGM:CBL"). If multiple types are specified then OBJATTR is ignored. Multiple types also must be enclosed in double quotes.


    setObjectTypes

    public void setObjectTypes(String[] types)
    Set the object type part of this filter string, given an array of type:attr strings.


    setObjectTypeAttrList

    public void setObjectTypeAttrList(ISeriesObjectTypeAttrList types)
    Set the object type part of this filter string, given an ISeriesObjectTypeAttrList object.

    See Also:
    ISeriesObjectTypeAttrList

    toString

    public String toString()
    Convert this filter into a filter string. Filter strings for objects are of the form: lib/obj OBJTYPE(type) OBJATTR(attr) lib/obj OBJTYPE(type:attr type:attr). where is a generic object name, and is optional and used to refine the returned list. The parms to OBJTYPE are one or more type:attr pairs identifying the object type and attribute. Only items matching one of the type:attr pairs are returned. The :attr part is optional and if omitted is the same as type:*. Note the type must be a valid AS/400 object type, while the attribute must be a valid attribute for that type or a generic attribute as in PF-*.

    Specified by:
    toString in class ISeriesAbstractFilterString

    toStringFull

    public String toStringFull()
    Same as toString(), but allows one method that works consistently for us and our child class ISeriesLibraryFilterString.


    isGeneric

    public boolean isGeneric()
    Returns true if current filter represents a generic name versus a scalar name. This is true if either the library or the object names are generic. A valid generic name has one or two asterisks anywhere in the name.

    Specified by:
    isGeneric in class ISeriesAbstractFilterString

    isMultiGeneric

    public boolean isMultiGeneric()
    Returns true if current filter represents a generic name that has more than one generic name part. For example, a multi-generic filter might ask to list all objects that start with A (A*) in all libraries that start with B (B*).

    Is *LIBL a generic library name? Well, for our purposes it is. It means list all objects meeting the object filter, in all libraries on the library list.

    This returns true if the library name is generic, but not if it is *CURLIB.

    Specified by:
    isMultiGeneric in class ISeriesAbstractFilterString

    verifyObjectType

    public static boolean verifyObjectType(String type)
    Utility method to ensure an object type is syntactically valid. No point in being too overzealous so we just check for:
  • starts with an asterisk and has only that one asterisk
  • is not quoted
  • is only 10 characters long Note this method will also return false if the input is null or zero length.


  • matchesType

    public boolean matchesType(String type)
    Given an object type, attempt to determine if this type will match this filter, ignoring all other information such as attributes.

    Parameters:
    A - non-generic object type as in "*FILE".

    Rational Developer for Power Systems Software
    V7.6

    Copyright 2011 IBM Corp. All Rights Reserved.

    Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.