Smallworld 5 Builds

Overview

Magik on java does not support magikc files any longer. You cannot create or read them (though reading them would be great for backward compatibility). Also the concept of images are no longer valid.

So how do you start a Smallworld session in 5.x? Well there is some documentation about it, but basic idea is that you start a registered magik session. This is defined typically in a register.magik file that is inside a module inside a config product. It is referenced from the gis_aliases file that you point to.

By "default" when you start the session, the magik code will be loaded based on what products/modules you have defined in the registered magik session. This is good for development, but is slow. And if you are a 3rd Party vendor, you would need to release the source code.

To speed things up, you can compile magik files into JARs. These typically are created when doing compile_all_modules() on the selected product. Also you can save the serialization information using save_serialised_module_definitions(0 on the product. One thing to note is that if JAR or SER files they take precedent over any changes to magik files. Just like an image, you would need to reload the magik files if there were any changes after the image was built. So for equivalency, the JAR/SER files can be thought of as the old image.

+Magik Sessions
The Magik_Session object defines what methods and functionality is loaded when the Magik/Java virtual machine is started.

Add Products Property

The :add_products property is a collection of symbols or strings. The functionality differs based on the type of the element.

  • Symbol - Will load the product that is defined by the environment value_DIR or as defined in the LAYERED_PRODUCTS file
  • String (full path) - The complete path to the product.def file.
  • String (relative path) - The relative path is appended to the directory of the configuration module the session references.

These elements are passed to smallworld_product.add_product().

Details….

JARs are Locked

There is no out of the box redirection like the MSF files had. The JARs are locked when a Smallworld session is running. You must exit all sessions prior to rebuilding JAR files…

Creating JAR for a Specific module

Since Smallworld doesn't send the code and I couldn't get any timely info from the help desk or second line support, I poked around and developed the following code to compile one module to a JAR without needing to load all your modules in the product. This specifically helped me to compile several of the 172 modules I have as they were reviewed/fixed for Smallworld 5.

load_file_stop()

Releases 5.0 -> 5.1.5
For those of you who use load_file_stop() to prevent magikc files from being created, you cannot use this concept in Smallworld 5 within modules that are delivered as JAR files. For out of the box functionality, a load_file_stop() will stop the creation of the JAR file all together. I have used the copy method functionality to copy the magik_rep.do_load_file() functionality to capture the "error" condition raised. However, no matter what I tried, the file would still not be put into the JAR file. If you have a JAR file it is the only thing loaded, the module does not try to load anything else. This means the file with the load_file_stop() would never be loaded.

The only work around is separating the code out some how. I typically used this functionality to deliver magik source files as examples for my customers when appropriate. Other uses would be to stop adding methods if at certain releases. These concepts must be re-worked to provide JAR files and files that are delivered in magik format.

Method Finder Mapping

You can map the location of source files so that the method finder can jump to the appropriate code. This is especially good for when a JAR file is delivered but only certain source files are delivered in a separate directory. You can use method_finder.add_mapping("NAME_OF_ENV").

Start Up Times

SW5 start up times are slow… What can be done to speed them up????

Theory 1

For those battling with start up times with Smallworld 5, here's an theory someone my want to investigate…

From my experiences, when the sw5 session starts, it basically does a build to load all the magik (in form of java class) code as it used to occur when you built images pre 5.

What would happen if you didn't load all the modules during session start up, but had a "loader" object that you could call that would load the module when something is executed the first time.

For example the case tool… Having available by default is good for developers, but when you do it will load the case modules during start up. Would it speed up things that when I start an application, the first thing it does is load the modules for that application if they haven't been loaded?

So the initial start up wouldn't load the case modules. only when you load the case tool would it load the case modules…

This could be expanded to other things also… Like the case data model objects… Only when you open a case SOC/SOM will it load the case object module…

Just some thoughts… I'm not doing stuff on SW5 right now, so I figure I would propose the idea and have someone else develop something if they have time…

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License