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 sectons provide an introduction to Beehive applications:
Beehive is an open source J2EE programming framework designed to make the most difficult J2EE programming tasks easier.
Where the traditional J2EE programmer would use complex APIs and configuration files, the Beehive programmer uses “metadata annotations,” also known simply as “annotations.” Annotations dramatically simplify the J2EE code and allow non-experts to create J2EE applications. Annotations stand in for common, boilerplate coding tasks. Instead of learning the complex J2EE API, developers can set properties on their code using metadata annotations.
Annotations are a new feature in Java, added in the J2SE 5.0 version of the language. For background information about annotations, please see http://java.sun.com/j2se/1.5.0/index.jsp and http://jcp.org/en/jsr/detail?id=175.
Beehive ships with three main components:
A web application framework built on Apache Struts. Page Flows centralize application logic and state in Java “controller” classes. An integrated set of JSP tags is provided, as well as integration with JavaServer Faces and with raw Struts applications.
A lightweight component framework that helps programmers encapsulate application logic and leverage metadata annotations into their programming model. Developers can create custom controls or use the pre-built system controls. The Beehive system controls provide access to these common J2EE components: database, EJB, JMS, and web services.
An implementation of JSR 181, an annotation-driven programming model for web services. For more information about the JSR 181 specification, please see http://www.jcp.org/en/jsr/detail?id=181.
The diagram below shows a typical Beehive application. The application has three basic components:
Beehive is a project of the Apache Software Foundation. The version of Beehive that is installed on your computer during the installation of WebLogic Server does not necessarily correspond to the version currently documented on the Apache website. To see the full, current Apache Beehive documentation, refer to http://beehive.apache.org.
A copy of the Beehive documentation from the Apache site is installed on your computer when WebLogic Server is installed. This documentation corresponds to the version of Beehive on your computer. To read this documentation, navigate to
<WEBLOGIC_HOME>
\beehive\apache-beehive-svn-snapshot\docs\docs
and double-click on the file index.html
in that folder.
Note: | The version of Beehive shipped with WebLogic Server 9.2 does not include the web service metadata sub-project. Consequently, the web service metadata documentation has not been included and hyperlinks to the removed documentation content are broken. |
WebLogic Server contains three interconnected Beehive samples. These samples demonstrate how to build progressively more complex applications based on a simple web service. The simple web service, called creditRatingApp, at the core of these samples takes a nine-digit Social Security number and responds with a credit rating. The remaining two samples are more complex client applications of this basic web service.
These three samples, named creditRatingApp, bankLoanApp, and customerLoanApp, are described in creditRatingApp, bankLoanApp, and customerLoanApp, respectively.
The samples documented here are located on your system in
<WEBLOGIC_HOME>
\beehive\weblogic-beehive\samples.
This sample is a stateless web service (built using JSR 181 web service annotations) that takes a nine-digit Social Security number and responds with a credit worthiness rating. The following two samples are clients of this web service.
This sample is an application that evaluates a loan seeking customer. Given the customer’s Social Security number, the application will (1) return an interest rate appropriate for that customer’s credit rating and (2) decide whether or not a customer should be given a loan of a specified amount.
The application consists of a conversational (stateful) web service consisting of a start and a finish method. The start method takes a Social Security number and returns an interest rate based on the customer’s credit rating. The start method acquires the customer’s credit rating by calling the creditRatingApp web service described in creditRatingApp. The credit rating is then passed to a local EJB, which calculates the appropriate interest rate.
The finish method determines whether the customer may borrow a specified amount. This method takes a float value and returns a boolean value. This method also checks a database to see if the customer has borrowed money in the past.
Because this application relies on a database connection, to run this application, you must first create the necessary database. Details on creating the necessary database are described in step 3 in Running the bankLoanApp Application.
The Java source for this web service is located at
bankLoanApp\src\services\pkg\bankLoanConversation.java.
This sample is a web application interface on the bankLoanApp sample described in bankLoanApp. It provides JSPs from which users can make requests of and view responses from the bankLoanApp.
To run the samples, you must first create a Beehive-enabled server domain, then you must build and deploy the three samples in the following order: creditRatingApp, bankLoanApp, customerLoanApp.
To create a Beehive-enabled server domain, follow these steps:
Click Next on each page of the wizard without changing any of the default values, except for the following changes:
On the second page (labeled Select Domain Source), place a check in the checkbox next to “Apache Beehive.”
On the third page (labeled Configure Administrator Username and Password), in the User password field, enter weblogic
.
<BEA_HOME>
\user_projects\domains\base_domain\startWebLogic.cmd
<BEA_HOME>
/user_projects/domains/base_domain/startWebLogic.sh
<BEA_HOME>
\user_projects\domains\base_domain\bin\setDomainEnv.cmd
<BEA_HOME>
/user_projects/domains/base_domain/bin/setDomainEnv.sh
To build and deploy the creditRatingApp:
bankLoanApp\src
.ant clean build pkg.exploded deploy.exploded
http://localhost:7001/bankLoanWeb
and click the link Create the Table. After the table has been created, click Return to index.To build and deploy the customerLoanApp:
customerLoanApp\src
.ant clean build pkg.exploded deploy.exploded
http://localhost:7001/customerLoanWeb
.
If you have Beehive applications that ran under WebLogic Server 9.0, you will have to make certain changes to them so that they will run under WebLogic Server 9.2. This section discusses those changes.
In the case of WebLogic Server 9.2, Beehive samples, ANT scripts, documentation, library JAR files, and other support files are installed on your system under the directory
<WEBLOGIC_HOME>\beehive\apache-beehive-svn-snapshot
This directory had a different name in 9.0 installations, usually
<WEBLOGIC_HOME>\beehive\apache-beehive-incubating-1.0m1
Check all your Ant scripts for references to this directory path and update any references to the old path.
The project model for Beehive samples shipped with WebLogic Server 9.0, the source-in model, had this form:
module-name/
WEB-INF/
src/
The Beehive samples shipped with WebLogic Server 9.2 are structured according to a different project model, the source-out model. They have this form:
module-name/
web/
WEB-INF/
src/
If you have a Beehive application that was based on one of the source-in samples, you should still be able to use your current build script, except for possible changes in path names.
However, if you change such an application to conform to the newer source-out model, you may encounter problems when running the Ant macros defined in the import files in
<WEBLOGIC_HOME>\beehive\weblogic-beehive\ant\
To avoid these problems, it will be necessary to copy some of the files in your application to new directories. This should be done as part of your build.xml
build script. For guidance in writing the copy instructions appropriately, please see the build script in Beehive Tutorial, in particular, step
6 under the section titled Create a New Page Flow Web Application.
If you have Beehive applications that ran under WebLogic Server 9.1, you will have to make certain changes to them so that they will run under WebLogic Server 9.2. This section discusses those changes.
In the case of WebLogic Server 9.2, Beehive samples, ANT scripts, documentation, library JAR files, and other support files are installed on your system under the directory
<WEBLOGIC_HOME>\beehive\apache-beehive-svn-snapshot
This directory had a different name in 9.1 installations, usually
<WEBLOGIC_HOME>\apache-beehive-1.0-final
Check all your Ant scripts for references to this directory path and update any references to the old path.
The Ant macros defined in the import files in
<WEBLOGIC_HOME>\beehive\weblogic-beehive\ant\
make certain assumptions about the structure of your application. See Application Project Model for an explanation of the two application models involved.
If your application conforms to the source-out model, it will be necessary to copy some of the files in your application to new directories. This should be done as part of your build.xml
build script. For guidance in writing the copy instructions appropriately, please see the build script in Beehive Tutorial, in particular, step
6 under the section titled Create a New Page Flow Web Application.