Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.perspective.model.util
Class ISeriesNativeObjectUtil

java.lang.Object
  extended by com.ibm.etools.iseries.perspective.internal.model.util.AbstractDownloadUtil
      extended by com.ibm.etools.iseries.perspective.model.util.ISeriesNativeObjectUtil

public class ISeriesNativeObjectUtil
extends com.ibm.etools.iseries.perspective.internal.model.util.AbstractDownloadUtil

This is a utility class for creating and populating source physical files from remote objects. Two object models are supported, IQSYSSaveFiles that are RSE based objects, and AbstractISeriesNativeObject objects that are the iSeries Project based objects.


Field Summary
static String COPYRIGHT
           
static String TEMP_BINARY_OBJ_SAVF_PREFIX
           
 
Constructor Summary
ISeriesNativeObjectUtil()
           
 
Method Summary
static IResource createFromObjectArray(Object[] objects, IProject project, IProgressMonitor monitor, Shell shell, List errorReceiverList)
          Downloads an array of RSE IQSYSFile and IQSYSMember objects, or save files to a project.
static IFolder createSRCPF(AbstractISeriesNativeObject iSeriesNativeObject, IProgressMonitor monitor, Shell shell)
          Download method based on iSeries Project object model.
static IFolder createSRCPF(String sourceFileName, IProject project, Properties sourceFileProperties)
          Creates a new folder for a source physical file under the given project.
static IFolder createSRCPFs(IQSYSSourceFile[] sourceFiles, IProject project, IProgressMonitor monitor, Shell shell)
          Download method based on the Remote Systems Explorer object model.
static void deleteTempOarFiles(File tempFolder)
          Deletes all temporary files that were created during binary object download operation
protected static IFile downloadSaveFile(IQSYSSaveFile saveFile, IProject project, Shell shell, com.ibm.etools.iseries.perspective.internal.ui.OracleDialog dlg, IProgressMonitor monitor)
          Creates an IFile for the save file under the iSeries Project.
static String getBinaryFileTypeAndSubtypeExtension(IFile file)
          Returns the extension combined with type and subtype for a local resource file which represent a binary object.
static String getBinaryObjectDispayLabel(IFile file)
          Returns the display label for a binary object local representation resource
static String getBinaryObjectFileNameNoOAR(IFile file)
          Returns the name of the binary object local resource without the ".oar" extension
protected static Properties getBinaryObjectProperties(IQSYSObject object)
          Returns a Properties object containing the description and last remote edit time of the object.
static String getContainerDispayLabel(IResource resource)
          Returns the display label for a container local representation resource
static String getLeafObjectDispayLabel(IFile file)
          Returns the display label for a leaf object local representation resource
static String getNativeObjectNameWithTypeSubtype(IQSYSObject nativeObject)
          Returns the extension combined with type and subtype for a local resource file which represent a binary object.
protected static Properties getSaveFileProperties(IQSYSSaveFile object)
          Returns a Properties object containing the description and last remote edit time of the object.
static boolean hasAllLocalSavfOrBinaryObjectSelection(IStructuredSelection selection)
          Returns whether the types of the resources in the given selection are all local save files.
static boolean hasAnyLocalSavfOrOARFileSelection(IStructuredSelection selection)
          Returns whether any resource in the given selection is a local save file or a local resource for binary object.
static boolean hasAnyLocalSavfSelection(IStructuredSelection selection)
          Returns whether any resource in the given selection is a local save file.
static boolean isBinaryObjectLocalResourceFile(IFile file)
           
static boolean isConnectionDownException(SystemMessageException se)
           
static boolean isParentedBinaryObjectFile(IFile file)
          This method will check if we are visiting a file that represents an save file.
static boolean isParentedSaveFile(IFile file)
          This method will check if we are visiting a file that represents an save file.
static boolean isSaveFile(IFile file)
          A convenience method to determine whether a file represents either a save file or otherwise.
 
Methods inherited from class com.ibm.etools.iseries.perspective.internal.model.util.AbstractDownloadUtil
checkMemberName, checkMemberType, checkSourceFileName, createMember, downloadMember, generateProperties, getDialogTitle, getStandardPath, getStandardPath, getStandardPath, hasStandardPath, hasStandardPath, makeSourceFileFolder, makeSourceFileFolder, queryDownload, queryDownload, queryDownload, setSourceProperties
 
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

TEMP_BINARY_OBJ_SAVF_PREFIX

public static final String TEMP_BINARY_OBJ_SAVF_PREFIX
See Also:
Constant Field Values
Constructor Detail

ISeriesNativeObjectUtil

public ISeriesNativeObjectUtil()
Method Detail

createSRCPF

public static final IFolder createSRCPF(AbstractISeriesNativeObject iSeriesNativeObject,
                                        IProgressMonitor monitor,
                                        Shell shell)
                                 throws SystemMessageException
Download method based on iSeries Project object model.

Downloads a full source file to the local project it is associated with. If the folder representing the source file does not exist one is created and the metadata file is generated accordingly. If the folder already exists the properties are verified against the downloaded source file. If any of the members exists, a pop-up asks for download confirmation.

The passed AbstractISeriesNativeObject must represent a source physical file, otherwise an IllegalArgumentException is thrown.

This method must be run as a WorkspaceModifyOperation, so that all resource modifications are reported as one delta when operation succeeds.

Parameters:
iSeriesNativeObject - the AbstractISeriesNativeMember that needs to be downloaded.
monitor - a progress monitor, or null if progress reporting and cancellation are not desired. The monitor is begun and ended in this method.
shell - parent shell for error messages. Pass null to use active shell.
Returns:
IFolder the IFolder that represents the source physical file being downloaded. Returns null if method fails, or if the passed source file has an invalid name.
Throws:
SystemMessageException - if the source file or any of its members could not be downloaded.
OperationCanceledException - if the operation is canceled.
IllegalArgumentException - if the first parameter is not a source file.

createSRCPFs

public static final IFolder createSRCPFs(IQSYSSourceFile[] sourceFiles,
                                         IProject project,
                                         IProgressMonitor monitor,
                                         Shell shell)
                                  throws SystemMessageException
Download method based on the Remote Systems Explorer object model.

Downloads an array of source physical files to the target project. If the folder counterpart to the source file does not exist one is created and its metadata file is generated accordingly. If the folder already exists the source file properties are verified against the downloaded source file. If any of the members exists a popup asks for download confirmation.

Returns the last IFolder in the array of srcpf being downloaded. The naming rules for the object names are as follows:

Note: This method must be run as a WorkspaceModifyOperation, so that all resource modifcations are reported as one delta when operation succeeds.

Parameters:
sourceFiles - an array of IQSYSFile objects to be downloaded.
project - the project under which to create the folders representing the source files.
monitor - a progress monitor, or null if progress reporting and cancelation are not desired.
shell - parent shell for error messages. Pass null to use active shell.
Returns:
IFolder the IFolder the represents the last source physical file being downloaded.
Throws:
SystemMessageException - if errors occur during operation.
OperationCanceledException - if the operation is canceled.
IllegalArgumentException - if the names of the files are invalid or the files are not source files.

createFromObjectArray

public static final IResource createFromObjectArray(Object[] objects,
                                                    IProject project,
                                                    IProgressMonitor monitor,
                                                    Shell shell,
                                                    List errorReceiverList)
                                             throws SystemMessageException
Downloads an array of RSE IQSYSFile and IQSYSMember objects, or save files to a project.

If the members in this array are covered by downloaded files then they are not downloaded individually. Downloading a member will automatically cause its containing source file folder to be created if necessary.

This method must be run as a WorkspaceModifyOperation, so that all resource modifications are reported as one delta when operation succeeds.

Parameters:
objects - an array where all objects must be all IQSYSMembers, all IQSYSFiles or all IQSYSSaveFiles (for save files).
project - the project to where the objects or members need to be downloaded.
monitor - a progress monitor, or null if progress reporting and cancellation are not desired.
shell - parent shell for error messages. Pass null to use active shell.
Returns:
IResource the IResource the represents the last resource being downloaded. Returns null if nothing is downloaded.
Throws:
SystemMessageException - if errors occur during operation.
OperationCanceledException - if the operation is canceled while in progress.
IllegalArgumentException - if the array contains objects which are not members or source files.

createSRCPF

public static final IFolder createSRCPF(String sourceFileName,
                                        IProject project,
                                        Properties sourceFileProperties)
                                 throws SystemMessageException
Creates a new folder for a source physical file under the given project.

This method must be run as a WorkspaceModifyOperation, so that all resource modifications are reported as one delta when operation succeeds.

Parameters:
sourceFileName - the name of the new source physical file. It is assumed that the name follows iSeries naming conventions.
project - the project in which to create the folder for the source physical file.
sourceFileProperties - the properties of the source physical file.
Returns:
an IFolder that represents the newly created source physical file.
Throws:
SystemMessageException - if errors occur during operation.
IllegalArgumentException - if the source file name is invalid.

downloadSaveFile

protected static IFile downloadSaveFile(IQSYSSaveFile saveFile,
                                        IProject project,
                                        Shell shell,
                                        com.ibm.etools.iseries.perspective.internal.ui.OracleDialog dlg,
                                        IProgressMonitor monitor)
                                 throws SystemMessageException
Creates an IFile for the save file under the iSeries Project.

Parameters:
saveFile - The save file to download.
project - The iSeries project where the save file is going to be downloaded.
monitor - A progress monitor, or null if progress reporting and cancelation are not desired.
shell - parent shell for error messages. Pass null to use active shell.
Throws:
SystemMessageException

isConnectionDownException

public static boolean isConnectionDownException(SystemMessageException se)

getSaveFileProperties

protected static final Properties getSaveFileProperties(IQSYSSaveFile object)
Returns a Properties object containing the description and last remote edit time of the object. These properties are extracted from the passed IQSYSSaveFile argument and could be used as a base property model for it. If any property could not be retrieved, null is returned to signal failure.

Parameters:
member - the source member from which to get the properties.
Returns:
Properties The Properties object containing all the iSeries source member properties. All keys and values are stored as Strings. Returns null if the method fails to retrieve any the of the properties from the IQSYSMember object..

getBinaryObjectProperties

protected static final Properties getBinaryObjectProperties(IQSYSObject object)
Returns a Properties object containing the description and last remote edit time of the object. These properties are extracted from the passed IQSYSSaveFile argument and could be used as a base property model for it. If any property could not be retrieved, null is returned to signal failure.

Parameters:
member - the source member from which to get the properties.
Returns:
Properties The Properties object containing all the iSeries source member properties. All keys and values are stored as Strings. Returns null if the method fails to retrieve any the of the properties from the IQSYSMember object..

isSaveFile

public static final boolean isSaveFile(IFile file)
A convenience method to determine whether a file represents either a save file or otherwise. The following criteria is used to determine whether a file is a save file: If one of the above criteria doesn't match the file's properties or if save file support is disabled, then it returns false. This should be used only for save file support and nothing else, especially if using to check if file is NOT a save file, since method ALWAYS returns false if AE plug-in is disabled.

Parameters:
file - The IFile to check if it's a save file or not.
Returns:
True if the file represents a save file using the criteria listed; false otherwise.

isBinaryObjectLocalResourceFile

public static final boolean isBinaryObjectLocalResourceFile(IFile file)

isParentedSaveFile

public static boolean isParentedSaveFile(IFile file)
This method will check if we are visiting a file that represents an save file. We need to check for the parent since the model may not be synched yet.


isParentedBinaryObjectFile

public static boolean isParentedBinaryObjectFile(IFile file)
This method will check if we are visiting a file that represents an save file. We need to check for the parent since the model may not be synched yet.


hasAllLocalSavfOrBinaryObjectSelection

public static final boolean hasAllLocalSavfOrBinaryObjectSelection(IStructuredSelection selection)
Returns whether the types of the resources in the given selection are all local save files. This is determined by checking if the object is a leaf object and has a "savf" extension. Save Files don't need to belong in the same project in order to return true.

Returns:
true if all the selected objects are local save files; false otherwise.

hasAnyLocalSavfSelection

public static final boolean hasAnyLocalSavfSelection(IStructuredSelection selection)
Returns whether any resource in the given selection is a local save file. This is determined by checking if the object is a leaf object and has a "savf" extension. Save Files don't need to belong in the same project in order to return true.

Returns:
true if any of the selected resources is a local save file; false otherwise.

hasAnyLocalSavfOrOARFileSelection

public static final boolean hasAnyLocalSavfOrOARFileSelection(IStructuredSelection selection)
Returns whether any resource in the given selection is a local save file or a local resource for binary object. This is determined by checking if the object is a leaf object and has a "savf" or "oar" extension . Save Files don't need to belong in the same project in order to return true.

Returns:
true if any of the selected resources is a local save file or a local resource for binary object; false otherwise.

getBinaryFileTypeAndSubtypeExtension

public static final String getBinaryFileTypeAndSubtypeExtension(IFile file)
Returns the extension combined with type and subtype for a local resource file which represent a binary object.

Returns:
the extension combined with type and subtype

getNativeObjectNameWithTypeSubtype

public static final String getNativeObjectNameWithTypeSubtype(IQSYSObject nativeObject)
Returns the extension combined with type and subtype for a local resource file which represent a binary object.

Returns:
the extension combined with type and subtype

getBinaryObjectDispayLabel

public static final String getBinaryObjectDispayLabel(IFile file)
Returns the display label for a binary object local representation resource

Returns:
display label for a binary object

getLeafObjectDispayLabel

public static final String getLeafObjectDispayLabel(IFile file)
Returns the display label for a leaf object local representation resource

Returns:
display label for a leaf object

getContainerDispayLabel

public static final String getContainerDispayLabel(IResource resource)
Returns the display label for a container local representation resource

Returns:
display label for a container

getBinaryObjectFileNameNoOAR

public static final String getBinaryObjectFileNameNoOAR(IFile file)
Returns the name of the binary object local resource without the ".oar" extension

Returns:
name of the binary object local resource without the ".oar" extension

deleteTempOarFiles

public static void deleteTempOarFiles(File tempFolder)
Deletes all temporary files that were created during binary object download operation

Parameters:
tempFolder - Temporary folder containing all temp files

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.