Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.subsystems.qsys.commands
Class QSYSNfsCommandHandler

java.lang.Object
  extended by com.ibm.etools.iseries.subsystems.qsys.commands.QSYSNfsCommandHandler

public class QSYSNfsCommandHandler
extends Object

Helper class for running remote commands and refreshing the tree or table views if required.


Field Summary
static int CMD_CANCELED
           
static String Copyright
           
 
Constructor Summary
QSYSNfsCommandHandler(Shell shell)
          Constructor.
QSYSNfsCommandHandler(Shell shell, boolean bUpdateTreeView)
          Constructor that explicitly specifying whether to update the tree view.
QSYSNfsCommandHandler(Shell shell, boolean bUpdateTreeView, boolean bUpdateTableView)
          Constructor that explicitly specifying whether to update the tree view and table view.
QSYSNfsCommandHandler(Shell shell, QSYSCommandSubSystem cmdSubsystem)
          Constructor when you set the command subsystem to use for running remote commands.
 
Method Summary
 int changeDescription(IQSYSResource element, String sNewDescription)
          Change description of an object on a remote iseries.
 int changeLibraryList(String cmd, String newLib, ISystemTree tree, ISystemFilterReference selectedFilter)
          Make a change to the library list: add, change curlib, remove a library, etc Unlike other methods in here, you supply the ADDLIBLE command string.
 int changeMessageDescription(IQSYSMessageDescription msgd)
          Change an existing message description.
 int changeObject(QSYSHostObject objectToChange, boolean processCmdLineParm)
          Prompt the user for the appropriate Change XXX command on the iseries, based on the type of the given iseries object.
 int changeType(IQSYSResource objectToChange, String sNewType)
          Change type of a library or member on a remote iseries.
 int copyFile(QSYSHostObject objectToCopy, boolean processCmdLineParm)
          Run Copy file.
 int copyLib(String sSourceLib, String sTargetLib, boolean processCmdLineParm, IProgressMonitor monitor)
          Copy a library on the iSeries.
 int copyMbr(String sSourceLib, String sSourceFile, String sSourceMbr, String sSourceHost, String sTargetLib, String sTargetFile, String sTargetName, String sTargetHost, boolean isSourceFile, boolean processCmdLineParm, boolean withPrompt)
          Copy a data or source file member on the iSeries.
 int copyObj(String sSourceLib, String sSourceName, String sSourceType, String sTargetLib, String sTargetName, boolean processCmdLineParm, IProgressMonitor monitor)
          Copy an object on the iSeries.
 int createMessageDescription(IQSYSMessageFile parent, String library, String msgFileName)
          Create a new message file in the specified library with the specified name.
 int crtRemoteObject(Object parentObject, String parentObjectName, ISystemTree tree, String newObjectName, String sCmdString)
          Create a remote object, such as a library, file or member.
 int delete(IQSYSResource objectToDelete, boolean processCmdLineParm)
          Physically delete the iSeries object represented by the given data element.
 QSYSObjectCacheHandler getCacheHandler(QSYSObjectSubSystem subsystem)
          Returns cache handler for the specified subsystem
 int getNumberOfReturnMessages()
          Return the number of messages issued by last remote command
 ISeriesMessage[] getReturnMessages()
          Return all the messages issued by the last remote command
 ISeriesMessage getReturnMsg()
          Get the first last message issued by running a remote command
 int mergeSource(IQSYSSourceMember mbrToMerge, boolean processCmdLineParm)
          Run Mrgsrc.
 int moveMbr(String sSourceLib, String sSourceFile, String sSourceMbr, String sSourceHost, String sTargetLib, String sTargetFile, String sTargetName, String sTargetHost, boolean isSourceFile, boolean processCmdLineParm)
          Move a member from one file to another on the iSeries.
 int moveObj(String sSourceLib, String sSourceName, String sSourceType, String sTargetLib, String sTargetName, boolean processCmdLineParm, IProgressMonitor monitor)
          Move an object from one library to another on the iSeries.
 int rename(IQSYSResource objectToRename, String sNewName, boolean processCmdLineParm)
          Rename a remote object on the iseries.
 int reorderLibraryList(String[] cmds, String movedLib, ISystemTree tree, ISystemFilterReference parentFilter)
          Make a change to reorder the library list: move a library up or down or to a new position All these actions require multiple commands to achieve
 int restore(QSYSHostObject objectToRestore, boolean processCmdLineParm)
          Run Restore.
 int restoreLib(IQSYSSaveFile libToRestore, boolean processCmdLineParm)
          Run RSTLIB command for SAVF
 int restoreObj(IQSYSSaveFile objToRestore, boolean processCmdLineParm)
          Run RSTOBJ command for SAVF
 int save(QSYSHostObject objectToSave, boolean processCmdLineParm)
          Run Save.
 void setCommandSubSystem(QSYSCommandSubSystem cmdSubSystem)
          Set the command subsystem in which to run commands.
 
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

CMD_CANCELED

public static final int CMD_CANCELED
See Also:
Constant Field Values
Constructor Detail

QSYSNfsCommandHandler

public QSYSNfsCommandHandler(Shell shell)
Constructor. Defaults to false for both updating tree view and table view.


QSYSNfsCommandHandler

public QSYSNfsCommandHandler(Shell shell,
                             QSYSCommandSubSystem cmdSubsystem)
Constructor when you set the command subsystem to use for running remote commands. This is necessary when using methods that don't take data elements. Defaults to false for both updating tree view and table view.


QSYSNfsCommandHandler

public QSYSNfsCommandHandler(Shell shell,
                             boolean bUpdateTreeView)
Constructor that explicitly specifying whether to update the tree view. Defaults to false for updating the table view.


QSYSNfsCommandHandler

public QSYSNfsCommandHandler(Shell shell,
                             boolean bUpdateTreeView,
                             boolean bUpdateTableView)
Constructor that explicitly specifying whether to update the tree view and table view.

Method Detail

setCommandSubSystem

public void setCommandSubSystem(QSYSCommandSubSystem cmdSubSystem)
Set the command subsystem in which to run commands. This need only be called if using methods which do not take a data element as a parameter, since the command subsystem can be deduced from a data element.


changeLibraryList

public int changeLibraryList(String cmd,
                             String newLib,
                             ISystemTree tree,
                             ISystemFilterReference selectedFilter)
Make a change to the library list: add, change curlib, remove a library, etc Unlike other methods in here, you supply the ADDLIBLE command string.

Parameters:
cmd - The ADDLIBLE, RMVLIBLE or CHGCURLIB command to run
newLib - The name of the library being added (so we can select it)
tree - The RSE view from which this was run. Optional
selectedFilter - The selected libl filter this was run from. Optional.
Returns:
integer representing severity of first iSeries error message

copyLib

public int copyLib(String sSourceLib,
                   String sTargetLib,
                   boolean processCmdLineParm,
                   IProgressMonitor monitor)
Copy a library on the iSeries. Results in CPYLIB command being remotely issued.

Parameters:
sSourceLib - - name of library to be copied.
sTargetLib - - new name for the new library copy.
Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

reorderLibraryList

public int reorderLibraryList(String[] cmds,
                              String movedLib,
                              ISystemTree tree,
                              ISystemFilterReference parentFilter)
Make a change to reorder the library list: move a library up or down or to a new position All these actions require multiple commands to achieve

Parameters:
cmds - The RMVLIBLE and ADDLIBLE commands to run
newLib - The name of the library being moved (so we can re-select it)
tree - The RSE view from which this was run. Optional
parentFilter - The parent libl filter this was run from children of. Optional.
Returns:
integer representing severity of first iSeries error message

delete

public int delete(IQSYSResource objectToDelete,
                  boolean processCmdLineParm)
Physically delete the iSeries object represented by the given data element. This will decide the correct iSeries command to run, and will run the command via the command subsystem as deduced from the given data element. Depending in the boolean values used to instantiate this object, it will optionally refresh the Remote Systems tree views, and the iSeries table views.

Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

getNumberOfReturnMessages

public int getNumberOfReturnMessages()
Return the number of messages issued by last remote command


rename

public int rename(IQSYSResource objectToRename,
                  String sNewName,
                  boolean processCmdLineParm)
Rename a remote object on the iseries.

Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

getReturnMessages

public ISeriesMessage[] getReturnMessages()
Return all the messages issued by the last remote command


getReturnMsg

public ISeriesMessage getReturnMsg()
Get the first last message issued by running a remote command

Returns:
an ISeriesMessage, which can then be displayed by calling displayMessage on it

changeObject

public int changeObject(QSYSHostObject objectToChange,
                        boolean processCmdLineParm)
Prompt the user for the appropriate Change XXX command on the iseries, based on the type of the given iseries object.

Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

changeDescription

public int changeDescription(IQSYSResource element,
                             String sNewDescription)
Change description of an object on a remote iseries.

Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

changeType

public int changeType(IQSYSResource objectToChange,
                      String sNewType)
Change type of a library or member on a remote iseries.

Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

copyFile

public int copyFile(QSYSHostObject objectToCopy,
                    boolean processCmdLineParm)
Run Copy file.


copyMbr

public int copyMbr(String sSourceLib,
                   String sSourceFile,
                   String sSourceMbr,
                   String sSourceHost,
                   String sTargetLib,
                   String sTargetFile,
                   String sTargetName,
                   String sTargetHost,
                   boolean isSourceFile,
                   boolean processCmdLineParm,
                   boolean withPrompt)
Copy a data or source file member on the iSeries. Results in CPYF or CPYSRCF command being remotely issued.

Parameters:
sSourceLib - - name of library containing member to be copied.
sSourceFile - - name of file containing member to be copied.
sSourceMbr - - name of member to be copied.
sTargetLib - - name of library to copy member into.
sTargetFile - - name to file to copy member into.
sTargetName - - new name to assign to the new copy of the member.
isSourceFile - - true if the member is a source member, false if it is a data member.
processCmdLineParm - - true if the command line input should be treated as parameters.
withPrompt - - Prompt the command first. If true, caller should check for cancel return.
Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, -99 if prompt is canceled or 0 if all went well. and otherwise the severity of the first error message,

copyObj

public int copyObj(String sSourceLib,
                   String sSourceName,
                   String sSourceType,
                   String sTargetLib,
                   String sTargetName,
                   boolean processCmdLineParm,
                   IProgressMonitor monitor)
Copy an object on the iSeries. Results in CRTDUPOBJ command being remotely issued.

Parameters:
sSourceLib - - name of library containing object to be copied.
sSourceName - - name of object to be copied.
sSourceType - - type of object to be copied.
sTargetLib - - name of library to copy object into.
sTargetName - - new name to assign to the new copy of the object.
Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

crtRemoteObject

public int crtRemoteObject(Object parentObject,
                           String parentObjectName,
                           ISystemTree tree,
                           String newObjectName,
                           String sCmdString)
Create a remote object, such as a library, file or member. There is no prompting, as this assumes user has been prompted for information via a wizard. Assumes setCommandSubSystem has been called.

Parameters:
parentObject - The actual object selected when this request happened
parentObjectName - The fully qualified name of the parent container for this new object. Is used to refresh all occurrences of that parent.
tree - The RSE view from which this was run. Optional
newObject - The fully qualified name of the object being added (so we can select it)
cmd - The ADDxxx or CRTxxx command to run.
Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

mergeSource

public int mergeSource(IQSYSSourceMember mbrToMerge,
                       boolean processCmdLineParm)
Run Mrgsrc. Currently only supported for Source Members.


moveMbr

public int moveMbr(String sSourceLib,
                   String sSourceFile,
                   String sSourceMbr,
                   String sSourceHost,
                   String sTargetLib,
                   String sTargetFile,
                   String sTargetName,
                   String sTargetHost,
                   boolean isSourceFile,
                   boolean processCmdLineParm)
Move a member from one file to another on the iSeries. Does this by a calling copyMbr, then issuing a RMVM remote command.

Parameters:
sSourceLib - - name of library containing member to be moved.
sSourceFile - - name of file containing member to be moved.
sSourceMbr - - name of member to be moved.
sTargetLib - - name of library to move member into.
sTargetFile - - name to file to move member into.
sTargetName - - new name to assign to the moved member.
isSourceFile - - true if the member is a source member, false if it is a data member.
Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

moveObj

public int moveObj(String sSourceLib,
                   String sSourceName,
                   String sSourceType,
                   String sTargetLib,
                   String sTargetName,
                   boolean processCmdLineParm,
                   IProgressMonitor monitor)
Move an object from one library to another on the iSeries. Results in MOVOBJ command being remotely issued.

Parameters:
sSourceLib - - name of library containing object to be moved.
sSourceName - - name of object to be moved.
sSourceType - - type of object to be moved.
sTargetLib - - name of library to move object into.
sTargetName - - new name to assign to the moved object.
Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

restore

public int restore(QSYSHostObject objectToRestore,
                   boolean processCmdLineParm)
Run Restore. RSTLIB command for library and RSTOBJ for objects


restoreLib

public int restoreLib(IQSYSSaveFile libToRestore,
                      boolean processCmdLineParm)
Run RSTLIB command for SAVF


restoreObj

public int restoreObj(IQSYSSaveFile objToRestore,
                      boolean processCmdLineParm)
Run RSTOBJ command for SAVF


save

public int save(QSYSHostObject objectToSave,
                boolean processCmdLineParm)
Run Save. SAVLIB command for library and SAVOBJ for objects


changeMessageDescription

public int changeMessageDescription(IQSYSMessageDescription msgd)
Change an existing message description. If the change is successful then the parent message file in the tree (or table view) is refreshed.

Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

createMessageDescription

public int createMessageDescription(IQSYSMessageFile parent,
                                    String library,
                                    String msgFileName)
Create a new message file in the specified library with the specified name. If the change is successful then the parent message file in the tree (or table view) is refreshed.

Returns:
-1 if user prompted to signon, and they cancel that signon, -2 if an exception occurred, -3 if subsystem null, and otherwise the severity of the first error message, or 0 if all went well.

getCacheHandler

public QSYSObjectCacheHandler getCacheHandler(QSYSObjectSubSystem subsystem)
Returns cache handler for the specified subsystem


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.