Skip navigation.
Downloads | Product Documentation | Support

Creating Templates Using the Domain Template Builder

# How Do I . . . ?

This section provides information and examples for some common template creation tasks:

- How Do I: Create a Custom Domain Template?
- How Do I: Create a Custom Extension Template?

# How Do I: Create a Custom Domain Template?

The following example explains how to create a custom domain template using the Avitek Medical Records Sample Domain. A domain template defines the full set of resources within a domain, including infrastructure components, applications, services, security options, and general environment and operating system parameters. Once you have created this sample domain, you can then use this template as input to the Configuration Wizard to create a new Medical Records sample domain.

Note: This example is based on the assumption that you installed the WebLogic Server samples during your product installation. For information about installing the samples, see the Installation Guide at the following URL:

`http://e-docs.bea.com/common/docs91/install/index.html`

1. Start the Domain Template Builder.

- On Windows:

Start—>Programs—>BEA Products—>Tools—>Domain Template Builder

- On UNIX:

Go to the `/common/bin` subdirectory of the product installation directory. For example: `cd $BEAHOME/weblogic91/common/bin`

Enter `sh config_builder.sh`

2. In the Create a New Template window, select Create a Domain Template and click Next.
3. In the Select a Template Domain Source window, do the following:

1. Click the Select a Domain tab if it is not already selected.
2. Go to the following directory:

`WL_HOME``\samples\domains`

In this pathname, `WL_HOME` represents the directory in which you installed your WebLogic software, typically `C:\bea\weblogic91`.

3. Select the medrec domain.
4. Click Next.

4. In the Describe the Template window, enter a descriptive name for your template. If the template you are creating will be used as the source for a new template, the information you provide in this window will be displayed in the Select a Template area of the Select a Template Domain Source window.

For this example, enter the following information and click Next.

Name: `Avitek Medical Records Sample Domain`

Author: `BEA Systems, Inc`

Category: `BEA`

Description: `Create the Avitek Medical Records domain in a directory outside of the installed kit. The Avitek Medical Records is a WebLogic Server sample application suite that concisely demonstrates all aspects of the J2EE platform.`

5. In the Add or Omit Applications window, you have the option to omit applications from the template and, if applicable, change the relative path of the directory into which applications are imported. By default, all the applications contained in the domain are selected, indicating that they will be added to the template.

Since the applications in this domain were included with your WebLogic software, you cannot change the relative path of the directory into which they are imported. Because these applications already reside on your system, they are not copied into the template.

For this example, leave all applications selected and click Next.

6. In the Add Files window, you can add or remove files from the template. By default, the following files and directories are included in your template:

- All files in the root directory with the following extensions: `.cmd`, `.sh`, `.xml`, `.properties`, and `.ini`.
- `bin` directory
- `lib` directory
- All files in the `security` directory that are not created automatically during domain creation. For example, `XACMLAuthenticatorInit.ldift` and `XACMLRoleMapperInit.ldift` are not included by default.
- All files and subdirectories in the `config` directory that are not included automatically by the Template Builder during template creation. For example, `config.xml` and any JDBC and JMS resources defined in `config.xml` are not displayed in the Current Template View pane by default because the Template Builder includes them in the template, automatically, during template creation.

Note: Because the applications to be included in this template are provided with your product installation, they will not be copied into the template. Therefore, they are not listed under Applications Root Directory in the Current Template View pane.

If other files exist on your system that are needed by deployed applications, you can add them using this window.

For this example, we need to add a patient data file that is not included by default. To add the required file, do the following:

1. In the File System View pane, select the following directory:

medrec\incoming

2. In the Current Template View pane, select Domain Root Directory.
3. Click Add File.

The directory is added under the Domain Root Directory.

4. Click Next to proceed to the Add SQL Scripts window.

7. In the Add SQL Scripts window, you have the option to add SQL scripts for each database that you expect to use with the domains created from this template.

Because the Medical Records sample uses the default PointBase demo database included with your product installation, you do not need to add SQL scripts in this example.

However, you may want to use the Medical Records sample with other databases, such as Oracle or MySQL. To do so, you need to add the appropriate database scripts, as follows:

1. In the Database Type and Version pane, select `Oracle` from the Type drop-down list, and `Any` from the Version drop-down list.
2. Click Add SQL File.
3. In the Add SQL File(s) dialog box, navigate to the following directory:

`WL_HOME``\samples\server\medrec\setup\db`

In this pathname, `WL_HOME` represents the directory in which you installed WebLogic Server, typically `C:\bea\weblogic91`.

4. From the Type drop-down list, select All Files.
5. Shift-click to select the following two files:

`medrec_oracle.dll`

`medrec_oracle_data.sql`

6. Click Add SQL File(s).

The names of the files that you added are displayed in the Selected SQL Files list and the Selected Database Scripts pane.

To add database files for MySQL, complete the following procedure.

1. In the Database Type and Version pane, select `MySQL` from the Type drop-down list, and `Any` from the Version drop-down list.
2. Click Add SQL File.
3. In the Add SQL File(s) dialog box, navigate to the following directory:

`WL_HOME``\samples\server\medrec\setup\db`

4. From the Type drop-down list, select All Files.
5. Shift-click to select the following two files:

`medrec_mysql.dll`

`medrec_mysql_data.sql`

6. Click Add SQL File(s).

The names of the files that you added are displayed in the Selected SQL Files list and the Selected Database Scripts pane.

Click Next.

8. In the Configure the Administration Server window, define the configuration information for the Administration Server, including:

- Administration Server name
- Listen address
- Nonsecure and secure (optional) listen ports

Servers can be reached through the following URL: `protocol``://``listen-address``:``listen-port`

For more information, see Configure the Administration Server.

To configure the Administration Server in this example, leave the default values selected and Click Next.

9. In the Configure Administrator Username and Password window, you can specify a valid username and password to be used to boot the Administration Server and connect to it.

By default, the username/password combination for the Medical Records domain is `weblogic/weblogic`. You also have the option to configure additional users, groups, and global roles.

For this example, accept the defaults defined and click Next.

10. In the Specify Start Menu Entries window, you can create entries for the Windows start menu. For this example, you create entries to start and stop the Medical Records server.

To create the Start Menu entry to use to start the Medical Records server:

1. Click Add.
2. In the Shortcut link name field, enter `Start Medical Records Server`.
3. From the Program field drop-down list, select `bin/startWebLogic.cmd`. It is not necessary to complete the remaining fields for this example.

To create the Start Menu entry to use to stop the Medical Records server:

1. Click Add.
2. In the Shortcut link name field, enter `Stop Medical Records Server`.
3. From the Program field drop-down list, select `bin/stopWebLogic.cmd`. It is not necessary to complete the remaining fields for this example.
4. Click Next.

11. In the Prepare Scripts and Files with Replacement Variables window, you can replace hard-coded strings with replacement variables in files that have not been updated by the Domain Template Builder. The Domain Template Builder automatically updates any standard scripts included in a template, such as start scripts, by replacing hard-coded values for various domain environment settings with replacement variables. The Configuration Wizard can later replace these variables with new hard-coded values during the configuration of a new domain.

In this example, it is not necessary to edit any additional scripts or files. Click Next to proceed to the Review WebLogic Domain Template window.

12. In the Review WebLogic Domain Template window, review the details for your domain template before you create it. If you need to make changes to any configuration information that you specified previously, click Previous to return to the desired configuration window.

Click Next to proceed to the Create a Template window.

13. In the Create a Template window, you enter a name for the template and specify a location for the template directory.

For this example, enter `my_medrec_template` in the Template jar name field.

By default, the template is created in `BEA_HOME``\user_templates`, where `BEA_HOME` is the directory that contains the product installation. You do not need to change the default in this example.

Click Create.

14. In the Creating Template window, status messages are displayed during the template creation process. Click Done to close the Domain Template Builder.

# How Do I: Create a Custom Extension Template?

The following example shows how to create a custom extension template by modifying the Avitek Medical Records Sample Domain extension template provided with your product installation. An extension template defines applications and services that can be used to extend an existing domain. The process used to create an extension template is virtually the same as the process used to create a domain template except that you are not prompted to configure the Administration Server, assign an Administrator username and password, or specify Start menu entries because these domain settings are already defined in the domain to be extended.

In this example, you create a customized MedRec extension template in which you will add support for an additional Medical Records user. Once you have created the sample extension template, you can extend an existing WebLogic domain with the Medical Records sample domain functionality by specifying your new extension template as input to the Configuration Wizard.

To create a customized MedRec extension template, complete the following procedure:

1. Start the Domain Template Builder.

- On Windows:

Start—>Programs—>BEA Products—>Tools—>Domain Template Builder

- On UNIX:

Go to the `/common/bin` subdirectory of the product installation directory. For example: `cd $BEAHOME/weblogic91/common/bin`

Enter `sh config_builder.sh`

2. In the Create a New Template window, select Create an Extension Template and click Next.
3. In the Select a Template Domain Source window, select an existing extension template or a domain from which to create a new extension template. In this example, you will create an extension template using the Avitek Medical Records extension template provided with your product installation. To do so:

1. Click the Select a Template tab if it is not already selected.

A list of the predefined extension templates provided with your product installation is displayed in the Templates pane under the heading `BEA`.

2. Select the Avitek Medical Records Sample Domain extension template from the list.
3. Click Next.

4. In the Describe the Template window, enter a descriptive name for your extension template. Because you are using an existing template as the source for your custom template, the information from the Avitek Medical Records Sample Domain extension template is displayed here.

For this example, you do not need to modify the description.

Click Next to proceed to the Add or Omit Applications window.

5. In the Add or Omit Applications window, you have the option to omit applications from the extension template and change the relative path of the directory into which applications are imported. By default, all the applications included in the source are selected, indicating that they will be added to your custom template.

For this example, you do not need to add or omit any applications.

Click Next.

6. In the Add Files window, you can add or remove files from the extension template. Because you selected an existing template as the source for your custom template, all files from the source template are also included, automatically.

In this example, the Avitek Medical Records Sample Domain extension template includes a separately defined applications directory. Therefore the applications contained in the template are listed under Applications Root Directory in the Current Template View pane.

Click Next to proceed to the Add SQL Scripts window.

7. In the Add SQL Scripts window, you have the option to add SQL scripts for each database that you expect to use with the domains created from this template. Database scripts for PointBase, Oracle, and MySQL are included in the template by default.

For this example, you do not need to add any database scripts.

Click Next.

8. In the Security Configurations Options window, you have the option to customize any security settings that are already defined in either your domain or the extension template serving as the source for your extension template.

Because you are going to define an additional user in this example, select Yes and click Next.

9. In the Configure Users, Groups, and Global Roles window, you are prompted to define users, groups, and roles for authentication purposes. The users, groups, and roles defined in the template are listed. You can select the Users, Groups, and Roles tabs to view the current definitions.

In this example, you are going to define a new physician and assign the physician to an existing group. To do so:

1. Make sure the Users tab is selected.
2. Click Add.
3. Enter the following values:

User Name: `joe@md.com`

User Password: `weblogic`

Description: `MedRec Physician`

By default, the new user is assigned to the `Administrators` group. In the next window you clear this assignment and assign `joe@md.com` to the `MedRec Physicians` group.

4. Click Next.

10. In the Assign Users to Groups window, you are prompted to assign users to groups. BEA recommends adding users to groups because by managing groups you can manage multiple users simultaneously.

In this example, you need to remove `joe@md.com` from the `Administrators` group and assign him to the group `MedRecPhysicians`. To do so:

1. In the Group pane, make sure the `Administrators` group is selected.

A list of current assignments for the `Administrators` group is displayed in the left pane.

2. In the left pane, clear the check box for `joe@md.com`.
3. In the Group pane, select the group `MedRecPhysicians`.

A list of current assignments for the `MedRec Physicians` group is displayed in the left pane.

4. In the left pane, select the check box for `joe@md.com`. The list of groups associated with `joe@md.com` is updated to reflect the change.
5. Click Next.

11. In the Assign Groups to Groups window, you can designate one group as a member of another group. In this example you do not need to change the default assignments.

Click Next.

12. In the Assign Users and Groups to Global Roles window, you can assign users and groups to the global security roles defined by WebLogic Server. In this example you do not need to change the default assignments.

Click Next.

13. In the Prepare Scripts and Files with Replacement Variables window, you can replace hard-coded strings with replacement variables in files that have not been updated by the Domain Template Builder. The Domain Template Builder automatically updates any standard scripts included in a template, such as start scripts, by replacing hard-coded values for various domain environment settings with replacement variables. The Configuration Wizard can later replace these variables with new hard-coded values during the configuration of a new domain.

In this example, it is not necessary to edit any additional scripts or files. Click Next to proceed to the Review WebLogic Domain Template window.

14. In the Review WebLogic Domain Template window, review the details for your extension template before you create it. If you need to modify any of the information that you defined previously, click Previous to return to the desired configuration window.

Click Next.

15. In the Create an Extension Template window, enter a name for the extension template and specify a location for the template directory.

For this example, enter `my_medrec_ext_template` in the Template jar name field.

By default, the template is created in `BEA_HOME``\user_templates`, where `BEA_HOME` is the directory that contains the product installation. You do not need to change the default in this example.

Click Create.

16. In the Creating Template window, status messages are displayed during the template creation process. Click Done.