![]() ![]() ![]() ![]() ![]() ![]() |
WARNING: | This document is deprecated as of version 10.0 of WebLogic Server. This deprecation warning applies only to this documentation, and not to the underlying functionality it describes nor to the open-source Beehive project. Users who wish to develop and deploy Beehive applications should do so using Workshop for WebLogic, which offers support for all aspects of Beehive technology. Current documentation for integrating Beehive and WebLogic Server can be found at Workshop for WebLogic Platform User's Guide. |
The following sections provide information on how to build Beehive applications:
WebLogic Server ships with the following Ant files for building and deploying Beehive applications:
<WEBLOGIC_HOME>
\beehive\weblogic-beehive\ant\weblogic-beehive-buildmodules.xml
<WEBLOGIC_HOME>
\beehive\weblogic-beehive\ant\weblogic-beehive-tools.xml
<WEBLOGIC_HOME>
\beehive\weblogic-beehive\ant\weblogic-beehive-imports.xml
weblogic-beehive-buildmodules.xml
contains build macros (<macrodef>
elements) for building a web app module and other module-leve artifacts. Use this file for easiest building.
weblogic-beehive-tools.xml
contains build macros for building other Beehive-related source artifacts, including XMLBean schemas and the three Beehive components: Java Controls, NetUI Page Flow and Web Services. Use this file instead of weblogic-beehive-buildmodules.xml
if you need more flexible control over project structure.
weblogic-beehive-imports.xml
is a utility file that defines paths to build resource JARs required by weblogic-beehive-tools.xml.
To use these build resources, import these three files into your Ant build file:
<import file="${beehive.home}/weblogic-beehive/ant/weblogic-beehive-imports.xml"/>
<import file="${beehive.home}/weblogic-beehive/ant/weblogic-beehive-tools.xml"/>
<import file="${beehive.home}/weblogic-beehive/ant/weblogic-beehive-buildmodules.xml"/>
Then call the build macros to build your Beehive application. For example, the following Ant target calls the build-webapp
macro (<macrodef name=
"build-webapp
"/>
) located in weblogic-beehive-buildmodules.xml
.
<build-webapp
webapp.src.dir="${src.dir}/myWebApp"
webapp.build.dir="${dest.dir}/myWebApp"
app.build.classpath="myWebApp.build.classpath"/>
</target>
A template Ant build file is provided in Template Build File. The Beehive Tutorial puts this template Ant build file into practice.
Note that the template build file assumes that your Beehive application contains the following library reference in myBeehiveApp\META-INF\weblogic-application.xml
:
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
<library-ref>
<library-name>weblogic-beehive-1.0</library-name>
</library-ref>
</weblogic-application>
If your Beehive application contains a web module, the template build file assumes the following library references in myBeehiveApp\myWebApp\WEB-INF\weblogic.xml
:
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
<library-ref>
<library-name>beehive-netui-1.0</library-name>
</library-ref>
<library-ref>
<library-name>struts-1.2</library-name>
</library-ref>
<library-ref>
<library-name>jstl-1.1</library-name>
</library-ref>
</weblogic-web-app>
On disk, these referenced libraries reside in the EAR and WAR files at <WEBLOGIC_HOME>
\common\deployable-libraries
. Note that the Ant task <libclasspath>
is used to unpack the referenced EAR and WAR files. See
Using the libclasspath Ant Task in Developing Applications with WebLogic Server.
Note: | These libraries allow you to use the Beehive JARs without copying them into your application or putting them on the systm CLASSPATH. For an overview and detailed information about shared libraries, see the WebLogic Server document Creating Shared Java EE Libraries and Optional Packages |
The following Ant macros describe the most important Ant tasks included in the build resource files.
Builds and assembles a web application module. This Ant task will compile any page flows and Java Controls inside the web application.
This task takes the following parameters:
Control source Java files are assumed to be under [webAppDir]\WEB-INF\src
.
Page flow source Java files are assumed to be under [webAppDir]
.
Builds a distributable control JAR from a directory of Java control source files.
The task takes the following parameters:
Because of a known bug, you may encounter this error message when using the build-control-m
odule task:
<drive>:\bea\wlserver_10.0\beehive\weblogic-beehive\ant\weblogic-beehive-buildmodules.xml:140: taskdef class org.apache.beehive.controls.runtime.packaging.ControlJarTask cannot be found
To correct this, you must modify your Ant build file.
After the line in the file where weblogic-beehive-imports.xml
and weblogic-beehive-tools.xml
are imported, and before the line where weblogic-beehive-buildmodules.xml
is imported, insert the following line:
<property name="controls.jars.prop" refid="controls.dependency.path"/>
That section of your Ant build file should then look like this:
<import file="${beehive.home}/weblogic-beehive/ant/weblogic-beehive-imports.xml"/>
<import file="${beehive.home}/weblogic-beehive/ant/weblogic-beehive-tools.xml"/>
<property name="controls.jars.prop" refid="controls.dependency.path"/>
<import file="${beehive.home}/weblogic-beehive/ant/weblogic-beehive-buildmodules.xml"/>
Builds an EJB JAR from one or more EJB controls.
The task takes the following parameters:
Note: | As was mentioned above, you should only use this file if you want the added flexibility it provides. Otherwise, use weblogic-beehive-buildmodules.xml . |
Assemble the controls found in a directory. Assembly is required as part of the process of compiling web service, JMS, and EJB controls. For details on the control build process, see Building JMS and EJB Controls.
The task takes the following parameters:
|
Generates a Java type library from a WSDL file. The types are packaged as a JAR file. If the WSDL contains complex Java types, it is necessary to run this target as part of the process of generating a service control from the WSDL. For details on generating a service control from a WSDL, see Building Web Service Controls.
The task takes the following parameters:
Generates a web service client from a WSDL file.
The task takes the following parameters:
Generates a web service control from a WSDL file.
The task takes the following parameters:
As a starting point for building Beehive applications, use the build template file provided in Template Build File. For each component in your Beehive application, add build elements to the template build file.
For each web application (any component containing page flows and Java Controls) call <build-webapp>
.
Web services should be compiled using the <jwsc>
(weblogic.wsee.tools.anttasks.JwscTask
) target.
To build applications that contain the system controls, see Building Web Service Controls and Building JMS and EJB Controls.
For a detailed example of building a page flow web application, see Create a New Page Flow Web Application.
The following instructions explain how to create a web service control, integrate it into a Beehive application, and compile the resulting application. The instructions assume that you have access to the target web service’s WSDL file.
<build-type-library>
(defined in weblogic-beehive-tools.xml
) if there are any complex Java types passed by the target web service.
This will generate a type library JAR file, which should be saved in the application’s APP-INF\lib
directory.
<build-type-library
wsdl="${src.dir}/services/MyService.wsdl"
wsdlname="MyService.wsdl"
wsdlservicename="MyService"
tempdir="c:/temp/services"
destdir="${dest.dir}/APP-INF/lib"
typefamily="tylar"
/>
Calling <build-type-library>
is only necessary if the web service contains complex Java types; if the web service contains only standard Java types, this step can be skipped.
<generate-webservice-control>
(defined in weblogic-beehive-tools.xml
). This will generate a Java source file for the web service control.
If the web service does not contain complex types, then the typefamily attribute should have the value no_complex_types.
<generate-webservice-control
wsdl="${src.dir}/services/MyService.wsdl"
wsdlservicename="MyService"
servicecontrolname="MyServiceControl"
destdir="${dest.dir}/services"
appdir="${src.dir}"
package="pkg"
typefamily="no_complex_types"
classpathref="app.classpath"/>
The Java source file that is created should not be modified, except for the addition of security annotations. For details on the available security annotations, see Control Security.
<taskdef name="apt"
classname="org.apache.beehive.controls.runtime.generator.AptTask"
classpathref="apt.task.classpath"
onerror="fail"/>
<apt srcdir="${src.dir}"
destdir="${build.dir}/module"
gendir="${build.dir}/aptgen"
classpathref="classpath"
srcExtensions="*.jws"
/>
gendir
attribute in the preceding step.<taskdef name="jwsc"
classpath="${weblogic.home}/server/lib/weblogic.jar"
classname="weblogic.wsee.tools.anttasks.JwscTask"
onerror="report" />
<jwsc srcdir="${build.dir}/aptgen"
destdir="${ent.app.dir}"
classpathref="classpath"
debug="on" keepGenerated="true">
<jws file="hellotest/HelloTest.java"/>
</jwsc>
<assemble-controls>
task. Calling <assemble-controls> creates Java source code (and modifies some deployment descriptors), which needs to be compiled in turn.
The following Ant targets illustrate how to implement steps
4 and
6 in a Java EE application context. Inside a Java EE application, the assemblerclass
attribute should have the value org.apache.beehive.controls.runtime.assembly.EJBAssemblyContext$Factory
. Inside of a web application context, assemblerclass
should have the value org.apache.beehive.controls.runtime.assembly.WebAppAssemblyContext$Factory
.
<!-- Assemble the controls to a tmp dir, then compile the assembly output -->
<assemble-controls
moduledir="${dest.dir}/myApp"
destdir="${assembly.build.tmp.dir}"
classpathref="myWeb.assembly.classpath" assemblerclass="org.apache.beehive.controls.runtime.assembly.EJBAssemblyContext$Factory"
/>
<javac srcdir="${assembly.build.tmp.dir}"
destdir="${dest.dir}/myWeb/WEB-INF/classes"
classpath="customerLoanWeb.assembly.classpath"
/>
The process for generating JMS and EJB controls is identical to steps 4- 6 in Building Web Service Controls: you must run assembly on the control and then compile the results of the assembly.
For a detailed example of a build script that creates a web service application that uses a service control, see Build Script Sample - Create Web Service That Uses a Service Control,.
Use the following Ant build file as a template to build and deploy your Beehive applications.
Note that this template file uses the task <wlcompile>
, which ensures that split source compilation and deployment will succeed. <wlcompile>
also automatically searches for and compiles all Java files in your application. Be aware that <wlcompile>
will fail if it encounters any Beehive-specific classes in your application. For this reason, you should exclude your Beehive projects from the <wlcompile>
search. For example:
<wlcompile srcdir="${src.dir}" destdir="${dest.dir}" excludes="myBeehiveProj1,myBeehiveProj2"
/>
<?xml version="1.0" encoding="UTF-8" ?>
<project default="build" basedir=".">
<property environment="env"/>
<!-- provide overrides -->
<property file="build.properties"/>
<property name="src.dir" value="${basedir}"/>
<property name="dest.dir" value="${basedir}/../build"/>
<property name="dist.dir" value="${basedir}/../dist"/>
<property name="app.name" value="beehive_tutorial"/>
<property name="ear.path" value="${dist.dir}/${app.name}.ear"/>
<property name="tmp.dir" value="${java.io.tmpdir}"/>
<property name="weblogic.home" value="${env.WL_HOME}"/>
<property name="user" value="weblogic"/>
<property name="password" value="weblogic"/>
<fail unless="weblogic.home" message="WL_HOME not set in environment"/>
<property name="beehive.home" value="${weblogic.home}/beehive"/>
<!-- beehive-imports defines dependency paths that are required by beehive-tools.xml -->
<import file="${beehive.home}/weblogic-beehive/ant/weblogic-beehive-imports.xml"/>
<!-- defines macros for build-schemas, build-controls, build-pageflows -->
<import file="${beehive.home}/weblogic-beehive/ant/weblogic-beehive-tools.xml"/>
<!-- defines macros for build-webapp -->
<import file="${beehive.home}/weblogic-beehive/ant/weblogic-beehive-buildmodules.xml"/>
<taskdef name="libclasspath" classname="weblogic.ant.taskdefs.build.LibClasspathTask"/>
<target name="init.app.libs">
<!-- Builds classpath for library modules referenced in weblogic-applications.xml. -->
<libclasspath basedir="${src.dir}" tmpdir="c:/tmp/wls_lib_dir" property="app.lib.classpath">
<librarydir dir="${weblogic.home}/common/deployable-libraries/" />
</libclasspath>
<echo message="app.lib.claspath is ${app.lib.classpath}" level="info"/>
</target>
<target name="init.dirs">
<mkdir dir="${dest.dir}/APP-INF/classes"/>
<mkdir dir="${dest.dir}/APP-INF/lib"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="init" depends="init.app.libs,init.dirs">
<path id="app.classpath">
<pathelement location="${src.dir}/APP-INF/classes"/>
<pathelement location="${dest.dir}/APP-INF/classes"/>
<pathelement path="${app.lib.classpath}"/>
<fileset dir="${src.dir}/APP-INF/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${dest.dir}/APP-INF/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${beehive.home}/apache-beehive-svn-snapshot
/lib/netui">
<include name="**/*.jar"/>
<exclude name="**/beehive-netui-compiler.jar"/>
</fileset>
</path>
<wlcompile srcdir="${src.dir}" destdir="${dest.dir}"/>
</target>
<target name="build" depends="compile,appc"/>
<target name="compile" depends="init"/>
<target name="clean" depends="init.dirs,clean.dest,clean.dist"/>
<target name="clean.dest">
<echo message="deleting dest.dir:${dest.dir}"/>
<delete includeemptydirs="true" >
<fileset dir="${dest.dir}" excludes=".beabuild.txt" includes="**/*" />
</delete>
</target>
<target name="clean.dist">
<echo message="deleting dest.dir:${dest.dir}"/>
<delete includeemptydirs="true" >
<fileset dir="${dist.dir}" includes="**/*" />
</delete>
</target>
<target name="appc" depends="init" >
<wlappc source="${dest.dir}" librarydir="${weblogic.home}/common/deployable-libraries/"/>
</target>
<target name="pkg.exploded">
<antcall target="clean.dist"></antcall>
<wlpackage toDir="${dist.dir}" srcdir="${src.dir}" destdir="${dest.dir}" />
</target>
<target name="deploy.exploded" >
<wldeploy user="${user}" password="${password}" action="deploy" name="${app.name}" source="${dist.dir}"/>
</target>
<target name="deploy" >
<wldeploy user="${user}" password="${password}" action="deploy" name="${app.name}" source="${dest.dir}"/>
</target>
<target name="redeploy">
<wldeploy user="${user}" password="${password}" action="redeploy" name="${app.name}"/>
</target>
</project>
![]() ![]() ![]() |