Download presentation
Presentation is loading. Please wait.
Published byAbel Logan Modified over 9 years ago
1
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture
2
© 2003 IBM Corporation Portlet Factory Components Developer tool – Portlet Factory Designer –Plug-in for Eclipse / RAD Server component – Automation Engine –Runs in WAR on J2EE app server or Portal Server –Executed via Servlet or Portlet API Core Factory technology is used both by design tool and runtime: –Regeneration engine –Models, Builders, and Profiling –In the runtime, these pieces support dynamic profiling
3
© 2003 IBM Corporation Builders and Models Model XML file contains a list of calls to Builders –With all the Builder inputs specified at design time –Builders generate a WebApp structure – this process is called “regeneration” Regeneration is done: –At design time –On demand at runtime on server Each builder can: –Introspect the WebApp –Create new elements in WebApp –Modify any existing elements in WebApp –Invoke any other builders in the system This makes it easy to make higher and higher level builders
4
© 2003 IBM Corporation Builder Architecture Generated WebApp Pages and controls Variables/Beans Schemas and metadata Actions & Methods Properties SAP Function Builder Variable Builder Imported Page Builder Regeneration Engine Model XML File BuilderCall 1 – SAP Function - builder inputs BuilderCall 2 – Imported Page - builder inputs BuilderCall 3 – Data Page - builder inputs Etc. Action List 2. During regeneration, for each Builder in the model XML, the appropriate Builder’s regeneration method is invoked. All the the Builder inputs specified by the user in the editor are passed to the Builder. 3. From their regen methods, Builders can introspect, create, and modify any parts of the generated application. They can also invoke any other Builders. Data Page Builder Variable Imported Page Data Page SAP Function Action List Builder Builder Definition XML Files Builder Regen Classes Portlet Factory Designer 1. Portlet Factory Designer uses BuilderDef files to construct UI for editing Builders in the Model.
5
© 2003 IBM Corporation Models Models are XML files that contain a list of Builder Calls com.bowstreet.builders.webapp.ImportedPageBuilder inputPage /inputPage.htm com.bowstreet.builders.webapp.ActionListBuilder main inputPage First Builder Call (Imported Page) Second Builder Call (Action List) Sample model XML
6
© 2003 IBM Corporation Profiling Profiles can be used to generate multiple applications from a single source Model During regeneration, values from the selected profile are used for specified Builder inputs Because the entire application is created by Builders, and any Builder inputs can be profiled: –There are no limits on what can be modified by profile –Presentation, workflow, logic, services, etc., can all be varied by profile as much as you want Pluggable interfaces are used for all profile determination and profile values, for complete flexibility in how profiling is used
7
© 2003 IBM Corporation Profile A WebApp Pages and controls Variables/Beans Schemas and metadata Actions & Methods Properties SAP Function builder Variable builder Imported Page builder Regeneration Engine Data Page builder Action List builder A Builder Regen Classes Model XML File BuilderCall 1 – SAP Function - builder inputs BuilderCall 2 – Imported Page - builder inputs BuilderCall 3 – Data Page - builder inputs Builder Architecture - Profiling Profiles Action List Variable Imported Page Data Page SAP Function Builder Definition XML Files Inputs for Profile A
8
© 2003 IBM Corporation Builder Architecture - Profiling Profile B WebApp Pages and controls Variables/Beans Schemas and metadata Actions & Methods Properties SAP Function builder Variable builder Imported Page builder Regeneration Engine Data Page builder Action List builder B Profiles Builder Regen Classes Model XML File BuilderCall 1 – SAP Function - builder inputs BuilderCall 2 – Imported Page - builder inputs BuilderCall 3 – Data Page - builder inputs Action List Variable Imported Page Data Page SAP Function Builder Definition XML Files Inputs for Profile B
9
© 2003 IBM Corporation WebApp Structure WebApp structure is an abstract representation of a web application WebApp dispatching and action execution is handled by Portlet Factory runtime library WebApp Elements: –Action Lists, Methods, and Classes –Pages and Data Page elements –Variables ( XML, primitive, or Java objects) –Schemas –Linked Models –Events –Properties
10
© 2003 IBM Corporation Portlet Factory WebApp Controller Framework Code generated by Portlet Factory builders works with Portlet Factory execution controller –Factory controller runs as Servlet or Portlet –Generated code uses Portlet Factory runtime library APIs Key Features of Portlet Factory WebApp Controller –Can run in multiple containers (WebSphere Portal Native, Java Standard Portlet (JSR 168), J2EE Servlet) –Rich API set available for application developers –Caching support –Events and error handlers –Linked model and contained model support –Logging, tracing, and performance monitoring, controllable by properties –Support for Web Service provider –Many open extensibility points for further control, including: Profile selection and profile value handlers Logging and monitoring Data Page code generation
11
© 2003 IBM Corporation Portlet Factory and Portal Server Factory WebApp Execution Controller Profile Selection Main Factory Dispatcher Application objects J2EE Components (JDBC, EJB, etc.) Generated WebApp objects, classes, and JSP’s WPF-supplied support libraries Enterprise data sources and web services = WPF Components = J2EE App Server Factory Portlet Adapter = Application or customer code HTTP Request = Builder-generated objects BuilderDef Files Model XML Files Regeneration Engine & Cache Builder Profile Data Portal Server
12
© 2003 IBM Corporation Portlet Factory and Application Server Factory WebApp Execution Controller Profile Selection Main Factory Dispatcher Application objects J2EE Components (JDBC, EJB, etc.) Generated WebApp objects, classes, and JSP’s WPF-supplied support libraries Enterprise data sources and web services = WPF Components = J2EE App Server Factory Servlet = Application or customer code HTTP Request = Builder-generated objects BuilderDef Files Model XML Files Regeneration Engine & Cache Builder Profile Data Application Server
13
© 2003 IBM Corporation Creating Custom Builders Three components of a Builder: 1.BuilderDef XML file –The BuilderDef defines all the information about the Builder –Specify inputs, description, Java class 2.Builder class for regeneration –The “doBuilderCall” method of this class adds or modifies elements in the application being generated –Builders can do their work by: Calling any other Builders Calling methods on the WebApp directly to add/modify objects 3.Optional “Coordinator” class to support custom dynamic builder UI Builder Skeleton tool creates all these for you
14
© 2003 IBM Corporation BuilderDef Example Date com.bowstreet.builders.webapp.foundation.WebAppControlGenHandler 5.0.0 Puts current date/time on page WebApp com.bowstreet.examples.DateBuilder Page and Layout ` Format Select how date should be formatted MM d,M/d/yy,MMMM d yyy,MM/dd/yyyy,HH:mm:ss,HH:mm:ss:z 200 Builder ID Name of builder’s regen class Definitions of all the inputs for this builder
15
© 2003 IBM Corporation Builder Class Example public class DateBuilder implements WebAppControlBuilder { /** * This is the method that's called during generation of the WebApp. * This builder creates a JSP scriptlet that outputs a formatted Date. */ public void doBuilderCall(GenContext genContext, WebApp webApp, BuilderCall builderCall, BuilderInputs builderInputs, PageLocation pageLocation) { // Get the format string from builder input String formatString = builderInputs.getString("Format", "MM/dd/yyyy:HH:mm:ss:z"); // Construct a JSP scriptlet that looks something like: // String dateExpression = "<%= new java.text.SimpleDateFormat(\""; dateExpression += formatString; dateExpression += "\").format(new Date()).toString() %>"; // Call the Text builder to insert the scriptlet at specified location Text textBuilder = new Text(builderCall, genContext); textBuilder.setPageLocation(pageLocation); textBuilder.setText(dateExpression); textBuilder.invokeBuilder(); }
16
© 2003 IBM Corporation WebApp Pages (JSP) Methods/ActionLists Linked Models Variables & LJO’s Portlet Factory Servlet/Portlet Request for Portlet Factory model/action Web App execution Data sources and services Execution: first request for model on server WebAppRunner WebAppGenHandler WebApp Builders Determine profile JSP files Profile selection handler Regen & Cache 1. 2. 3. 4. 5. Instance data creation 6. 7. 8. Methods class generation 9.
17
© 2003 IBM Corporation Portlet Factory Servlet/Portlet Request for Portlet Factory model/action Data sources and services Execution: same session WebAppRunner WebAppGenHandler WebApp Builders Determine profile JSP files Profile selection handler Regen & Cache 1. 2. WebApp Pages (JSP) Methods/ActionLists Linked Models Variables & LJO’s 3. Instance data creation Methods class generation Web App execution
18
© 2003 IBM Corporation Portlet Factory Servlet/Portlet Request for Portlet Factory model/action Web App execution Data sources and services Execution: new user, same profile WebAppRunner WebAppGenHandler WebApp Builders JSP files 1. 4. Determine profileProfile selection handler Find in Cache 2. 3. 5. WebApp Pages (JSP) Methods/ActionLists Linked Models Variables & LJO’s 6. Instance data creation Methods class generation
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.