Developing BOF-Oriented Services for J2EE Applications
Documentum Developer Conference 2004 October 04, 2004
1
Agenda What is BOF What is J2EE Adopting BOF to J2EE Best Practice Q & A
2
Business Object Framework (BOF) BOF Overview What are Type-Based Objects (TBOs)? What are Service-Based Objects (SBOs)? BOF DFC APIs
3
BOF Overview What are Documentum Business Object – Encapsulates business logic – Separates concerns from data layer and presentation layer – Provides solutions to specific business problems – Examples: DFC 5.2 ships with workflow inbox service, workflow reporting, subscriptions etc.
4
BOF Overview How are Documentum Business Objects Written? – Currently, DBO must be written in Java – Using a DBO requires much less knowledge of DFC and data tier
5
BOF Overview What is BOF? – Allows you to build, test, discover, deploy and run business logic as DBO – Session and Transaction Management – The framework is built into DFC (5.x) – Unlike API, it allows you to extend DFC and add your own behavior
6
Business Object Framework TBO architecture
7
Business Object Framework
8
Business Object Framework Implement a TBO – Public interface IMySOP extends IDfBusinessObject {..} – Public class MySOP extends DfDocument implements IMySOP, IDfDynamicInheritance {…}
9
Business Object Framework SBO Architecture
10
Business Object Framework SBO
11
Business Object Framework Implement a SBO – public interface IFrontControllerSBO extends IDfService { public void process(Request requster, Response response); } - public class FrontControllerSBO implements IFrontControllerSBO {…}
12
BOF DFC API Java Package: com.documentum.fc.client IDfBusinessObject IDfDbor/IDfDborEntry IDfService/DfService
J2EE Architecture Presentation + Business Logic + Data
15
Adopting BOF to J2EE Why BOF to J2EE – WDK Vs. Struts Vs. BOF – Many existing systems were developed in J2EE/Struts. – Leverage DFC/BOF to integrate to existing J2EE apps. – Service-Oriented Benefits
16
Adopting BOF to J2EE How to make a J2EE component BOF-aware – No multiple inheritance – Servlet Extends from javax.servlet.http.HttpServlet, Add reference to SBO Controller in the base Action/Servlet. – EJB Bean class implements javax.ejb.Session, can implement IDfService and extends DfServiceDfService is NOT Serializable Use BOF adapter to control “Transient” variables
17
Adopting BOF to J2EE How to expose SBOs as WebServices – How to expose SBOs as WebServices – Use Apache Axis Servlet/SBO-aware Servlet – Axis Model – Map normal SBO/Java Class in Axis Sever-config.wsdd
18
Adopting BOF to J2EE How to expose SBO as EJBs – Use EJB Controller and EJB Adapter – Use SBO-aware EJBs – Or, Single EJB façade delegates SBO calls
19
Adopting BOF to J2EE Struts – How to call those services and EJBs from Struts – Base Struts action – Request/Response Model – Request Object – Response Object – Stateless
20
Adopting BOF to J2EE .NET WebServices – How to invoke SBOs from .NET via WebServices Wsdl Http://localhost/app1/SBOWebServices?WSDL csc /out:SBOWebServices.dll /t:library /r:System.XML.dll,System.Web.Services.dll,System.dll SBOWebServices.cs Dim wsClient As new SBOWebServices ()
21
Adopting BOF to J2EE .NET WebServices – Code: Try wsClient.methodXXXl(“param1) Catch Ex As Exception //error handling End Try
22
Adopting BOF to J2EE Wrapping JMX calls – What is JMX? – In BOF SBO, add code to create Server and register MBeans: MBeanServer server = MBeanServerFactory.createMBeanServer(); HtmlAdaptorServer html = new HtmlAdaptorServer(); String port = "8082"; ObjectName html_name = null; html_name = new ObjectName("Adaptor:name=html,port=" + port); server.registerMBean(html, html_name);
23
Adopting BOF to J2EE Configuration Issue – DBOR revisited – Use it to store other key/value pairs nterface1=other, value1, 1.0 – J2EE Configuration WEB-INF/web.xml WEB-INF/struts-config.xml WEB-INF/applicationContext.xml (Spring)
24
Adopting BOF to J2EE Wrap your BOF work into a simple J2EE SOA layer – Add a Front Controller SBO to route service Requests to other low-level Controller SBOs – Add specific low-level Controller SBOs to handle specific APIs or client requests – Add XML service mapping to facilitate routing – Use Reflection – Build bridge to Struts at Front Controller layer
25
BOF-Based J2EE Architecture
26
Best Practice Use Adapter Design Pattern to simplify the base implementation class of SBOs Implement Base Struts Action to simplify SBO references Use SOA concept to handle request/response Use Front Controller pattern to centralize message passing and routing
27
References .NET Framework SDK 1.1 JDK 1.4 J2EE 1.4 Struts 1.1 DFC User’s Guide DFC Advanced Training Manual JavaWorld article published on Oct 04, 2004