GVExample TestProperty

From GreenVulcano Wiki
Revision as of 09:05, 20 February 2012 by Anonymous (talk)
Jump to: navigation, search

Description

TestProperty service shows the use of the various metadata. This example is limited to create some properties and set its value with the scope of illustrating how metadata can be used. But shows also how to construct the possible properties that you will need in more complex flows.


For more information about metadata (or placeholders) click here.

VulCon Configuration

The preferred mode for creating a Service (at least its skeleton) is through the Service Wizard. Before using it you must first define a new Group, System and Channel, if you do not want to use those already present, and then start the Wizard.

From the core view:

  1. Right click the element Groups -> Insert after (or Insert before) -> Group. A new element Group will be created.
  2. Click on the Group new element and set the attribute id-group from the Properties View. We named it TEST_GROUP.
  3. Expand the GVSystems item.
  4. Right clicking on Systems, insert-after -> System. A new element System will be created.
  5. Set the System parameters in the Properties panel. We named it GVESB_TEST
  6. You can insert a new Channel right clicking the new System element -> Insert after (or Insert before) -> Channel*. A new Channel element will be created
  7. Click on this new Channel element and set the property id_channel. We named it TEST_CHANNEL.

For creating a new service using the Wizard execute the following steps:

  1. From the Core View of VulCon. Right click the element Services -> Wizard New Service
  2. A new window will be open where you can set the name of the Service you want to create, in this case we name it TestProperty, and as Group, we use TEST_GROUP. You can also select the scenario, for this example it will be synchronous-synchronous. Click next.
  3. Set System as GVESB_TEST and Channel as TEST_CHANNEL. Then finish.
TestProperty Service

As you can see from the core view, inside the Services element, a new Service named TestProperty has been created. The editor will be opened automatically, showing a workflow that must be modified successively as seen in the picture.

Expand the Palette if it is not already visible from the Editor View. This can be done by clicking into a little arrow head present into the Editor right top corner. The steps are:

  1. Add a ChangeGVBuffer Node:
    1. From the Palette drag and drop into the editor a ChangeGVBuffer Node.
      Adding a ChangeGVBuffer Node
      A new windows will be open where you can set the element id and its input GVBuffer name. In this example we set
    • id: test_property
    • input: data
      Then -> Next
    1. Choose the Virtual Layer Operation you need: in this case we add a ChangeGVBuffer. Then -> Next
    2. You can also set an Operation Level 2: As we want to define some Properties, we select a PropertyDef.
    3. Set the property name as SQL and the value as sql{{ds.gv_test::select 'OK' from dual}}. Then -> Finish.
  2. Add an End Node:
    1. From the Palette drag and drop into the editor a EndNode Node. A new windows will be open where you can set the element id. In this example we set
    • id: end.
      Then -> Finish
  3. Create the connections:
    1. From the Palette click into the Default Connection (black arrow)
    2. Create a connection between the Star Node and test_property ChangeGVBuffer Node. This is done by clicking first the Start Node and then the test_property node.
    3. Create another Default Connection between test_property ChangeGVBuffer Node and end node.
  4. Save the Editor in the Eclipse Main Menu.

The flow is already created. We added more properties in order to illustrate some GreenVulcano® ESB Placeholders. You can add more PropertyDef elements by right clicking the ChangeGVBuffer element present in the ChangeGVBufferNode -> Insert After -> PropertyDef. The defined properties are:

PropertyDef name value
SQL sql{{ds.gv_test::select 'OK' from dual}}
SQLLIST [sqllist{{ds.gv_test::select name from city order by 1}}]
TIMESTAMP timestamp{{yyyyMMdd HH:mm:ss}}
OGNL Service: ognl{{#object.getService()}}
JAVASCRIPT System: js{{gvesb::object.getSystem()}}
SYSTEM Server Name: ${{jboss.server.name}}
CLASS %{{fqclass}}
DECODE decode{{ognl{{#object.getProperty('SQL')}}::OK::Sql OK::Sql KO}}
MINUTE Minute decode{{js{{gvesb::timestamp{{mm}} % 2 == 0}}::true::EVEN::ODD}}
TestProperty configuration

Before finishing you must control that the VulCon Configuration has not errors. Errors are indicated by a red cross into the element icon.

  1. As we can see, it is present an error in the end node. Clicking this element we realize that is missing the output field.
  2. Set the parameter output as the output of the preceding node, that of test_property node.
  3. On clicking test_property element we see that the output has been setted automatically to output_1. You can change this value or set it if is not present. We changed it to output.
  4. Set the end element attribute output as output too.
  5. Save your changes using the Save icon present in the Core View.

Now your Service TestProperty will be configured as seen in the following picture.