Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.rse.ui.uda
Class IFSUDActionSubsystem

java.lang.Object
  extended by SystemUDActionSubsystem
      extended by com.ibm.etools.iseries.rse.ui.uda.QSYSUDActionSubsystem
          extended by com.ibm.etools.iseries.rse.ui.uda.IFSUDActionSubsystem

public class IFSUDActionSubsystem
extends QSYSUDActionSubsystem

Specialization of universal file user action support for IFS


Field Summary
static String ATTR_QSYSCmd
          Attribute containing the command type.
static String copyright
           
static int DOMAIN_FILE
           
static int DOMAIN_FOLDER
           
 
Fields inherited from class com.ibm.etools.iseries.rse.ui.uda.QSYSUDActionSubsystem
ATTR_RUNENV, Copyright, msgs, RUNENV_BATCH, RUNENV_INTERACTIVE, RUNENV_NORMAL, TEMPMBR_FILE, TEMPMBR_LIB
 
Constructor Summary
IFSUDActionSubsystem()
          Constructor for UDActionSubsystemIFS.
 
Method Summary
protected  Object collectNames(Shell shell, Iterator elements, StringBuffer collectedNames)
          When processing an action that has elected to be invoked only once, versus once per selected object, we call this method to collect the names of the selected objects into a single string buffer.
protected  boolean doActionsMigration(ISystemProfile profile, String oldRelease)
          Overridable extension point for child classes to do migration of their actions.
protected  boolean doTypesMigration(ISystemProfile profile, String oldRelease)
          Overridable extension point for child classes to do migration of their types.
 SystemCmdSubstVarList getActionSubstVarList(int actionDomainType)
          Return the list of substitution variables for the given domain type.
 SystemCmdSubstVarList getActionSubstVarList(SystemUDActionElement action)
          Return the list of substitution variables for the given domain type.
protected  String getAllNamesSubstitutionVariable()
          When processing an action that has elected to be invoked only once, versus once per selected object, we call this method to get the "all names" substitution variable so that we can substitute it with the collection of names of all selected objects.
protected  QSYSCommandSubSystem getCmdSubSystem(IRemoteFile selectedFile)
          Return the iSeries Commands file subsystem
 SystemUDActionEditPane getCustomUDActionEditPane(ISubSystem ss, ISubSystemConfiguration ssf, ISystemProfile profile, ISystemUDAEditPaneHoster parent, ISystemUDTreeView tv)
          Return the edit pane for user actions.
 SystemUDTypeEditPane getCustomUDTypeEditPane(ISystemUDAEditPaneHoster parent, ISystemUDTreeView tv)
           
protected  int getDomainFromSelection(IStructuredSelection selection)
          Parent override.
 Image getDomainImage(int domain)
          Get the domain icon to show in the tree views
 String[] getDomainNames()
          Get the list of untranslated domain names
 Image getDomainNewImage(int domain)
          Get the domain icon to show in the tree views, for the new item for this domain
protected  QSYSCommandSubSystem getFileSubSystem(IRemoteFile selectedFile)
          Return the iSeries Objects file subsystem
 IHost getHost(Object element)
           
 int getMaximumDomain()
          Parent override.
protected  String getNewNodeTypeLabel()
          Overridable method for child classes to supply the label to display in the "New" node for types.
 String getOSType()
           
 int getSingleDomain(SystemUDBaseManager docManager)
          In some cases, we supports domains in general, but only want to expose one of those domains to the user.
 String getSubstitutionValue(String subvar, Object context)
          From the interface ISystemSubstitutor.
protected  String getTypesDelimiter()
          Get the delimiter used to delimiter the types in a type string.
 boolean getWorkingOfflineMode()
          We disable user defined actions if we are in work-offline mode.
 String[] getXlatedDomainNames()
          Get the list of translated domain names
 String[] getXlatedDomainNewNames()
          Get the list of translated domain names for "new" nodes in tree view, for the WW User Actions dialog
 String[] getXlatedDomainNewTypeNames()
          Get the list of translated domain names for "new" nodes in tree view, for the WW Named Types dialog
 String internalGetSubstitutionValue(SystemUDActionElement currentAction, String substitutionVariable, Object context)
          Overridable extension point for child class to do variable substitution for variables unique to them.
protected  boolean isMatch(Object actionType, Object selectedObject, int domainType)
          Parent override.
 boolean isQSYSCommand(SystemUDActionElement currentAction)
          Given an existing action, return true if it is a QSYS command, false if it is a QSHELL command
protected  boolean isQSYSCommandType()
          Query current state (QSYS vs QSHELL) command type
protected  boolean meetsSelection(SystemUDActionElement action, IStructuredSelection selection, int domainType)
          Given an action, and the currently selected remote objects, and the domain of those, return true if ALL of the selected remote objects matches any of the type criteria for this action
 SystemUDActionElement[] primeDefaultActions(SystemUDActionManager actionMgr, ISystemProfile profile)
          Prime the user data with the default actions.
 SystemUDTypeElement[] primeDefaultTypes(SystemUDTypeManager typeMgr)
          Prime new document with default types
protected  String promptCommand(Shell shell, String command)
          Called when processing user action that has the "prompt" attribute set.
 boolean restoreDefaultAction(SystemUDActionElement element, int domain, String actionName)
          Given this IBM-supplied user action, restore it to its IBM-supplied state.
 boolean restoreDefaultType(SystemUDTypeElement element, int domain, String typeName)
          Given this IBM-supplied named type, restore it to its IBM-supplied state
protected  boolean runCommand(Shell shell, SystemUDActionElement action, String cmdString, IRemoteCmdSubSystem cmdSubSystem, Object context, Viewer viewer)
          After an action's command has been resolved (vars substituted) this method is called to actually do the remote command execution
protected  void setCommandType(boolean qsys)
          Flip between QSYS and QSHELL command types
 void setIsQSYSCommand(SystemUDActionElement currentAction, boolean qsys)
          Given an existing action, set whether it is a qsys or qshell command
 boolean supportsDomains()
          Return true if the action/type manager supports domains.
 boolean supportsTypes()
          Return true if actions can be scoped by file types The iSeries native file system does support types
 boolean supportsTypes(int domain)
          Return true if actions can be scoped by file types for the given domain.
 
Methods inherited from class com.ibm.etools.iseries.rse.ui.uda.QSYSUDActionSubsystem
collectNamesQSYS, getCommandSubsystem, getNameDelimiter, getRunnableContext, printTestActionInvokeOnceInformation, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final String copyright
See Also:
Constant Field Values

DOMAIN_FOLDER

public static final int DOMAIN_FOLDER
See Also:
Constant Field Values

DOMAIN_FILE

public static final int DOMAIN_FILE
See Also:
Constant Field Values

ATTR_QSYSCmd

public static final String ATTR_QSYSCmd
Attribute containing the command type. True/false value. "QsysCmd"

See Also:
Constant Field Values
Constructor Detail

IFSUDActionSubsystem

public IFSUDActionSubsystem()
Constructor for UDActionSubsystemIFS.

Method Detail

getNewNodeTypeLabel

protected String getNewNodeTypeLabel()
Overridable method for child classes to supply the label to display in the "New" node for types. Typically only overriden if domains are not supported, as otherwise the child nodes of "New" have the specific labels.

Returns:
translated label for "New named type..."

setCommandType

protected void setCommandType(boolean qsys)
Flip between QSYS and QSHELL command types


isQSYSCommandType

protected boolean isQSYSCommandType()
Query current state (QSYS vs QSHELL) command type


isQSYSCommand

public boolean isQSYSCommand(SystemUDActionElement currentAction)
Given an existing action, return true if it is a QSYS command, false if it is a QSHELL command


setIsQSYSCommand

public void setIsQSYSCommand(SystemUDActionElement currentAction,
                             boolean qsys)
Given an existing action, set whether it is a qsys or qshell command


getActionSubstVarList

public SystemCmdSubstVarList getActionSubstVarList(SystemUDActionElement action)
Return the list of substitution variables for the given domain type.


getActionSubstVarList

public SystemCmdSubstVarList getActionSubstVarList(int actionDomainType)
Return the list of substitution variables for the given domain type. Called from edit pane in work with dialog.


doActionsMigration

protected boolean doActionsMigration(ISystemProfile profile,
                                     String oldRelease)
Overridable extension point for child classes to do migration of their actions. This is called on first load of a document, which has a release stamp other than the current release

Returns:
true if any migration was done... we return false here.

doTypesMigration

protected boolean doTypesMigration(ISystemProfile profile,
                                   String oldRelease)
Overridable extension point for child classes to do migration of their types. This is called on first load of a document, which has a release stamp other than the current release

Returns:
true if any migration was done... we return false here

getSubstitutionValue

public String getSubstitutionValue(String subvar,
                                   Object context)
From the interface ISystemSubstitutor. Return the string to substitute for the given substitution variable, given the current context object. This object will be passed whatever was passed into the doSubstitution method.

It is VERY IMPORTANT to return null if you can't do the substitution for some reason! This is a clue to the algorithm that no change was made and increases performance.

This is an override of the parent class method, because iSeries has unique variable substitution support (&x vs ${x}).

After processing the variables common to jobs and objs/mbrs, this defers to the child classes by calling internalGetSubstitutionValue.

Overrides:
getSubstitutionValue in class QSYSUDActionSubsystem

internalGetSubstitutionValue

public String internalGetSubstitutionValue(SystemUDActionElement currentAction,
                                           String substitutionVariable,
                                           Object context)
Overridable extension point for child class to do variable substitution for variables unique to them. We should only be called here for QSHELL commands


getFileSubSystem

protected QSYSCommandSubSystem getFileSubSystem(IRemoteFile selectedFile)
Return the iSeries Objects file subsystem


getCmdSubSystem

protected QSYSCommandSubSystem getCmdSubSystem(IRemoteFile selectedFile)
Return the iSeries Commands file subsystem


getTypesDelimiter

protected String getTypesDelimiter()
Get the delimiter used to delimiter the types in a type string. Default is " "


runCommand

protected boolean runCommand(Shell shell,
                             SystemUDActionElement action,
                             String cmdString,
                             IRemoteCmdSubSystem cmdSubSystem,
                             Object context,
                             Viewer viewer)
After an action's command has been resolved (vars substituted) this method is called to actually do the remote command execution

Run the user action's command in the default shell, and log result in the command view.

Overrides:
runCommand in class QSYSUDActionSubsystem
Parameters:
shell - - the shell to use if need to prompt for password or show msg dialog
action - - the action being processed, in case attributes of it need to be queried
cmdString - - the resolved command
cmdSubSystem - - this connection's command subsystem, which will run the command
context - - the selected IRemoteFile object
viewer - - the viwer that the action came from
Returns:
true if we should continue, false if something went wrong

getAllNamesSubstitutionVariable

protected String getAllNamesSubstitutionVariable()
When processing an action that has elected to be invoked only once, versus once per selected object, we call this method to get the "all names" substitution variable so that we can substitute it with the collection of names of all selected objects.

We return null to indicate to our parent class that we handle this option differently

Overrides:
getAllNamesSubstitutionVariable in class QSYSUDActionSubsystem

collectNames

protected Object collectNames(Shell shell,
                              Iterator elements,
                              StringBuffer collectedNames)
When processing an action that has elected to be invoked only once, versus once per selected object, we call this method to collect the names of the selected objects into a single string buffer.

This is an override of the parent, as we handle this option different for iSeries. Rather than collecting all the names into a single list of quoted, blank-delimited names, we instead create a temporary member and put all the fully-qualified names of the selected objects in it. The name of this temporary member can then be passed to a server program via the &Mx substitution variables, and that program can open and read the names from there.

This different behaviour makes it easier to write server side programs to process the list of selected names, as we can neither pre-determine the number of parameters, or the length of a single parameter if we concatenated them. On iSeries, it is necessary for called-programs to know ahead of time the number of parameters and the size of each. Further, there is a limit of 40 parameters for any one call.

Overrides:
collectNames in class QSYSUDActionSubsystem
Returns:
first selected object, or null if something went wrong (msg will have been issued)

promptCommand

protected String promptCommand(Shell shell,
                               String command)
Called when processing user action that has the "prompt" attribute set. By default, puts up dialog allowing user to see and edit the fully resolved command.

Overrides:
promptCommand in class QSYSUDActionSubsystem
Parameters:
shell - - the shell to host the modal dialog
command - - the fully resolved (variables substituted) command
Returns:
the edited command string, or null if the user pressed cancel

supportsTypes

public boolean supportsTypes()
Return true if actions can be scoped by file types The iSeries native file system does support types


supportsTypes

public boolean supportsTypes(int domain)
Return true if actions can be scoped by file types for the given domain. Default is supportsTypes()


supportsDomains

public boolean supportsDomains()
Return true if the action/type manager supports domains. The iSeries native file system does support domains


getSingleDomain

public int getSingleDomain(SystemUDBaseManager docManager)
In some cases, we supports domains in general, but only want to expose one of those domains to the user. For example, for file subsystems, we support folder and file domains, but for named types we really only support the file domain.

We return DOMAIN_FILE if the docManager is the type manager


getCustomUDTypeEditPane

public SystemUDTypeEditPane getCustomUDTypeEditPane(ISystemUDAEditPaneHoster parent,
                                                    ISystemUDTreeView tv)

getCustomUDActionEditPane

public SystemUDActionEditPane getCustomUDActionEditPane(ISubSystem ss,
                                                        ISubSystemConfiguration ssf,
                                                        ISystemProfile profile,
                                                        ISystemUDAEditPaneHoster parent,
                                                        ISystemUDTreeView tv)
Return the edit pane for user actions. Returns UDActionEditPaneIFS

Overrides:
getCustomUDActionEditPane in class QSYSUDActionSubsystem

primeDefaultTypes

public SystemUDTypeElement[] primeDefaultTypes(SystemUDTypeManager typeMgr)
Prime new document with default types


primeDefaultActions

public SystemUDActionElement[] primeDefaultActions(SystemUDActionManager actionMgr,
                                                   ISystemProfile profile)
Prime the user data with the default actions. Subsystem and profile specific


restoreDefaultAction

public boolean restoreDefaultAction(SystemUDActionElement element,
                                    int domain,
                                    String actionName)
Given this IBM-supplied user action, restore it to its IBM-supplied state.

Returns:
true if all went well, false if it wasn't restore for some reason

restoreDefaultType

public boolean restoreDefaultType(SystemUDTypeElement element,
                                  int domain,
                                  String typeName)
Given this IBM-supplied named type, restore it to its IBM-supplied state

Returns:
true if all went well, false if it wasn't restore for some reason

getWorkingOfflineMode

public boolean getWorkingOfflineMode()
We disable user defined actions if we are in work-offline mode. Currently, how we determine this is dependent on the subsystem factory.

Overrides:
getWorkingOfflineMode in class QSYSUDActionSubsystem

meetsSelection

protected boolean meetsSelection(SystemUDActionElement action,
                                 IStructuredSelection selection,
                                 int domainType)
Given an action, and the currently selected remote objects, and the domain of those, return true if ALL of the selected remote objects matches any of the type criteria for this action

Override of parent


isMatch

protected boolean isMatch(Object actionType,
                          Object selectedObject,
                          int domainType)
Parent override.

Compares a particular file type (not named, but actual scalar/generic type) to a specific user-selected remote object. Returns true if the object's information matches that of the given type

BECAUSE WE OVERRRIDE meetsSelection, THIS METHOD IS NEVER CALLED FOR US!

Parameters:
actionType - - an unnamed file type, as in "*.cpp"
selectedObject - - one of the currently selected remote objects
domainType - - integer representation of current domain

getDomainFromSelection

protected int getDomainFromSelection(IStructuredSelection selection)
Parent override. Determine domain, given the selection. Eg subsystem that supports domains has to do this via overriding this method. If domains not supported, return -1.


getMaximumDomain

public int getMaximumDomain()
Parent override. For efficiency reasons, internally we use an integer to represent a domain. However, that has to be mapped to a name which is actually what is stored as the "type" attribute for the xml domain node. This returns the maximum integer number supported by this action/type manager. Returns 1 for us.


getDomainNames

public String[] getDomainNames()
Get the list of untranslated domain names


getXlatedDomainNames

public String[] getXlatedDomainNames()
Get the list of translated domain names


getXlatedDomainNewNames

public String[] getXlatedDomainNewNames()
Get the list of translated domain names for "new" nodes in tree view, for the WW User Actions dialog


getXlatedDomainNewTypeNames

public String[] getXlatedDomainNewTypeNames()
Get the list of translated domain names for "new" nodes in tree view, for the WW Named Types dialog


getDomainImage

public Image getDomainImage(int domain)
Get the domain icon to show in the tree views


getDomainNewImage

public Image getDomainNewImage(int domain)
Get the domain icon to show in the tree views, for the new item for this domain


getOSType

public String getOSType()
Overrides:
getOSType in class QSYSUDActionSubsystem

getHost

public IHost getHost(Object element)
Specified by:
getHost in class QSYSUDActionSubsystem

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.