6.3. newbean

6.3.1. Synopsis

newbean

Generates skeletons for all the necessary files for making a bean.

6.3.2. Description

The newbean tool helps the bean writer start developing a bean by generating skeletons for all the necessary files for making a bean. Note that this tool creates only templates of the files. These templates must then be customized and the business logic written. However, the files should be compilable.

To create these templates, type newbean and enter a set of parameters in interactive mode.

newbean generates a build.xml file.

The Bean Name must start with a capital letter. Avoid the reserved names: Home, EJB, Session, Entity. This name will be used as a prefix for all filenames relative to the bean.

The Bean Type must be one of the following:

The Session Type must be one of the following:

The Persistence manager must be one of the following:

The Bean Location must be one of the following:

The Package name is a dot-separated string representing the package to which the bean belongs. Usually this is the same as the current directory.

The Jar name argument is the name that will be used to build the .jar file. Do not provide the .jar extension with this argument. Typically, the last part of the package name is used.

The Primary Key class is the class that represents the primary key. It is required only for Entity Beans. Its possible values are:

6.3.3. Example

newbean
Bean Name
> MyFirstBean


Bean type
  S   Session bean
  E   Entity bean
  MD  Message-Driven bean
> E

Persistance manager
  B  Bean
  C  Container (CMP 1.x)
  C2  Container (CMP 2.x)
> C

Bean location
  R  Remote
  L  Local
> R

Package name
> truc.machin

Jar name
> machin

Primary Key class
  S  String
  I  Integer
  O  Object
> S

Creating bean MyFirstBean (type ECR) in package truc.machin
Your bean files have been created. You can now customize them.

6.3.4. Example 2

 
 
-bash-2.05b$ /usr/share/jonas/bin/unix/newbean
Bean Name
> MySecondBean
  
 
Bean type
  S   Session bean
  E   Entity bean
  MD  Message-Driven bean
> S
 
Session type
  L  Staless
  F  Stateful
> F
 
Bean location
  R  Remote
  L  Local
> L
 
Package name
> com.redhat.rhdb.cc.jonas
 
Jar name
> rhaps-cc-jonas
 
Creating bean MySecondBean (type SFL) in package com.redhat.rhdb.cc.jonas
Your bean files have been created. You can now customize them.