SmalltalkInspect – Gemstone/S 3.2

We just published a new episode of SmalltalkInspect – this time we talked about the upcoming release of Gemstone/S 3.2.

You may download it from Episode 27 – Gemstone/S 3.2.

Have fun

Posted in Smalltalk | Tagged , , | Leave a comment

Gemstone/S – PUM 01.02.26

Thanks to James Foster there is now no problem anymore to transfer large source content via jade to Gemstone. Its available in the latest version of Jade.

The last posting had been done for 01.02.08 – where are we now:

-> I changed the enumeration structure to add a comment value to each enumeration entry.

-> Now its possible to mark a special enumeration class definition as error definition enumeration. The comment entry is then the US content of that error message. PUM generates source code to have easier access to all various error messages from REST-Call classes and the main service class.

-> Initial generation of testing Javascript source code to model the Sencha ExtJS4 model definition. This is just a testing phase to look how to support base ExtJS4 and Sencha Architect.

-> Now its possible to create Array based definition for instance variables to base types (String, Integer, …). Therefore we had to change the Swagger support also.

-> Generation of testing Neo-CSV support code …

Posted in Smalltalk | Tagged , , , | Leave a comment

Gemstone/S – PUM 01.02.08

I’ve noticed, that the way via Topaz is pretty time consuming: export generated source code, transfer to remote server and then local import via Topaz.

But actually there is a much better way. Copy the generated source code into the clipboard, switch to Jade (which is connected to the remote server), open an empty Workspace, paste the stuff into that Workspace, select all and then do a “FileIn” – and I was not aware, that the expected source code format in this window is: Topaz. Fine

In the 01.02.08 I added a little “Copy all to Clipboard” button to make the whole procedure a little bit faster.

Another stuff I added in this version:

* in some generated source code of methods I used temp variable names which are not that unusual. Actually I got error while compiling my project. Therefore I switch to temp method variable names beginning with an “_”.

* I now created additional methods on the class side of the project class about the model version, the model creation time, the model last saving time, the generator software version.

* most of domain classes in my project have an instance variable named “id”. In REST URL paths there might be a need (for swagger specs) to add the name of the parameter into a path like “/gwc/system/{id}”. When different “id”s of different classes are used the supported framework will not work. Therefore I added method returning extended names to be used in this case like: “/gwc/system/{SystemId}/user/{UserID}”

Marten

Posted in Smalltalk | Tagged , , | Leave a comment

Gemstone/S – Modelling support for Swagger, JSON

PUModeller has the whole information of the models. Association are created via OrderedCollection but with Gemstone support I added the possibility to have unique-keyed dictionary realization of associations – nice to have, if you want to look-up elements via unique (not changeable) keys.

But now to the realized swagger supprt. PUM has to transfer parts of its model into the JSON oriented specification of swagger.

Full automation is not possible, but PUM creates help methods to define swagger specs for partial classes (without associations) and full classes (with associations). Associations are less needed, because it would lead to export of large structures. Perhaps not what you want to have if you create answers of REST calls. In addition it creates list models of partial classes – nice to use if you scroll (via rest calls) through a list of elements.

Swagger means also JSON: PUM creates methods defining special mapping for the JSON export of data and offers some special conversions support:

DateTimeWithStamps are converted automatically to UTC and Javascript number. This seems to be practicable for JS clients.

Enumerations are converted from their numerical internal value to their textual representation.

JSON support is based on Neo-JSON.

Posted in Smalltalk | Tagged , , , , | Leave a comment

Gemstone/S – Support for REST Systems

While working on a small REST system I noticed how boring (and incredable time consuming) all that work is. Typing in the classes, implementing the REST-API calls and then document the whole stuff for all the other developers.

After using the modeling tool now the changes of the model are pretty instant and more or less interactive – but now the documentation is still very time consuming.

Sebastian Heidbrink pointed me to an external tool set named swagger, which could help me saving time.

Swagger works the way, that you annotate your source code with information and then from this information the system generates a JSON based schema model, which defines the parameters location, parameter types and response type for each REST call (and some more stuff).

Several REST-calls may be bundled into defined REST-APIs.

The JSON resources can be static files located on any server. Now with a tool named SwaggerUI one can visualize the API and test it. The last part is really fun debugging !

I actually changed the kind of working with swagger for me. I added several Smalltalk classes in Gemstone to be able to define the JSON based schema model and now added Smalltalk code on the REST class class-side with information, what calls are belonging to the API, what parameters are needed etc.

Then I added a small REST runtime system and for each request now the system is looking for the JSON schema nformation about the executed call, look for the parameter descriptions, retrieves the parameter values, checks them and if all is ok, call the domain specific method.

ZincHTTP now not only serves the API, but also the specification of the API.

After having done this – one thinks about how the Modelling tool can create support for the Swagger Schema – but I will talk about this in a later posting

Posted in Smalltalk | Tagged , , , , | Leave a comment

Gemstone/S – Zinc HTTP and Large Data Transfer

When receiving a large data HTTP request with a size > 10.000.000 bytes the Zinc HTTP logic might fail due a memory limitation in a primitive. while reading a socket.

To get rid of this problem the receiving logic in Zinc should be changed to attempt several reads to get the request.

Posted in Smalltalk | Tagged , , | Leave a comment

Gemstone/S – Zinc HTTP and Unexpected Socket Closing

When working with Gemstone/s as a REST server system I noticed, that the actual Zinc-HTTP server is crashing now and then.

The reason is an unexpected closing socket throwing a SpSocketError and this exception is NOT catched.

I therefore added this error to:

ZnMultiThreadedServer>>readRequestExceptionSet

and

ZnMultiThreadedServer>>writeResponseExceptionSet

Marten

Posted in Smalltalk | Tagged , | Leave a comment