RPG Next Gen
Wiki RSS Feed Weblog
Business picture

WiicLink

About

What is WiicLink? WiicLink is a software project which aims to make the life of the software developer easier who needs to access data on the System i via service programs.

What does the name stand for? WiicLink (pronounced 'weaklink') stands for What-is-it-called Link. A link between the Java world and the What-is-it-called server platform. The server platforms name was AS/400 which has been rebranded to iSeries which has again been rebranded to System i which has again been renamed to Power Systemes. What is the machine called on which I am developing for years now? Actually I couldn't care less how it is called. It is a wonderful machine with awesome capabilities and a heavy identity crisis. Thanx IBM.

Programming Model

This is typical situation for any application:

  1. Client makes a request
  2. Frontend forwards the request to the middleware
  3. Middleware uses the WiicLink project to call the service program (procedure) on the i
  4. WiicLink creates domain objects from the response
  5. Middleware pushes the new domain objects to the frontend
  6. Frontend maps the domain objects to the presentation object
  7. Frontend answers clients requests

Annotated Domain Objects

Domain Objects will be annotated (like JPA 2.0). The Annotation describes which program or procedure should be called, what parameters must be passed and what to expect in the return value.

@Serviceprogram public class Item { private int id; private String name = ""; private String ean = ""; public void setId(int id) { this.id = id; } public int getId() { return this.id; } public void setName(String name) { this.name = name; } public String getName() { return this.name; } public void setEan(String ean) { this.ean = ean; } public String getEan() { return this.ean; } }

That should be enough to make the call and get the id, name and EAN of the specific item from the System i.

This framework will fall back to many defaults if nothing is stated. In the example the framework tries to call a procedure from the service program ITEM as it defaults to the class name which is Item. It expects a procedure with 3 parameters (id, name, ean) where the second and third parameter (name and string) are output parameter. The procedure name is expected to be prefixed with the service program name. The prototype for the procedure should look like this:

D item_get PR extproc('item_getItem') D id 10I 0 value D name 50A D ean 13A

WiicLink will determine on the number of attributes if the attributes are passed as multiple parameters or if they are grouped in a structure and passed in a single parameter. This is due to the limitations of the JTOpen classes and IBM i system API as the API can only pass 7 parameters on a program or service program call.

As you can see I am still gathering ideas before starting to code. Every input is appreciated.

Annotations

Serviceprogram

States that a service program is used.

  • name — service program name (default: class name)
  • create — procedure name for creating object (default: new)
  • read — procedure name for reading object (default: read)
  • update — procedure name for updating object (default: update)
  • delete — procedure name for deleting object (default: delete)
  • list — procedure name for listing some or all objects (default: list)

This Annotation can be used at class level.

Program

States that a program is used.

  • name — program name (default: class name)

This Annotation can be used at class level.