© blackboard, inc. all rights reserved. developing blackboard building blocks: getting started john...

39
© Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Upload: bernard-harper

Post on 15-Jan-2016

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

© Blackboard, Inc. All rights reserved.

Developing Blackboard Building Blocks: Getting StartedJohn KnightSenior EngineerBlackboard Inc.

July 18th

Page 2: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Overview

» Goals» Blackboard® Building Blocks® Technology» Java/JSP Development Tools» Blackboard Building Block Development – Tools

and Techniques

Page 3: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Now a word from our lawyers…

Any statements in this presentation about future expectations, plans and prospects for Blackboard and other statements containing the words "believes," "anticipates," "plans," "expects," "will," and similar expressions, constitute forward-looking statements within the meaning of The Private Securities Litigation Reform Act of 1995. Actual results may differ materially from those indicated by such forward-looking statements as a result of various important factors, including the factors discussed in the "Risk Factors" section of our most recent 10-K filed with the SEC. In addition, the forward-looking statements included in this press release represent the Company's views as of July 18, 2005. The Company anticipates that subsequent events and developments will cause the Company's views to change. However, while the Company may elect to update these forward-looking statements at some point in the future, the Company specifically disclaims any obligation to do so. These forward-looking statements should not be relied upon as representing the Company's views as of any date subsequent to July 18, 2005. Blackboard, in its sole discretion, may delay or cancel the release of any product or functionality described in this presentation.

Page 4: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Audience

» Basic to Intermediate Java developer» Java/JSP/Servlet development is assumed» Blackboard Building Block development is not

assumed, but is helpful» Familiarity with, but not necessarily expertise

in, current Java development tools

Page 5: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Goals

» Focus on process and environment, rather than Blackboard Building Block technology

» Cover a selection of tools that are available to build Blackboard Building Blocks

» Describe techniques and practices that will make the development process easier

Page 6: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Blackboard Building Blocks Technology

» Extensibility mechanism for Blackboard» Provide drop-in functionality, or ...» Provide a bridge to an external system

» Standards-based» Blackboard Building Blocks are Java webapps with

additional metadata» Rely on/integrate with embedded Tomcat engine

Page 7: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Blackboard Building Blocks Architecture

Core Services

Data Objects

Business Layer(JSP, Servlet, Struts)

View Layer(JSP, Servlet, Tag Library)

Log

Security

Config Persistence

Session

I18N VXI

Context Plug-ins

Page 8: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Anatomy of a Blackboard Building Block

Package (.war/.zip file)

Platform Descriptor

Blackboard Manifest

Web Resources

Libraries

web.xml (Servlets)

Servlets, JSP (Java)

.class, .jar files (Java)

bb-manifest.xml

Page 9: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

The Process

» Feature Planning» Defines what you’ll need in terms of entry points

» Set up the build environment» Local Blackboard server works best

» Perform an initial build» Get entry points defined» Install the Blackboard Building Block

» Iterate» Build/rebuild» Redeploy

Page 10: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

The Build Stages

» Compile» Custom .java files compiled into .class files

» Stage» Web app structure is created from other

components

» Package» Web app structure is zipped into the .war file

» Deploy» An alternate to “package”, depending on the

cycle

Page 11: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

The Process

PreliminaryFeaturePlanning

EnvironmentSet-up

Initial Build/Install

Compile Stage Package

Compile Stage Deploy

Iterate

Page 12: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

The Process

» Initial Install vs. Re-deploy» Initial Install reads manifest and establishes the

entry points» Re-deploy simply makes Blackboard Building

Block inactive, then makes it Available again» Cycles webapp, reloads classes» Inactive/Available cycle unnecessary for JSP changes

Page 13: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Example – The Build Environment

» JDK 1.4/5.x – The core Java library you’ll need » Eclipse 3.x – An IDE for

editing/debugging/formatting» Ant 1.6.2 – A tool to automate many of the

tasks (within Eclipse and via shell automation)» ... All Freely Available

Page 14: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

The Tools – JDK

» Version is dependent on which Blackboard install is targeted» 6.0.11 and higher supports 1.4.x» 6.3 and higher require 5.x

» New language features are extremely nice

Page 15: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

The Tools – Ant

» An Apache Software Foundation project» Not bound to Blackboard release» Samples developed against 1.6.2, but should

work against earlier versions

Page 16: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

The Tools – Eclipse

» Java IDE with substantial productivity features» Ant integration» Refactoring» JUnit integration» Plugins (e.g., SCM integration, JSP editing)» You’ll need 3.1 if you’re developing with JDK 5.x

Page 17: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

The Strategy

» Organize the workspace to separate the different types of files you’ll work on» Web Files (JSPs)» Logic Files (.java files, servlets, etc.)» Configuration Files (.tld, .xml)» Etc.

» Use a tool that will automate the transformation of each artifact into the next» Build the configuration to support rapid iteration

» Use the tools to support unit development, unit testing, and debugging» Better encapsulated, smaller units helps make the iteration

easier

Page 18: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Organizing the workspace...

Page 19: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Example – The Directories

Compiled Classes

Config Files

Library Files

Java Source

“Prep” Directory

JSP/HTML/Image

Page 20: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Automating the environment...

Page 21: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

An Ant Primer

» Build utility to manage compile/build tasks and dependencies

» Uses XML as the syntax (compare to make, etc).

» Core data model: project target task

» Targets define dependencies and contain tasks

» Tasks are the units of work...» Many built-in tasks (javac, jar, copy, etc.)» Easy to customize

Page 22: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

An Ant Primer

» File typically named “build.xml”» Ant will automatically process that file if no file

argument is provided

» Arguments can include specific targets» Project default target is used if no target is

provided. E.g.,» c:\projects\sample>ant» c:\projects\sample>ant compile» c:\projects\sample>ant -f alternate.xml compile

Page 23: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Example – A Simplified Build File

Init properties, files

Compile Java Files

Copy files to staging

Create .war file

Copy to install

Page 24: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Example – Build File

Page 25: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Example – Eclipse Integration

Page 26: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Making It Easier

» The Starting Block» Server Blackboard Building Block to Install,

Cycle, and Uninstall» An Ant task to invoke the Starting Block from

your build environment

Page 27: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Using the tools...

Page 28: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Test Driven Development

» Write objects that can be used independently of the container» Re-use» Testability

» Get used to writing methods (and tests) corresponding to user interface features

Page 29: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Example – JUnit Integration

Page 30: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Debugging

» A valuable and under-used technique» Avoid System.out.println() like the plague

» Limitations actually encourage better practices» If you’re used to stepping through code, and hate

the lack of JSP source correlation, you’ll build better business objects

» Caveat: environment is slightly different, notably, the security manager is not enabled by default

Page 31: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Debugging – How To

» Stop the Blackboard Tomcat instance» Open a command line, define the JPDA

environment variables» Execute the shell launcher that brings Tomcat

up in JPDA mode» Connect with debugger of choice

Page 32: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Debugging – How To (Windows)

c:\blackboard\apps\tomcat> net stop bb-tomcat

c:\blackboard\apps\tomcat> set JPDA_ADDRESS=2222

c:\blackboard\apps\tomcat> set JPDA_TRANSPORT=dt_socket

c:\blackboard\apps\tomcat> bin\blackboard-tomcat.bat jpda start

Page 33: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Debugging – How To (Unix)

/usr/local/blackboard/> ./tools/admin/ServiceController.sh services.appserver.stop

/usr/local/blackboard/> export JPDA_ADDRESS=2222

/usr/local/blackboard/> export JPDA_TRANSPORT=dt_socket

c:\blackboard\apps\tomcat> ./bin/blackboard-tomcat.sh jpda start

Page 34: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Debugging – Connecting

Page 35: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Debugging – Connected

Page 36: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Debugging – Connected

Page 37: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Conclusion

» Planning your build environment can help ease some of the headache of Blackboard Building Block development

» Use tools that help automate the process

Page 38: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Resources

» Ant: http://ant.apache.org/» Eclipse: http://www.eclipse.org/ » Java/JDK: http://java.sun.com/ » Blackboard Building Blocks:

http://buildingblocks.blackboard.com/

Page 39: © Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th

Questions