JBoss-IDE 1.2.2 Tutorial 2

zhaozj2021-02-16  49

JBoss-IDE 1.2.2 Tutorial 2:

The code of the full FIBOBEAN CLASS is as follows: package tutorial.ejb;

Import java.rmi.remoteexception;

Import javax.ejb.createException;

Import javax.ejb.ejbexception;

Import javax.ejb.sessionbean;

Import javax.ejb.sessionContext;

/ **

* @Author John Doe

*

* @ ejb.bean name = "fibo"

* Display-name = "FIBO EJB"

* Description = "EJB That Computes Fibonacci Suite"

* View-type = "remote"

* JNDI-NAME = "EJB / TUTORALIAL / FIBO"

* /

Public Class Fibobean Implements SessionBean {

Public fibobean () {

Super ();

}

/ **

* DEFAULT CREATE METHOD

* @Throws CreateException

* @ ejb.create-method

* /

Public void ejbcreate () throws createException {

}

Public void ejbactivate () throws ejbexception, remoteexception {

}

Public void ejbpassivate () THROWS EJBEXCEPTION, RemoteException {

}

Public void ejbremove () THROWS EJBEXCEPTION, RemoteException {

}

Public void setsessionContext (sessioncontext arg0)

Throws ejbexception, remoteException {

}

/ **

* @Param Number

* @Return

*

* @ ejb.interface-method view-type = "remote"

* /

Public Double [] compute (int number) {

IF (Number <0) {

Throw New EjBexception ("argument shouth be posacy");

}

Double [] suite = new double [number 1];

Suite [0] = 0;

IF (Number == 0) {

Return suite;

}

Suite

[1]

= 1;

For (int i = 2; i <= number; i ) {

Suite [i] = suite [i - 1] suite [i - 2];

}

Return suite;

}

}

Generate an EJB-related file:

To generate an EJB-related archive and configuration file file, first set some xDoclet settings. You can define themselves in JBoss-IDE.

Right-click the item to select 'Properties' -> 'XDoclet Configurations', click on the window on the left window to select 'add', enter 'ejb' and press 'OK', so that a new XDoclet 'EJB' is successfully added.

Then select 'EJB', pick the 'add doclet' -> 'ejbdoclet' on the left side of the window, then press' OK '. Set the selected' destDir 'in the' EJBDoclet 'setting of the left hand on the left hand.' SRC ', Select' EJBSPEC 'Fill in' 2.0 '. Now xDoclet' EJBDoclet 'settings will generate EJB 2.0 files in the' src 'data clip. Then in' ejbdoclet 'right picks' add' -> 'fileset', Press 'OK'. Set the 'DIR' in the 'FileSet' setting of the window of the left hand to fill in 'SRC', discard 'Excludes', select 'Includes' Fill in '** / * bean.java' Now the xdoclet 'ejbdoclet' setting will have the 'fileset' in the 'src''s folder only select EJB Java file.

Before the remodget, we added 'deploymentDescriptor'. Select 'Destdir', fill in 'src / meta-inf'. Now we have added a generated deployment configuration document in 'src / meta-inf' data clip. in.

The action before remating, plus 'JBoss'. Select 'Destdir', fill in 'src / meta-inf', select 'version' to fill in '3.0'. Now we have added a deployment configuration document that generates JBoss 3.0. In the 'SRC / META-INF' data clip.

The action before removal, plus 'packagesubstitution'. Select 'package' to fill in 'EJB', select 'Interfaces'. Now we have added a new document package related to generating EJB (EJB will be in Tutorial. EJB, Interfaces will be generated in tutorial.interfaces.

The action before removal, plus 'RemoteInterface' and 'HomeInterface'. Don't choose any settings. This setting generates the HOME and Remote Interfaces of EJB.

Press 'OK' to save the generated setting. JBoss-IDE automatically adds a 'xDoclet-build.xml' Ant document in the project.

The generated settings within this document have been run.

Finally, at 'Package Explorer' right-click the project, select 'Run XDoclet', and the output of the console will see the figure below:

After successful generation, the project should have more 'tutorial.interfaces' packages and more 'meta-inf' deployment configuration folders.

转载请注明原文地址:https://www.9cbs.com/read-21980.html

New Post(0)