980 likes | 1.3k Vues
BP202. Best Practices when Developing with IBM WebSphere Portlet Factory. Paul T. Calhoun / CTO, NetNotes Solutions Unlimited, Inc. Your Presenter – This Is Me!. Paul T. Calhoun Chief Technology Officer NetNotes Solutions Unlimited
E N D
BP202 Best Practices when Developing with IBM WebSphere Portlet Factory Paul T. Calhoun / CTO, NetNotes Solutions Unlimited, Inc.
Your Presenter – This Is Me! Paul T. CalhounChief Technology OfficerNetNotes Solutions Unlimited Paul Calhoun, ND 6,7 and 8 PCLI and PCLP,is a highly rated speaker who provides customer-focused knowledge transfer and consulting to Fortune 100 and 500 companies, as well as many SMBs. Paul currently builds Domino, Web, Java, and XML applications for his customers using Domino, Portlet Factory and WebSphere. He co-authored the IBM Redbook “XML Powered by Domino,” and has developed several online XML and Java programming courses. He has written articles for both “The View” and “The Sphere” technical publications.
Agenda • So What Exactly is the Portlet Factory ? • Installing Portlet Factory • Creating Projects • Creating Models • Testing and Deploying Models • Portlet Factory Development • Wrap up
Agenda • So What Exactly is the Portlet Factory ? • Installing Portlet Factory • Creating Projects • Creating Models • Testing and Deploying Models • Portlet Factory Development • Wrap up
So What Exactly is the Portlet Factory • The Portlet Factory Described in 50 words or less… The IBM Portlet Factory is a Rapid Application Development environment that allows for the creation of Web Applications and Portlets without having to write any code. These applications can then be massively customized to provide different user experiences with the use of profiled input.
So What Exactly is the Portlet Factory • Terminology • Portlet Factory – The application design environment enabled as a plug in to IDE’s like Rational and Eclipse • Factory Project – Top level container for Portlet Factory elements (Models, supporting HTML, XML, CSS files) • A project can contain “N” number of models • Model – Container for all application functionality represented as an XML structure of the complete Web Application • Models are made up of Builders • Builder – Component that provides specific application functionality to the Model • Profiling – The ability to dynamically alter the Application at runtime • Profile Sets – Container for the dynamic values that alter the Application at runtime • Profile Entry – Specific profiled builder input
So What Exactly is the Portlet Factory • Creates WEB APPLICATIONS that can be PORTLET enabled very easily • Designer client that plugs into existing IDE’s • Rapid Application Development Environment • Zero Code Development • Portlet Factory generates ALL the code for you • No, you CAN NOT alter the GENERATED code • No, to the best of my knowledge, you will never be able to modify the generated code • Allows for the MASSIVE customization of applications via PROFILING at runtime
So What Exactly is the Portlet Factory • Applications are deployed as standard JEE WAR files • To the Web Application Server • To the Portal Server • All necessary code is deployed with the WAR file • No additional configuration is required on the WAS/Portal server
Agenda • So What Exactly is the Portlet Factory ? • Installing Portlet Factory • Creating Projects • Creating Models • Testing and Deploying Models • Portlet Factory Development • Wrap up
Installing Portlet Factory • Portlet Factory can be officially installed on the following O/S’s • Windows 2003 • Windows 2000 • Windows XP professional • Windows Vista (Version 6.0.2 only) • Portlet Factory is a plug in to • Rational • Application Developer V6 and V7 • Software Architect V6 and V7 • Web Developer V6 • Eclipse • 3.1.x – PF 6.0 • 3.2.x – PF 6.0.1/PF 6.0.2
Installing Portlet Factory • Start the install program • Install.bat • On the splash screen choose the language of your choice • Click “OK”
Installing Portlet Factory • There will be an Introduction screen and a License screen • Click the “Next” button on both of these • On the “Choose Install Location” screen change the install location to something shorter than the default of installing in the program files directory • If you indicate the version number it will allows for the easy installation of multiple versions of the Portlet Factory • This may be beneficial if you are supporting projects going forward that are developed with different versions of the factory • Click the “Next” button Best Practice !
Installing Portlet Factory • On the “Specify install items” screen you have three choices • Into existing IBM Rational Application Developer • Into existing Eclipse • And Eclipse
Pros Makes sense if you already do the majority of your development in Rational Tools Provides editors for XML, XSD Schema, HTML, CSS and other editors out of the box Includes the WebSphere Application test Server Supports Rational Application Developer, Rational Software Architect and Rational Web Developer Cons Can only easily support one installed version of the Portlet Factory Requires more system resources (primarily memory) then Eclipse Due to the number of syntax validators included in the Rational product line, there are many more errors and warnings that have to be ignored in the Problems tab This makes it difficult to distinguish between the “noise” and real problems Installing Portlet Factory Into existing IBM Rational Application Developer
Pros Makes sense if you already have a working installed copy of the supported version of Eclipse Requires less system resources (primarily memory) than the Rational products As there are not as many validators, there are significantly less problems/errors in the problems tab for valid Portlet Factory projects Cons Can cause problems/errors if not installed into the proper version of Eclipse For example the latest release of Eclipse is 3.3, but the latest supported release for the Factory is 3.2 Installing Portlet Factory Into existing Eclipse
Pros Best choice if no other development environment is installed on your workstation Allows multiple versions of Portlet Factory to be installed on the same workstation Ensures that proper version of Eclipse for running Portlet Factory Does not alter the configuration of any other installed tools on your workstation Isolates the Portlet Factory development environment The workspace can be updated with additional editors to support XML, HTML, CSS and other editors Cons Requires additional disk space if other development tools are already installed Managing workspaces can become difficult if not kept in version specific directories Installing Portlet Factory And Eclipse Best Practice !
Installing Portlet Factory • New to Portlet Factory 6.0.2 is the option to install WebSphere Application Server – Community Edition (WASCE) • This provides a light weight alternative to installing and configuring the App/Portal server on your local workstation • Installs as part of The Portlet Factory installation so there is no need to download, install and configure an alternate WAS server like Tomcat Best Practice !
Installing Portlet Factory • Install WASCE into the same directory that you are installing the Portlet Factory into • This keeps all of this versions specific resources together
Installing Portlet Factory • The final screen is a the Pre-Installation screen summarizing the installation choices • Click the “Install” button to complete the installation
Installing Portlet Factory – Best Practices Best Practice ! • Don’t install in the default directory • Choose the “With Eclipse” install option • Install the WASCE server for testing locally • Install Portlet Factory, Eclipse and WAS/CE into the same directory root • If installing multiple version of Portlet Factory (or the same version into different IDE’s) copy the menu shortcuts to your Desktop • The Portlet Factory Install over writes the menu items with the latest installation location • Periodically check for fix packs and updates to ensure you are running the most current version of Portlet Factory
Agenda • So What Exactly is the Portlet Factory ? • Installing Portlet Factory • Creating Projects • Creating Models • Testing and Deploying Models • Portlet Factory Development • Wrap up
Creating Projects • Regardless of which IDE you extend all factory development is done in the WebSphere Portlet Factory Perspective Currently Open Model Project List Builder Call List Problem, Task and Profile tabs
Creating Projects • Create a new Portlet Factory Project using the file menu or the right click menu • Choose New > WebSphere Portlet Factory Project
Creating Projects • Provide a project name • By default this value becomes the basis for the deployed WAR file name • Keep it short but descriptive • Leave the “Use default location” box checked • This will store the project in the workspace
Feature Sets add functionality to the project for a specific task In the “Add Feature Sets” dialog select the additional functionality to add to this project Functionality that is not added during project creation can be added later via the projects properties dialog To access Domino objects, select the “Lotus Collaboration Extension” feature Tutorial and Samples supply complete working examples of Portlet Factory projects Don’t include in every project Tip Creating Projects
Creating Projects • Feature Sets are .pkg files located in the following directory • \install_folder\WPFDesigner\FeatureSets\Web-App_6.0.1\Packages • .pkg files are Portlet Factory archives • Even though they have a .pkg extension, they are just WinZip files and can be opened with the WinZip utility • The Charting capability is for evaluation/demo purposes only • In order to use the charting in production applications you will need to • Upgrade to the Dashboard Framework • Get a license from GreenPoint, Inc. • http://www.gpoint.com
Creating Projects • No additional libraries need to be added to standard Portlet Factory projects • Just click Next
Creating Projects • Deployment Configuration defines the test server environments • The test servers need to be running before you create the configurations • You will need to Add a configuration when creating the first project in a every new Workspace • Subsequent projects will be able to choose from the existing configurations • You will need to create configurations for the • Application Server • WebSphere Application Server – Version 5.x or 6.x • WebSphere Application Server – Community Edition • Apache Tomcat – Version 5.5 • Portal Server • WebSphere Portal Server – Version 5.x or 6.x
Creating Projects • You do not have to have the Portal Server installed on your local workstation • You can de-select the “Specify Deployment Credentials” checkbox on the Portal configuration • This will still allow you to create portlets in the Portlet Factory, but the only object that will be created is the deployment WAR file • This WAR file can then be installed on any Portal Server (Local or Remote) via the Administration tools included with the Portal Server Best Practice !
Creating Projects • Completed Deployment Configuration • After you click the “Finish” button you will be prompted to deploy the project now • Click “Yes”
Creating Projects • The Configuration details are stored in the workbench preferences under • WebSphere Portlet Factory > Deployment • The configuration files are located in the following directory • workspacedir\.metadata\.plugins\com.bowstreet.designer.webapp\deploymentconfigs • The files located in this directory can be copied to a central location and then referenced in subsequent workspaces so the that the configurations do not have to be re-created Best Practice !
Creating Projects • Project folders are configured as JEE applications in the Project Explorer • Models folder • Contains all project Models • Profiles folder • Contains all profiles • WebContent/WEB-INF/work/source • Contains java code that can be accessedby the Linked Java Object (LJO) builder • WebContent • Contains support files • Web Pages • CSS files • XML Documents
Creating Projects – Best Practices • Do not AutoDeploy the Portlet War from the Factory Configuration • This allows for the deployment of the WAR file via the Portlet Administration functionality • Use the WASCE test server installed as part of the Portlet Factory as your Web Application test server locally • If running a version prior to 6.0.2, then use the RAD test server or Tomcat • Do not include the Tutorials and Samples Feature in every project • If you need/want these for reference create a separate project
Creating Projects – Best Practices • After creating your first project, copy the Deployment configuration files to a central location for use by new workspaces • Only add the Features that are required for that project • Some Features add sample models, html, xml, css and xsd schema files that are not needed for the production application • Either delete these or add them to a “nodeploy” folder prior to production deployment (Search help for “nodeploy” for more information)
Agenda • So What Exactly is the Portlet Factory ? • Installing Portlet Factory • Creating Projects • Creating Models • Testing and Deploying Models • Portlet Factory Development • Wrap up
Creating Models • Models contain all of the application logic for a Web Application or Portlet • Models are contained in a Project • Create a new model from the file menu or right click menu • File > New > WebSphere Portlet Factory Model
Creating Models • Select the project this model will be a part of • Click Next
Creating Models • On the Select Model page there will be default choices and additional choices based upon features that have been added to the project • The following are the default options • Factory Starter Models • Empty • Main and Page • Service Consumers • List and Detail Service Consumer • Service Providers • Database Service Provider
Creating Models • Empty • An empty model that contains no Builder calls • It is a blank slate, to which the developer must add all of the necessary application functionality • Choose this type of new model when you want to build the entire application without any assistance up front • After you have familiarized yourself with the Portlet Factory this will be the one you start with 94.27% of the time Best Practice !
Creating Models • Main and Page • A Main and Page model supplies a page and a main action that presents that page when the application is run • You may specify your own page or use the default that is provided for you • This is a very basic starting point from which you may then begin your development effort • If you are creating a Web Application/Portlet that does not access any data (RDBMS, Domino etc) then this saves you the time of creating two builders you would need any way • Always create this simple model to test new server configurations Best Practice !
Creating Models • Database Service Provider • Creates a service provider model that exposes operations corresponding to SQL statements executed against a J2EE data source • The data source has to be defined on the Application/Portal server before the Portlet Factory can consume it • This wizard will provide some of the information for the builders that define this service provider, but most builders will have to be edited • In reality once you have used the wizard vs creating a service provider model from scratch, you will create service provider models from scratch
Creating Models • List and Detail Service Consumer • This wizard builds a model that displays data from a data service that is already defined in the project • It can create tables and detailed views of data using the View and Form Builder behind the scenes • In reality once you have used the wizard vs creating a service consumer model from scratch, you will create service consumer models from scratch
Tip Creating Models • Other models available during setup • Some Features (like the collaboration feature for Domino) will add wizards to this interface that allow you to use them to create models with that features functionality • Once you have stepped through the wizard once and seen the builders that are included in the model you will probably opt for creating subsequent models from scratch • The final dialog will prompt you for a Model name and location • You can create folders that do not exist yet by typing the folder name in the “Enter or select the folder:” field • Enter the model name in the Model Name Field • Click Finish
Creating Models • The newly created model will be displayed in the Project Explorer View under the Models folder • All the builders that are used to comprise this model are located in the Outline View Model Builder Call List
Creating Models • The model is open in the Editor area that can be navigated using the four tabs at the bottom of the view • WebApp Tree • Hierarchical structure of the application components • After adding a new builder you should review the WebApp tree to see what was added • Model XML • Complete XML representationof the application • If you export a model file,this is the contents of that file • Builder Call Editor • Editor where Builder Inputs are supplied • Web App Diagram • Graphical Depiction of the application Best Practice !
Creating Models – Best Practice • Create a Main and Page model to test new server configurations • Delete or add this model to the “nodeploy” folder prior to deployment • Use the “Empty” starting Model • Avoid “One Project – One Model” development • Remember that Project = Deployed WAR file • You can have multiple Models per project (5-10 is the recommended max) • Include a comment builder at the beginning of every Model that describes the models functionality
Agenda • So What Exactly is the Portlet Factory ? • Installing Portlet Factory • Creating Projects • Creating Models • Testing and Deploying Models • Portlet Factory Development • Wrap up