How MiniLang is formed

How minilang can be defined?
Its is simply well formed XML. Developers write XML that obeys a defined schema, this XML is then parsed by the framework and commands are executed accordingly.
A local copy of the schema is included with the source code in framework\minilang\dtd\simple-methods.xsd.

Where we use minilang?
Although Minilang’s primary use is to code services and events, concepts from Minilang are also used to prepare data for screen widgets.

A simple service in minilang-
Minilang services are referred to as “simple” services. They are defined and invoked in  the same way as a Java service. They can be invoked by the control servlet from the controller.xml file or from code in the same way as a Java service.

In the file ${component:learning}\servicedef\services.xml add a new service definition:

location=”org/ofbiz/learning/learning/LearningServices.xml” invoke=”removeData” Service to remove a planet review.
When we defining service for minilang the engine should be defined as “simple” to intimate the framework as it’s a minilang type.

We commonly group the service definitions into one XML file, and that file will be loaded from ofbiz-component.xml, so that system will know to load the list of availble services.
Services are not grouped according to its type(java or simple) what ever it may be correct number of parameters has to be passed to it to get success result.

Note: simple method XML belong to the script folder its because to load it dynamically without restarting the system.
The script dir must be in classpath, Open the file ${component:learning}\ofbiz-component.xml and if it’s not already defined then add <classpath location=”script”/> it to ofbiz-component.xml.

How to create a service in minilang?
Create a service file and place service definition add the request-map to the controller.xml.
Since we have added a new service definition OFBiz must be restarted. A compilation is not needed. Restart and fire an http request.

In Minilang, when there is a look up for value-name, the context is checked for a
parameter with the same name as the primary key for this field, as specified in the
entity definition for PlanetReview. If there is one, and we know there is since we
have declared a compulsory parameter reviewId in the service definition, then
the framework will automatically take it from the context. We do not need to do
anything else.

Please post your query if you have any doubt or if you need more information in this topic.
Thanks

Share :
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • TwitThis
  • E-mail this story to a friend!
  • MySpace
  • Print this article!
  • Reddit
This entry was posted in OFBiz, OFBiz and Opentaps, Opentaps and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>