| Page Status Please feel free to contribute to this tutorial by clicking the Edit->Edit this page link |
|
The starting point to creating WebCT PowerLinks is to establish your development environment. This tutorial outlines a basic solution and the use of the NetBeans IDE. |
Tutorial Contents |
Background
A PowerLink is merely a jar file containing at least:
- a DeployableComponentConfig.xml file;
- a class file which extends the AuthenticationModule class from the com.webct.platform.sdk.security.authentication.module package.
The jar file may also contain other files, such as:
- a licence file
- velocity templates for generating output pages
- other class files containing supporting code
SDK
The SDK can be downloaded from Behind Blackboard. It contains the main SDK jar file in a directory named bin and third party dependencies in a directory named lib. Both of these directories should be included in the classpath when compiling your jar file.
Alternative solutions
Given their simplicity a text editor is sufficient for preparing the code for a PowerLink. However, an IDE (integrated development environment) provides more functionality and support to the authoring process. For example, the IDE will assist with features such as code completion. Two of the most commonly used IDEs are Eclipse and NetBeans.
Basic environment
Since the simplest PowerLink consists only of a jar file containing a DeployableComponentConfig.xml file and a single class file, there is no significant need for a complex development environment; it is perfectly possible to use a text editor for creating the files and Apache ant to compile the source file(s) and generate the jar file. Below is an example ant build.xml file for processing a PowerLink which is based on the following assumptions:
- the PowerLink is named xxx
- the following directory structure:
- src (for the Java source files)
- build/classes (for the Java class files)
- build/jar (for the final jar file)
- the SDK files are in a directory named ../sdk_client
- any other dependent jar files are located in a directory named ../common
The main targets in the ant file are:
- clean - delete any existing build files
- compile - compile the Java source files
- build - generate the jar file
- deploy - copy the deploy file to a local WebCT installation
- reload - reload the deployable components on the WebCT server (see reloadDCs documentation page for further information)
- clean-build - perform a clean build
If you do not have a local WebCT installation to use for the deploy target then omit this and the reload targets from the file and execute these tasks manually.
<project name="xxx" basedir="." default="build"> <property name="src.dir" value="src" /> <property name="build.dir" value="build" /> <property name="classes.dir" value="${build.dir}/classes" /> <property name="jar.dir" value="${build.dir}/jar" /> <property name="lib.dir" value="../sdk_client/lib" /> <property name="bin.dir" value="../sdk_client/bin" /> <property name="common.dir" value="../common" /> <property name="license.file" value="license.txt" /> <property name="domain.dir" value="/path/to/WebCTDomain" /> <property name="reload.exe" value="/path/to/reloadDCs.exe" /> <path id="classpath"> <fileset dir="${lib.dir}" includes="**/*.jar"/> <fileset dir="${bin.dir}" includes="**/*.jar"/> <fileset dir="${common.dir}" includes="**/*.jar"/> </path> <target name="clean"> <delete dir="${build.dir}" /> </target> <target name="compile"> <mkdir dir="${classes.dir}" /> <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" deprecation="on" /> </target> <target name="build" depends="compile"> <mkdir dir="${jar.dir}" /> <jar destfile="${jar.dir}/${ant.project.name}.jar"> <fileset file="DeployableComponentConfig.xml" /> <fileset file="${license.file}" /> <fileset dir="${classes.dir}/" /> </jar> </target> <target name="deploy" depends="build"> <copy file="${jar.dir}/${ant.project.name}.jar" tofile="${domain.dir}/deployablecomponents/${ant.project.name}/${ant.project.name}.jar" /> </target> <target name="reload" depends="deploy"> <exec executable="${reload.exe}"> <arg value="-h:http://www.webct.domain/" /> <arg value="-p:serveradmin.password" /> </exec> </target> <target name="clean-build" depends="clean,build" /> </project>
NetBeans IDE
You can use NetBeans to prepare a PowerLink as follows:
- create a Library containing each of the jar files in the bin and lib directories of the WebCT SDK (see Tools, Libraries option)
- create a new project using the Java Class Library template
- add the WebCT SDK Library to the project (edit the properties of the project)
- edit the class file to be an extension of the WebCT AuthenticationModule class
- write the class
- include any other source files in the src directory
- place the DeployableComponentConfig.xml file in the src directory
- use the Build option to generate the jar file
You may also edit the build.xml file to add the deploy and reload targets as in the example build file above.
Comments (1)
02 Dec 2009
Gary Snow says:
Thanks so much for updating this page!Thanks so much for updating this page!