Remote Systems
v6.4.1

com.ibm.etools.systems.core.ui.commands
Class SystemCmdSubstVarList

java.lang.Object
  extended bycom.ibm.etools.systems.core.ui.commands.SystemCmdSubstVarList
Direct Known Subclasses:
SystemUDASubstVarListCommon, UDSubstListCommonFiles, UDSubstListFiles, UDSubstListFolders, UniversalCompileSubstList

public class SystemCmdSubstVarList
extends Object


Field Summary
static String copyright
           
static String SUBST_PREFIX
          Typical substitution variable string prefix when using delimiters: "{"
static char SUBST_PREFIX_AMP
          Typical substitution variable prefix when using single prefix char: '&'
static char SUBST_PREFIX_BRACE
          Typical substitution variable char prefix when using delimiters: "{"
static char SUBST_PREFIX_DOLLAR
          Typical substitution variable char prefix when using delimiters: "$"
static char SUBST_SUFFIX_BRACE
          Typical substitution variable char suffix when using delimiters: "}"
 
Constructor Summary
SystemCmdSubstVarList(char prefix, String[] names, ResourceBundle rb, String rbKeyRoot)
          Constructor when using single prefix like '&'
SystemCmdSubstVarList(String[] names, ResourceBundle rb, String rbKeyRoot)
          Constructor when using ${xxx} delimiting, and not based on another list
SystemCmdSubstVarList(SystemCmdSubstVarList commonList, char prefix, String[] names, ResourceBundle rb, String rbKeyRoot)
          Constructor when using single prefix like '&', and based on another list Sometimes a substitution variable list contains common variables, plus some unique variables.
SystemCmdSubstVarList(SystemCmdSubstVarList commonList, String[] names, ResourceBundle rb, String rbKeyRoot)
          Constructor when using ${xxx} delimiting, and we are based on another list
 
Method Summary
 String[] doAllSubstitutions(Object context, ISystemSubstitutor substitutor)
          For testing purposes.
 String doSubstitutions(String commandString, Object context, ISystemSubstitutor substitutor)
          Given a command string potentially containing substitution variables, and a context object that represents something currently selected (say), this will scan the command string for matches on any of the substitution variables defined in this list.
 String[] getDisplayStrings()
          Return the list as an array of display strings of the form xx - some text
 SystemCmdSubstVar[] getListAsArray()
          Return the list of variables as an array of SystemCmdSubstVar objects
 void init(SystemCmdSubstVarList commonList, String[] names, ResourceBundle rb, String rbKeyRoot)
          Abstraction of common stuff done by all constructors.
 void printDisplayStrings()
          For debugging purposes, writes the list of variables to standard out
 void printDisplayStrings(PrintWriter stream)
          For whatever purpose, writes the list of variables to given stream
 void testForDuplicates()
          Helper method to test for duplicate variables
 String toString()
          This writes out the class name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

copyright

public static final String copyright
See Also:
Constant Field Values

SUBST_PREFIX_AMP

public static final char SUBST_PREFIX_AMP
Typical substitution variable prefix when using single prefix char: '&'

See Also:
Constant Field Values

SUBST_PREFIX_DOLLAR

public static final char SUBST_PREFIX_DOLLAR
Typical substitution variable char prefix when using delimiters: "$"

See Also:
Constant Field Values

SUBST_PREFIX_BRACE

public static final char SUBST_PREFIX_BRACE
Typical substitution variable char prefix when using delimiters: "{"

See Also:
Constant Field Values

SUBST_PREFIX

public static final String SUBST_PREFIX
Typical substitution variable string prefix when using delimiters: "{"

See Also:
Constant Field Values

SUBST_SUFFIX_BRACE

public static final char SUBST_SUFFIX_BRACE
Typical substitution variable char suffix when using delimiters: "}"

See Also:
Constant Field Values
Constructor Detail

SystemCmdSubstVarList

public SystemCmdSubstVarList(char prefix,
                             String[] names,
                             ResourceBundle rb,
                             String rbKeyRoot)
Constructor when using single prefix like '&'


SystemCmdSubstVarList

public SystemCmdSubstVarList(SystemCmdSubstVarList commonList,
                             char prefix,
                             String[] names,
                             ResourceBundle rb,
                             String rbKeyRoot)
Constructor when using single prefix like '&', and based on another list Sometimes a substitution variable list contains common variables, plus some unique variables. In this case, use this construction, and pass in the list object for the common variables.


SystemCmdSubstVarList

public SystemCmdSubstVarList(String[] names,
                             ResourceBundle rb,
                             String rbKeyRoot)
Constructor when using ${xxx} delimiting, and not based on another list


SystemCmdSubstVarList

public SystemCmdSubstVarList(SystemCmdSubstVarList commonList,
                             String[] names,
                             ResourceBundle rb,
                             String rbKeyRoot)
Constructor when using ${xxx} delimiting, and we are based on another list

Method Detail

init

public void init(SystemCmdSubstVarList commonList,
                 String[] names,
                 ResourceBundle rb,
                 String rbKeyRoot)
Abstraction of common stuff done by all constructors.


getListAsArray

public SystemCmdSubstVar[] getListAsArray()
Return the list of variables as an array of SystemCmdSubstVar objects


getDisplayStrings

public String[] getDisplayStrings()
Return the list as an array of display strings of the form xx - some text


printDisplayStrings

public void printDisplayStrings()
For debugging purposes, writes the list of variables to standard out


printDisplayStrings

public void printDisplayStrings(PrintWriter stream)
For whatever purpose, writes the list of variables to given stream


doSubstitutions

public String doSubstitutions(String commandString,
                              Object context,
                              ISystemSubstitutor substitutor)
Given a command string potentially containing substitution variables, and a context object that represents something currently selected (say), this will scan the command string for matches on any of the substitution variables defined in this list. For each match it calls the given implementor of ISystemSubstitutor to retrieve the value to replace the substitution variable with. The substitutor is also given the context object passed in here.

Currently this assume all variables use the prefix given in the constructor, as it optimizes performance. Another flavour would be needed if arbitrary prefixes were to supported!

Further, this also currently assumes a doubled up prefix is used for escaping, meaning the first prefix is to be removed, the next is to be left unsubstituted.

Parameters:
commandString - - the command from the user action, that contains vars to be substituted
context - - a selected object
substitutor - - an object that knows how to do substitutions. A callback.

doAllSubstitutions

public String[] doAllSubstitutions(Object context,
                                   ISystemSubstitutor substitutor)
For testing purposes. Given the selected object, this returns an array of strings, one for each substitution variable, of the form "varname = substituted-value".

Parameters:
context - - a selected object
substitutor - - an object that knows how to do substitutions. A callback

testForDuplicates

public void testForDuplicates()
Helper method to test for duplicate variables


toString

public String toString()
This writes out the class name.


Remote Systems
v6.4.1

Copyright © 2005 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.