Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.rse.ui.resources
Class QSYSEditableRemoteSourceFileMember

java.lang.Object
  extended by com.ibm.etools.iseries.rse.ui.resources.QSYSEditableRemoteSourceFileMember
All Implemented Interfaces:
IQSYSRemoteEditConstants

public class QSYSEditableRemoteSourceFileMember
extends Object
implements IQSYSRemoteEditConstants

A representation of a remote iSeries source member for the purpose of local editing


Nested Class Summary
protected  class QSYSEditableRemoteSourceFileMember.DisplayDownloadConflictDialog
           
protected  class QSYSEditableRemoteSourceFileMember.DisplayUploadConflictDialog
           
 
Field Summary
static String copyright
           
 
Fields inherited from interface com.ibm.etools.iseries.subsystems.qsys.resources.IQSYSRemoteEditConstants
AS400_OBJECT_KEY, BUFFER_SIZE, IFS_EDITOR_PROFILE, KB_IN_BYTES, NUM_OF_KB, QSYS_EDITOR_PROFILE
 
Constructor Summary
QSYSEditableRemoteSourceFileMember(IQSYSMember member)
          Constructor
QSYSEditableRemoteSourceFileMember(IQSYSMember member, boolean readonly)
          Constructor
 
Method Summary
 void addAsListener()
          Register as listener for various events
 boolean canWrite()
           
 int checkOpenInEditor()
          Is the local file open in an editor
 void closeStream()
          Close the member
 void communicationsStateChange(CommunicationsEvent event)
           
 void connect()
          Connects and resets parameters, if not connected.
 void delete()
          Delete the local resource
 boolean doImmediateSaveAndUpload()
          Saves the local file and uploads it to the host immediately, rather than, in response to a resource change event.
 boolean download(IProgressMonitor monitor)
          Download the member.
 boolean download(IProgressMonitor monitor, boolean force)
          Download the member.
 boolean download(IProgressMonitor monitor, boolean force, boolean doRefresh)
          Download the member.
 boolean download(Shell shell)
           
 boolean download(Shell shell, boolean force, boolean silent)
          Download the member.
 boolean exists()
           
 String getAbsolutePath()
           
 IFile getAndCreateLocalResource()
          Remote members that have been edited before are cached locally as an IFile in our own RSE tempfiles project.
 String getDownloadPath()
          Gets the download path
 String getDownloadPath(IQSYSMember rmember)
          Gets the download path
 SystemTextEditor getEditor()
          Get the editor
 IEditorPart getEditorPart()
          Returns the open IEditorPart for this remote object if there is one.
 String getEditorTitle()
          Get editor title
 String getFullName()
          Return the fully qualified member name: library/object(member)
 IBMiConnection getISeriesConnection()
          Returns the IBMiConnection from which this object originated.
 IFile getLocalResource()
          Remote members that have been edited before are cached locally as an IFile in our own RSE tempfiles project.
 IFile getLocalResource(String alocalPath)
           
 IQSYSMember getMember()
          Return the QSYSRemoteSourceMember object representing this member
static IPath getMemberPath(String libName, String fileName, String mbrName)
          Create the Path for the remote member.
protected  String getOSPath(String path)
           
static long getRemoteMemberTimestamp(IQSYSMember remoteMember)
           
 IAdaptable getRemoteObject()
          Returns the remote object that is editable
 String getRemotePath()
          Get the remote path.
 SubSystem getSubSystem()
           
 void handleDownloadMemberLock(ISeriesHostObjectLock lock, String strEditorID)
          Displays download member locked dialog in a new UIJob
 void handleDownloadMemberLock(ISeriesHostObjectLock lock, String strEditorID, int lineNumber)
          Displays download member locked dialog in a new UIJob
 boolean handleUploadMemberLock(ISeriesHostObjectLock lock, SystemMessage message)
          Displays upload member locked dialog in a new UIJob
 void internalOpen(String strEditorID, boolean readOnly, int lineNumber, IProgressMonitor monitor)
          Open in specified editor.
 boolean isConnected()
          Returns if connection is connected
static boolean isDDSSourceType(String sourceType)
          check if there is source type is of type DDS
 boolean isDirty()
           
 boolean isPassiveCommunicationsListener()
           
 boolean isReadOnly()
          is the editor readonly?
 boolean isStale()
           
 void open(boolean readOnly, int lineNumber, IProgressMonitor monitor)
           
 void open(boolean readOnly, IProgressMonitor monitor)
           
 void open(IProgressMonitor monitor)
          Open with default editor.
 void open(Shell shell)
          (non-Javadoc)
 void open(Shell shell, boolean readOnly)
           
 void open(Shell shell, boolean readOnly, int lineNumber)
           
 void open(Shell shell, int lineNumber)
          Open the editor on the member and position to the specified line number
 void open(String strEditorID, boolean readOnly, int lineNumber, IProgressMonitor monitor)
          Open in specified editor.
 void open(String strEditorID, boolean readOnly, IProgressMonitor monitor)
          Open in specified editor.
 void openEditor()
          Convenience method to support opening with default system text editor.
 void openEditor(int lineNumber)
          Convenience method to support opening with default system text editor and positioning to the specified line number.
 void openEditor(String strEditorID, boolean readOnly)
          Open the editor.
 void openEditor(String strEditorID, boolean readOnly, int lineNumber)
          Open the editor.
 boolean openIsCanceled()
          Return if the open is canceled or not
 boolean openStream()
          Open member for write.
 void partActivated(IWorkbenchPart part)
           
 void partBroughtToTop(IWorkbenchPart part)
           
 void partClosed(IWorkbenchPart part)
           
 void partDeactivated(IWorkbenchPart part)
           
 void partOpened(IWorkbenchPart part)
           
 ISeriesHostObjectLock queryLocks()
          Query whether member is locked on the server.
 ISeriesHostObjectLock queryLocks(IQSYSMember amember)
          Query whether member is locked on the server.
 void refresh()
          Refresh the remote edit project.
 boolean saveAs(IQSYSMember newMember, IProgressMonitor progressMonitor)
          Save as to a remote location
 void setContents(String[] contents, boolean upload, IProgressMonitor monitor)
          Set the contents of the member in its local copy, and optionally upload it to the host
 void setEditor(IEditorPart editorPart)
          Set the editor
 void setInsertSequenceNumbersIfRequired(boolean insert)
          Sets whether or not the upload should insert sequence numbers (default is true)
 void setISeriesMemberTransfer(QSYSRemoteMemberTransfer transfer)
          Sets the ISeriesMemberTransfer object to use to download/upload the member.
 void setLocalResourceProperties()
          Set local resource properties
 void setLocalResourceProperties(boolean setCharset)
          Set local resource properties Normally this method is not called directly, use setLocalResourceProperties() instead which calls this one with a parameter of true.
 void setLocalResourceProperties(boolean setCharset, IFile file, IQSYSMember currentmember)
           
 void setMember(IQSYSMember member)
          Set the remote member
 void setReadOnly(boolean flag)
           
 void updateDirtyIndicator()
          Update the dirty indicator
 void upload(IProgressMonitor monitor)
          Supports 2-phase save
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static String copyright
Constructor Detail

QSYSEditableRemoteSourceFileMember

public QSYSEditableRemoteSourceFileMember(IQSYSMember member)
                                   throws SystemMessageException
Constructor

Parameters:
the - QSYSRemoteSourceMember to be opened in the editor.
Throws:
SystemMessageException

QSYSEditableRemoteSourceFileMember

public QSYSEditableRemoteSourceFileMember(IQSYSMember member,
                                          boolean readonly)
                                   throws SystemMessageException
Constructor

Parameters:
member - the QSYSRemoteSourceMember to be opened in the editor.
readonly - Download the file as readonly
Throws:
SystemMessageException
Method Detail

setMember

public void setMember(IQSYSMember member)
Set the remote member


getMemberPath

public static IPath getMemberPath(String libName,
                                  String fileName,
                                  String mbrName)
Create the Path for the remote member. This is used by ISeriesCompileEditManager.


getMember

public IQSYSMember getMember()
Return the QSYSRemoteSourceMember object representing this member

Returns:
the embedded member

getRemotePath

public String getRemotePath()
Get the remote path. This is the IFS-style name, as in "/QSYS.LIB/lib.LIB/file.FILE/mbr.MBR"


getEditor

public SystemTextEditor getEditor()
Get the editor

Returns:
the editor

connect

public void connect()
             throws SystemMessageException,
                    InterruptedException
Connects and resets parameters, if not connected.

Throws:
InterruptedException
SystemMessageException

isConnected

public boolean isConnected()
Returns if connection is connected


closeStream

public void closeStream()
                 throws Exception
Close the member

Throws:
Exception

openStream

public boolean openStream()
                   throws Exception
Open member for write.

Returns:
true if all went well, false if not able to connect
Throws:
Exception

download

public boolean download(IProgressMonitor monitor)
                 throws Exception
Download the member.

Parameters:
the - progress monitor to show during the download. Can be null.
Throws:
Exception

download

public boolean download(IProgressMonitor monitor,
                        boolean force)
                 throws Exception
Download the member.

Parameters:
monitor - the progress monitor to show during the download. Can be null.
force - force a refresh of the RSE temp files project
Throws:
Exception

download

public boolean download(IProgressMonitor monitor,
                        boolean force,
                        boolean doRefresh)
                 throws Exception
Download the member. Call the internal download method and handles exceptions

Parameters:
monitor - the progress monitor to show during the download. Can be null.
force - force a refresh of the RSE temp files project
Throws:
Exception

setContents

public void setContents(String[] contents,
                        boolean upload,
                        IProgressMonitor monitor)
                 throws Exception
Set the contents of the member in its local copy, and optionally upload it to the host

Throws:
Exception

upload

public void upload(IProgressMonitor monitor)
            throws Exception
Supports 2-phase save

Throws:
Exception

getLocalResource

public IFile getLocalResource()
Remote members that have been edited before are cached locally as an IFile in our own RSE tempfiles project. To access this local IFile, call this method. Note, if this member has not been edited before, then this IFile will not physically exist yet. If you need it to exist, call getAndCreateLocalResource.


getLocalResource

public IFile getLocalResource(String alocalPath)

getAndCreateLocalResource

public IFile getAndCreateLocalResource()
Remote members that have been edited before are cached locally as an IFile in our own RSE tempfiles project. To access this local IFile, call this method. If this member has not been edited before, then this IFile will not physically exist yet. In this case, this method call will create it. This is useful when creating a new member that you want to populate and then save. Call this method to create the local cache, the call upload.


delete

public void delete()
Delete the local resource


getDownloadPath

public String getDownloadPath()
Gets the download path


getOSPath

protected String getOSPath(String path)

getDownloadPath

public String getDownloadPath(IQSYSMember rmember)
Gets the download path


isPassiveCommunicationsListener

public boolean isPassiveCommunicationsListener()
See Also:
ICommunicationsListener#isPassiveCommunicationsListener()

communicationsStateChange

public void communicationsStateChange(CommunicationsEvent event)
See Also:
ICommunicationsListener#communicationsStateChanged(CommunicationsEvent)

checkOpenInEditor

public int checkOpenInEditor()
                      throws CoreException
Is the local file open in an editor

Throws:
CoreException

open

public void open(Shell shell)
(non-Javadoc)

See Also:
org.eclipse.rse.ui.view.ISystemEditableRemoteObject#open(org.eclipse.swt.widgets.Shell)

open

public void open(Shell shell,
                 int lineNumber)
Open the editor on the member and position to the specified line number

See Also:
org.eclipse.rse.ui.view.ISystemEditableRemoteObject#open(org.eclipse.swt.widgets.Shell)

open

public void open(Shell shell,
                 boolean readOnly)

open

public void open(Shell shell,
                 boolean readOnly,
                 int lineNumber)

open

public void open(boolean readOnly,
                 IProgressMonitor monitor)

open

public void open(boolean readOnly,
                 int lineNumber,
                 IProgressMonitor monitor)

open

public void open(IProgressMonitor monitor)
Open with default editor.


open

public void open(String strEditorID,
                 boolean readOnly,
                 IProgressMonitor monitor)
Open in specified editor.


open

public void open(String strEditorID,
                 boolean readOnly,
                 int lineNumber,
                 IProgressMonitor monitor)
Open in specified editor.


internalOpen

public void internalOpen(String strEditorID,
                         boolean readOnly,
                         int lineNumber,
                         IProgressMonitor monitor)
                  throws SystemMessageException,
                         Exception
Open in specified editor.

Throws:
SystemMessageException
Exception

queryLocks

public ISeriesHostObjectLock queryLocks()
                                 throws SystemMessageException
Query whether member is locked on the server. By locked, we mean locked so that we can not obtain write access to the member

Throws:
SystemMessageException

queryLocks

public ISeriesHostObjectLock queryLocks(IQSYSMember amember)
                                 throws SystemMessageException
Query whether member is locked on the server. By locked, we mean locked so that we can not obtain write access to the member

Throws:
SystemMessageException

setLocalResourceProperties

public void setLocalResourceProperties()
                                throws CoreException,
                                       SystemMessageException,
                                       Exception
Set local resource properties

Throws:
CoreException
SystemMessageException
Exception

setLocalResourceProperties

public void setLocalResourceProperties(boolean setCharset)
                                throws CoreException,
                                       SystemMessageException,
                                       Exception
Set local resource properties Normally this method is not called directly, use setLocalResourceProperties() instead which calls this one with a parameter of true. Use this method when you know that you do not need to set the character set of the IFile

Parameters:
setCharset - true if you want to call file.setCharset() which causes a resource change event
Throws:
CoreException
SystemMessageException
Exception

setLocalResourceProperties

public void setLocalResourceProperties(boolean setCharset,
                                       IFile file,
                                       IQSYSMember currentmember)
                                throws CoreException,
                                       SystemMessageException,
                                       Exception
Throws:
CoreException
SystemMessageException
Exception

addAsListener

public void addAsListener()
Register as listener for various events


openEditor

public void openEditor()
                throws PartInitException
Convenience method to support opening with default system text editor.

Throws:
PartInitException

openEditor

public void openEditor(int lineNumber)
                throws PartInitException
Convenience method to support opening with default system text editor and positioning to the specified line number.

Throws:
PartInitException

openEditor

public void openEditor(String strEditorID,
                       boolean readOnly)
                throws PartInitException
Open the editor.

Throws:
PartInitException

openEditor

public void openEditor(String strEditorID,
                       boolean readOnly,
                       int lineNumber)
                throws PartInitException
Open the editor.

Throws:
PartInitException

getEditorTitle

public String getEditorTitle()
Get editor title


setEditor

public void setEditor(IEditorPart editorPart)
Set the editor


setReadOnly

public void setReadOnly(boolean flag)

isReadOnly

public boolean isReadOnly()
is the editor readonly?


refresh

public void refresh()
Refresh the remote edit project.


updateDirtyIndicator

public void updateDirtyIndicator()
Update the dirty indicator


partActivated

public void partActivated(IWorkbenchPart part)
See Also:
IPartListener#partActivated(IWorkbenchPart)

partBroughtToTop

public void partBroughtToTop(IWorkbenchPart part)
See Also:
IPartListener#partBroughtToTop(IWorkbenchPart)

getRemoteMemberTimestamp

public static long getRemoteMemberTimestamp(IQSYSMember remoteMember)

partClosed

public void partClosed(IWorkbenchPart part)
See Also:
IPartListener#partClosed(IWorkbenchPart)

partDeactivated

public void partDeactivated(IWorkbenchPart part)
See Also:
IPartListener#partDeactivated(IWorkbenchPart)

partOpened

public void partOpened(IWorkbenchPart part)
See Also:
IPartListener#partOpened(IWorkbenchPart)

isDDSSourceType

public static boolean isDDSSourceType(String sourceType)
check if there is source type is of type DDS


doImmediateSaveAndUpload

public boolean doImmediateSaveAndUpload()
Saves the local file and uploads it to the host immediately, rather than, in response to a resource change event.


saveAs

public boolean saveAs(IQSYSMember newMember,
                      IProgressMonitor progressMonitor)
Save as to a remote location


canWrite

public boolean canWrite()

isDirty

public boolean isDirty()

getRemoteObject

public IAdaptable getRemoteObject()
Returns the remote object that is editable


getEditorPart

public IEditorPart getEditorPart()
Returns the open IEditorPart for this remote object if there is one.


openIsCanceled

public boolean openIsCanceled()
Return if the open is canceled or not


getFullName

public String getFullName()
Return the fully qualified member name: library/object(member)


getISeriesConnection

public IBMiConnection getISeriesConnection()
Returns the IBMiConnection from which this object originated.


setISeriesMemberTransfer

public void setISeriesMemberTransfer(QSYSRemoteMemberTransfer transfer)
Sets the ISeriesMemberTransfer object to use to download/upload the member. Use this if you want to use different download/upload options.

Parameters:
transfer - The ISeriesMemberTransfer object to use for tranfering the member to/from the iSeries
Since:
6.0.1

setInsertSequenceNumbersIfRequired

public void setInsertSequenceNumbersIfRequired(boolean insert)
Sets whether or not the upload should insert sequence numbers (default is true)

Parameters:
insert - true if you want to insert sequence numbers when uploading, false otherwise
Since:
6.0.1

getAbsolutePath

public String getAbsolutePath()

getSubSystem

public SubSystem getSubSystem()

isStale

public boolean isStale()

download

public boolean download(Shell shell)
                 throws Exception
Throws:
Exception

download

public boolean download(Shell shell,
                        boolean force,
                        boolean silent)
                 throws Exception
Download the member.

Parameters:
the - shell to use. If the shell is null, no progress monitor will be used. Otherwise, a progress monitor will be shown during the download
force - force the member to be downloaded even if a local copy already exists with the same timestamp.
silent - if the member is locked, download the member in silent mode without asking the user.
Throws:
Exception

exists

public boolean exists()

handleDownloadMemberLock

public void handleDownloadMemberLock(ISeriesHostObjectLock lock,
                                     String strEditorID)
Displays download member locked dialog in a new UIJob


handleDownloadMemberLock

public void handleDownloadMemberLock(ISeriesHostObjectLock lock,
                                     String strEditorID,
                                     int lineNumber)
Displays download member locked dialog in a new UIJob


handleUploadMemberLock

public boolean handleUploadMemberLock(ISeriesHostObjectLock lock,
                                      SystemMessage message)
Displays upload member locked dialog in a new UIJob


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.