Locking and Unlocking

An object locking mechanism prevents concurrent updates when working with objects that are stored on a remote development server.

The exercises below demonstrate locking for an object that you are currently modifying in the program editor of Natural Studio. You will map the same development server once more. When you then try to open the same object from the new session, a locking message is shown.

For more information, see Object Locking in the Remote Development Using SPoD documentation of Natural for Windows.

This document covers the following topics:


Opening an Object

When you open an object, it is locked for all other users until you close it.

You will now display the Natural code of the DEMO program that you have previously created.

Start of instruction set To open the DEMO program in the logical view

  • In the library workspace, select the program DEMO, invoke the context menu and choose Open.

    Or:
    In the library workspace, select the program DEMO and press CTRL+O.

    Or:
    Double-click the name of the DEMO program.

    The program is now shown in a program editor window.

    Program editor

    Do not close this program editor window. Leave it open so that locking can be demonstrated with the next exercise.

Opening the Same Object from Another Session

When you try to open an object that is currently being modified by another user, the corresponding lock message is shown. This message tells you which user is currently modifying the object and the date and time it was locked.

In order to demonstrate locking, you will first map the same development server once more. You will then try to open the DEMO program from the new session.

Start of instruction set To open the same object from another session

  1. From the Tools menu, choose Map > Environment.

    Or:
    Choose the following toolbar button:

    Toolbar button

    The Map Environment dialog box appears.

  2. Enter all required information as described under Connecting to a Development Server for the First Time.

  3. In the new session, expand the node of the library containing the DEMO program.

  4. Double-click the name of the DEMO program.

    A lock message is now shown in a dialog box. It shows the ID of the user by whom the object was locked, and the date and time when the object was locked.

  5. Choose the OK button to close the dialog box.

Unlocking Objects

You will now unlock your DEMO program from the session in which it is currently locked (not the session in which it was opened).

Note:
When Natural Security is active, it is possible that you cannot use certain commands. Thus, it may be possible that you are not allowed to unlock your own objects.

Start of instruction set To unlock a locked object

  1. In library workspace, select the library containing the locked DEMO program.

  2. From the Tools menu, choose Development Tools > Unlock Objects.

    Or:
    Choose the following toolbar button:

    Toolbar button

    The Unlock Objects dialog box appears. The name of the library that is currently selected in library workspace is automatically provided.

    Unlock objects

  3. Choose the OK button (without entering any information).

    When locked objects exist, they are shown on the Unlock Objects tab of the results window.

    Unlock objects

  4. In the results window, select the object to be unlocked.

  5. Invoke the context menu and choose Unlock Objects.

    The object is still shown on the Unlock Objects tab. The Message column, however, now indicates that the object has been unlocked.

  6. To hide the results window, choose the standard close button at the top of the results window.

    Or:
    From the View menu, choose Results.

    Or:
    Press ALT+5.

    When the results window is not shown in the Natural Studio window, no check mark is shown in the View menu next to the Results command.

Note:
You can undock and dock the results window as described previously in this tutorial.

Displaying a List of All Locked Objects

You can display a list of all locked objects for the currently active development server. This includes the objects of all users in all libraries. You can unlock any object contained in this list.

It is only possible to display and unlock objects from another user in a non-secure environment (i.e. when Natural Security is not active on the development server). In a secure environment, the administrator defines which user locks may be unlocked by other users.

Start of instruction set To display all locked objects

  1. From the Tools menu, choose Development Tools > Unlock Objects.

    Or:
    Choose the following toolbar button:

    Toolbar button

    The Unlock Objects dialog box appears.

  2. Enter an asterisk in the Library text box.

    This will display the locked objects in all libraries.

  3. Enter an asterisk in the Locked by text box.

    This will display the locked objects of all users.

    The dialog box should now look as follows:

    Unlock all objects

  4. Choose the OK button.

    The results window is shown again, displaying all locked objects.

  5. If you want to delete the Unlock Objects tab from the results window, select an object name in the first column, invoke the context menu and choose Delete Tab. This tab will automatically be redisplayed the next time you display locked objects in the results window.

  6. Before you continue with the next section, hide the results window as described above.

Moving Folders Containing Locked Objects

Locked objects cannot be moved.

When you try to move a folder containing locked objects to another folder (for example, via drag-and-drop), a lock message appears.

When you choose the OK button to close the dialog box, another dialog box appears, asking whether you want to continue the move.

When you choose the Yes button, all objects except the locked objects are moved.

You can now proceed with the next exercise: Handling Applications.