200 likes | 343 Views
I16. How to call Informix 4gl code from J2EE. Sergio Ferreira IIUG. Thrsday, October 12, 2006 • 10:30 a.m. – 11:30 a.m. Platform: Informix. Why call 4gl from java. The software evolves over time along with changes in the business. It supports the business needs.
E N D
I16 How to call Informix 4gl code from J2EE Sergio Ferreira IIUG Thrsday, October 12, 2006 • 10:30 a.m. – 11:30 a.m. Platform: Informix
Why call 4gl from java • The software evolves over time along with changes in the business. • It supports the business needs. • normally its based on “old” technologies • The temptation is to fully rewrite everithing • What about new technologies ? • We need to use new technologies to adress today's needs (web applications, web services, integration with new systems)
What is J2EE • A platform to create applications in Java • Defined by a standard specification • It is based on the existence of an application server • Includes specifications for a lot of enterprise requirements: • User interface (JSP, portlets, JSF, servlets) • Business Rules – EJB(s) • Database access – JDBC • Legacy integration – JCA • XML • Web services • Directory services • Transaction management • Authentication and Authorization • The compliant AS implement the specifications
The Application Server • A Java server that offers : Containers, api(s), managers, admin tools
Why not a native call to 4gl • It can cause problems in the Application Server • Even when the native code is working properly it is always suspected when problems occur. • 4gl does not work on a multi-threaded environment • The function call stack is static • The connection mechanism is based on ESQL/C that works on MT but not on generated 4gl.
The solution • Use JCA • Create a way to spawn 4gl processes • Comunicate between the Resource adapter and the 4gl process
What is JCA • JCA stands for Java Connection Architecture • JSR 112 • It is part of J2EE • It is a standard for connecting Java Application Servers and Enterprise Information Systems (EIS) • Defines an interface called Resource Adapter • JDBC could be (and some times is) seen as a Relational Resouce Adapter
Connections Contracts JCA
What doesn't it solve (yet ) • Interactive programs
What do we need • Develop a JCA resource adapter • Create the comunication mechanism between the 4gl process and the Resource Adapter • Develop a C library to handle the comunication between the AS and the specific function in the 4gl process • Execute the calls to the remote functions from the java side using the JCA interface (javax.resource.*)
What do we gain • Reuse of legacy business rules • Less problems • Much lower cost than redeveloping • Fast productivity (making the business rules in much higher level language)
What will be nice to have • Automation of the exporting process to expose 4gl functions as Stateless Session Beans • It is very important avoid high cost in exporting the functions • It could be made in severall ways from a simple script to a complete 4gl parsing process
Using SOA • Oasis definition: • “Service Oriented Architecture is a paradigm for organizing and utilizing distributed capabilities that may be under the control of different ownership domains. It provides a uniform means to offer, discover, interact with and use capabilities to produce desired effects consistent with measurable preconditions and expectations. • With this architecture you can have level 1 and 4 imediatly implemented (in seconds or minutes). • You can also easily generate web services based on the 4gl function calls • It enables one of the SOA goals : loosely coupled and interoperable services
Next steps • Call Java and web services from 4gl • Solve the interaction problem (if possible)
Important • Calling 4gl from J2EE its not a product. • It is a pattern using standards • Its not dependent on a specific technology • I use it every day with : Websphere ; Jboss ; WebLogic
Conclusion • If you need to call Informix 4GL programs from Java use a JCA
Session I16 How to call Informix 4gl code from J2EE Sergio Ferreira IIUG sergio@iiug.org