Download - Pure Ejb Within An Agile Context
Pure EJB within an Agile ContextAtlanta BEA dev2dev User Group
Monday. October 10, 2005
Presented by:
Noam Bunder
Sekhar Atteri
Larry Williams
Version 3.0
04/13/23
Atlanta BEA User Group 2
Questions:What do we mean by Pure EJBs?Can you make EJBs work in an Agile Methodology?Where do new frameworks fit in (Spring, etc.)?Can you use Eclipse and Workshop in harmony?What benefits do you get from Continuous Builds?How does Hibernate fit in?What does Maven bring to the table?
04/13/23
Atlanta BEA User Group 3
Overview
Overview:Combining a plain-vanilla Enterprise Java implementation, with the processes and tools common to Agile methods. Based upon WebLogic Portal, this session shows how to leverage Eclipse, Maven, CruiseControl and Hibernate for efficient development. We will review the architecture and development process, as well address challenges with the approach.
04/13/23
Atlanta BEA User Group 4
Agenda
Agenda:7:00pm – 7:30pm: Review the Architecture7:30pm – 7:45pm: Present Development Tool Set7:45pm – 8:00pm: Describe Continuous Build Process8:00pm – 8:30pm: Q & A / Open Discussion
ArchitectureArchitecture
04/13/23
Atlanta BEA User Group 6
Architecture – Assumptions, Drivers, Constraints and Challenges
ArchitectureAssumptions
Will be hosted as an ASP model, thus it must server multiple customers, with different load and customization demandsMust be understood, will be adopted company wide for new product suite
DriversKeep it Simple and FlexibleLeverage Existing, Proven Technology and DesignProvide a Foundation that is Extensible
ConstraintsInteroperability with Legacy SystemTime – Product to be delivered to customer for UAT within 5 monthsManagement Directive: Scrum Process
ChallengesRamp Up and Integration of Tool Set and Deployment ModelManaging Risks with Key Partners/Software Vendors
04/13/23
Atlanta BEA User Group 7
Architecture - Components
Architecture – Component View
04/13/23
Atlanta BEA User Group 8
Architecture – Design Patterns
Key Design PatternsProxy Pattern
Client Agent hides EJB Invocation
Session Facade Aggregates Business Services
DAO Pattern Abstracts Persistence Strategy
Presentation Tier
Middle Tier
Data Tier
Portal
Portal
Servlet
Java
PageFlows
JSPs
Client
Agent
Client
Agent
Factory
Business
Services
Data
Access Object
Value
Objects Oracle
Hibernate
Data
Access Object
Factory
Session
Facade
(EJB)
DataTransferObjects
Application Server
04/13/23
Atlanta BEA User Group 9
Architecture – Proxy Pattern and Session Facade
Facades add a layer of abstraction to the architecture allowing application and business semantics to be reflected in the Façade’s public methodsA Façade is an “agent” of the client running co-resident with servicesProvide an application-friendly broker that will aggregate service invocationsAlthough they execute on the server within the EJB Container, Facades are designed to serve as brokers for the web-tier clients (i.e., client agents)Facades can be an effective tool to minimize web-tier calls into the EJB-tierFacades should only contain lightweight logic delegating heavy-weight logic to collaborating business service componentFacades should have some structural form to provide standard processing for each method
Pre-Call ValidationCall SequencingPost-Call ValidationDTO Building
04/13/23
Atlanta BEA User Group 10
Architecture – Data Access Object with Hibernate
Resource access objects must accommodate both transactional and non-transaction semanticsResource access objects should serve the purpose of insulating the architecture from the technical nuances of the external resourcesResource Access Objects vend business objects to the services layer and interact with RDBMS systems or web service providers using the native protocols of the external resource
Resource access objects come is different typesDatabase Access ObjectsWeb Service Access ObjectsJMS Access Objects
Access objects should be hidden behind a service object, Façade components and presentation-tier components should never create direct references to access objectsDAOs are implemented using HibernateHibernate manages the mapping between the business domain model and the underlying relational database structureHibernate exposes a suite of CRUD APIs to the service layer allowing service methods to create, retrieve, update, or delete business objects as needed
04/13/23
Atlanta BEA User Group 11
Architecture – Sequence Diagram
04/13/23
Atlanta BEA User Group 12
Architecture – Key Success Factors
Begin Early with Domain ModelFit Database Schema to Object Model in a reasonable fashion
Both a blessing (huge time saving) and a curse (making changes to the db model to make it work for java applications)
Partner with BEA Professional ServicesEarly for prototype, Midway for review and End for deployment
Leverage BEA SupportGet the best developers you can find
Three or Four Senior Leads
Have finely controlled Architectural Constraints. Clear cut responsibilities for each package means faster time from use case to implementation
Invest Time enforcing Code Reviews
Development Tool Set
Development Tool Set
04/13/23
Atlanta BEA User Group 14
Development Tool Set – Assumptions, Drivers, Constraints
AssumptionsProvide Developers with a Productive Development Environment without compromising the End Product ArchitectureLeverage Tools associated with Agile Methodologies (i.e. Scrum)Development Tools will provide “easy-entry” for new Developers
DriversSupport largest range of possible Java related technologies, while staying as close as possible to mainstream Enterprise JavaLeverage WebLogic Portal for Branding and PersonalizationLeverage Eclipse for Development Ease and SpeedLeverage Hibernate for Time to Market and Reduced Database DependencyLeverage Cactus for In-Container TestingScript and Automate as much as possible to reduce human errorProvide visibility to Development to close loop - MTTBF (Mean Time to Bug Fix)
ConstraintsMinimize reliance on WebLogic Workshop to be replaced by Eclipse by Q4 2005Scrum process does not allow for abundance of documentation
04/13/23
Atlanta BEA User Group 15
Development Tool Set – Challenges
ChallengesDevelopment Environment requires precise configurationBig lettered Slides have been successful in assuring compliance½ Day walkthrough required to get new developers up and runningA “Development Core Image” does not provide everythingThe installation of Maven (1st running) must occur within the User Profile, where it builds its local repositoryWorking with a WebLogic Portal Project required some components to not be checked in to StarTeam, complicating a fresh-pull of codeDevelopers can “debug through” Back End code when exercised by Unit Tests, however Front End developers cannot debug Back End code, for it is compiled and copied into APP-INF/libUnit Tests are insufficient and can be sloppy. Although Code compiles, Unit Tests hog memory and can interrupt continuous build cycle
04/13/23
Atlanta BEA User Group 16
Development Tools
EclipseMultiple ProjectsUsing Mevenide Plug-in
MavenManages DependenciesProduces Web SitesRuns Build, Tests and Metrics
WebLogic WorkshopUsing JARs copied by MavenPageFlows expose Business Logic
HibernateHBM files with associated code
CactusExercised by Maven Plug-In
04/13/23
Atlanta BEA User Group 17
Development Tool Set - Lifecycle
Lifecycle: Code > Build > Test > DeployEclipse
Code, Build and Test
MavenBuild, Test and Deploy
Code Build Test Deploy
Eclipse Responsibility Space
Maven Responsibility Space
• Source Generation• Compilation• Dependant Projects• Resource Dependencies• Artifact Generation
• Cactus Unit Testing• Integration Testing• Profiling
• Doc. Generation• Artifact Trending• Project Website• Notification
04/13/23
Atlanta BEA User Group 18
MavenActs like a “Container” providing Services
Services for Build = Goals and Plug-Ins
Maven does not equal ANT ANT is not multi-project and dependency aware
Goes Beyond ANT to Provide a Multi-Project Build ScriptManages Dependencies via Local and Remote RepositoriesIntegrates into Eclipse (Development IDE)Provides Automated Quality and Unit TestsProvides a Multitude of Plug-InsGenerates Reports (Web Site)
Development Tool Set - Maven
Build
Build
Maven
Developed ANT Tasks
Task Calls
Maven Built-In Goals and Plug-Ins
04/13/23
Atlanta BEA User Group 19
Development Tool Set – Maven and ANT
ANT and Maven within the Build Process
coreejbcoreejb
infrinfr
corecore
coresupportcoresupport
MA
VEN
/ Cactu
s
pageflowspageflows
portalportal
Copy to web
project
BUILD EAR
StarTeam
EA
R FILE
Back End Code
Back End Code
Front End Code
Front End Code
Label StarTeam
Label StarTeam Un-deployUn-deploy Deploy/
Configure
Deploy/Configure
Development QA Smoke
QA Smoke QA Server
ANT
ANT
ANT ANT
04/13/23
Atlanta BEA User Group 20
Development Tool Set – Maven Website Screen Shot
Cactus Unit Test Cases Report
Continuous Build ProcessContinuous
Build Process
04/13/23
Atlanta BEA User Group 22
Continuous Build Process – Assumptions, Drivers, Constraints and Challenges
AssumptionsAgile Methodology (Scrum) to be followed, requiring daily statusDevelopment will include Iterative Integration and Testing
DriversProvide visibility and proper focus to developmentReduce down time between compile-breakagesFocus improvement upon realistic and objective metrics
ConstraintsTools do not extend fully into Workshop files (JPF, etc.)Unit Testing not emphasized (green = good compile only)
ChallengesLack of discipline around Cactus Tests made for long-build times (~15 minutes)Stability issues
04/13/23
Atlanta BEA User Group 23
Continuous Build Process
Separate Developer WorkstationRunning SimpleHTTP ServerWebLogic Portal
CruiseControl scheduledto kick-off build every20 minutesGreen Light / Red Light
via X10 devices
Scheduled Build at 2:00 AM Prepares build for QA (optional)
Timed to run every 20 minutes, 6:00am – 10:00pm
SummarySummary
04/13/23
Atlanta BEA User Group 25
Partner with BEA Professional ServicesLeverage BEA SupportSend folks to BEA Educational Services classesVisit dev2dev often for articles and code libraryGet the best developers you can – at least 3 seasoned leadsFocus on what works, take risks where they are manageableIntegrate BEA with other departments early (IT, Support, etc.)Design, Code and Lead by Example
Take AwayTips/HintsTake AwayTips/Hints
04/13/23
Atlanta BEA User Group 27
Maven Details
Maven in 3 concepts:POM (Project Object Model)Plugins
Made of Goals = Actions
Repositories
Maven files (in 3):project.xml
POM
maven.xmlCustom goals in JellyGoal, preGoal, postGoal
Configurationproject.propertiesbuild.properties
04/13/23
Atlanta BEA User Group 28
Maven POM Example
04/13/23
Atlanta BEA User Group 29
Cruise Control Details
CruiseControl Configurationconfig.xml – CruiseControl Configuration (see next slide)
Build Filesbuild.xml – Full Clean and Full Check Out (Get Latest)
ant – (default target)Calls the Clean and StCheckout Targets
build-cc.xml – Full Build and (Separately) Deployant –f build-cc.xml scheduled –Dlabel=build.xx
1. Full Build2. Update the Footer with the Label3. Label StarTeam
Separate Deployment Targets for each Environment
04/13/23
Atlanta BEA User Group 30
Cruise Control Sample Configuration File
<project name=“project"><bootstrappers>
<antbootstrapper /></bootstrappers> <modificationset><alwaysbuild/></modificationset> <schedule interval="600">
<maven goal="multiproject:install cleanDB multiproject:site" projectfile="C:/_project/source/server/project.xml“ mavenscript="C:\Maven_1.0.2/bin/maven.bat"/> <pause starttime="2200" endtime="0530"/> <pause day="sunday" starttime="0001" endtime="2400"/> <pause day="saturday" starttime="0001" endtime="2400"/>
</schedule> <publishers>
<email buildresultsurl="http://buildmachine:8080/cruisecontrol/index.jsp" defaultsuffix="@mailserver.com" mailhost=“IPADDRESS" reportsuccess="fixes" returnaddress="buildmachine" subjectprefix="Integration build - "> <always address=“developer"/>
</email> <x10publisher port="COM1" passDeviceCode="A3" failDeviceCode="A2"/> <x10publisher port="COM1" passDeviceCode="B3" failDeviceCode="B2"/> <artifactspublisher dir="C:/_project/source/server/target/docs“ dest="artifacts/project"/></publishers>
</project>