5 How Do I?

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

How Do I Create a Custom Domain Template?

The following example explains how to use the Avitek Medical Records Sample Domain to create a custom domain template. 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 Medical Records sample domain.

Note:

This example is based on the assumption that you have installed the WebLogic Server samples while installing the product.
  1. Start the Domain Template Builder.

    • On Windows, from the Start menu, choose Start > Programs > Oracle WebLogic > WebLogic Server > Tools > Domain Template Builder.

    • On UNIX:

      • Go to the WebLogic Server /common/bin subdirectory:

        cd MW_HOME/wlserver_10.3/common/bin

      • Enter the following command:

        sh config_builder.sh

  2. On the Create a New Template screen, select Create a Domain Template, and click Next.

  3. On the Select a Template Domain Source screen:

    1. Select the Select a Domain tab.

    2. Navigate to the following directory:

      MW_HOME\wlserver_10.3\samples\domains

      where MW_HOME is the Middleware home directory (the default is C:\Oracle\Middleware\).

    3. Select the medrec domain.

    4. Click Next.

  4. On the Describe the Template screen, fill in each field and click Next.

    For this example, enter the following information.

    • Name—Avitek Medical Records Sample Domain

    • Version—10.3.3 (or accept the displayed default)

    • Author—Oracle Corporation

    • Category—Oracle

    • 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 Java EE platform.

    Note:

    If the template you are creating is to be used as the source for a new template, the information you provide in this window is displayed in the Select a Template section of the Select a Template Domain Source screen.
  5. On the Enter the name and location of the domain template screen, enter the following information or accept the defaults:

    • Template jar name—Enter the name you want to use for the template's JAR file, or accept the displayed default, which is based on the name you entered on the previous screen.

    • Template location—Accept the default (MW_HOME\user_templates) or enter another directory location.

  6. On the Add or Omit Applications screen, you can omit applications from the template and, if applicable, change the relative path of the directory into which applications are imported. By default, all applications in the domain are selected, indicating that they will be added to the template.

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

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

  7. On the Add Files screen, you can add or remove files from the template. By default, the following files and directories are included in the 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, DefaultRoleMapperInit.ldift and XACMLRoleMapperInit.ldift are not included by default.

    • All files and subdirectories in the config directory that are not included automatically by the Domain 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 Domain Template Builder automatically includes them in the template during template creation.

      Note:

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

    If there are other files on your system that are required for deployed applications, you can add them in this window.

    The medrec template does not contain any additional files to add. Click Next to continue.

  8. On the Add SQL Scripts screen, you can add SQL scripts for each database that you expect to use with the domains created from this template.

    The Medical Records sample uses the default Derby demo database included with your product installation; so you do not need to add SQL scripts in this example.

    Click Next to continue.

  9. On the Configure the Administration Server screen, define the configuration information for the Administration Server. For more information, see Configure the Administration Server.

    In this example, leave the default values selected and click Next.

  10. On the Configure Administrator Username and Password screen, you can specify the username and password that is used to start and connect to the Administration Server.

    By default, the username/password combination for the Medical Records domain is weblogic/welcome1. You can configure additional users, groups, and global roles.

    For this example, accept the default settings, and click Next.

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

    To create a Start menu entry for starting the Medical Records server:

    1. Click Add.

    2. In the Shortcut link name field, enter Start Medical Records Server.

    3. From the Program drop-down list, select bin/startWebLogic.cmd (Windows) or select bin\startWebLogic.sh (UNIX).

      It is not necessary to complete the remaining fields for this example.

    To create a Start menu entry for stopping the Medical Records server:

    1. Click Add.

    2. In the Shortcut link name field, enter Stop Medical Records Server.

    3. From the Program drop-down list, select bin/stopWebLogic.cmd (Windows) or select bin\stopWebLogic.sh (UNIX).

      It is not necessary to complete the remaining fields for this example.

    Click Next.

  12. In the Prepare Scripts and Files with Replacement Variables screen, 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.

  13. On the Review WebLogic Domain Template screen, review the settings for the new domain template before it is created. If you need to make changes to any configuration information that you specified previously, click Previous to return to the required configuration window.

    Click Create.

  14. On the Creating Template screen, 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 WebLogic Server. An extension template defines applications and services that extend an existing domain. The process for creating an extension template is similar to the process for creating a domain template, except that you do not 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 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 by selecting your new extension template in the Configuration Wizard.

To create a customized MedRec extension template:

  1. Start the Domain Template Builder.

    • On Windows, from the Start menu, choose Start > Programs > Oracle WebLogic > WebLogic Server > Tools > Domain Template Builder.

    • On UNIX:

      • Go to the WebLogic Server /common/bin subdirectory:

        cd MW_HOME/wlserver_10.3/common/bin

      • Enter the following command:

        sh config_builder.sh

  2. On the Create a New Template screen, select Create a Domain Template, and click Next.

  3. On the Select a Template Domain Source screen, select an existing extension template or a domain from which to create an extension template. In this example, you create an extension template using the Avitek Medical Records extension template included in the product installation.

    1. Click the Select a Template tab.

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

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

    3. Click Next.

  4. You are using an existing template as the source for the new template; so information from the Avitek Medical Records Sample Domain extension template is displayed automatically in the Describe the Template screen.

    For this example, you do not need to change anything.

    Click Next.

  5. On the Enter the name and location of the domain template screen, enter the following information or accept the defaults:

    • Template jar name—Enter the name you want to use for the template's JAR file, or accept the displayed default, which is based on the name you entered on the previous screen.

    • Template location—Accept the default (MW_HOME\user_templates) or enter another directory location.

  6. On the Add or Omit Applications screen, you can 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.

  7. On the Add Files screen, you can add or remove files from the extension template. You selected an existing template as the source for your custom template; so 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 in the template are listed under Applications Root Directory in the Current Template View pane.

    Click Next.

  8. On the Add SQL Scripts screen, you can add SQL scripts for each database that you expect to use with the domains created from this template.

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

    Click Next.

  9. On the Security Configurations Options screen, you can customize any security settings that are defined in either your domain or the extension template that serves as the source for the new extension template.

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

  10. On the Configure Users, Groups, and Global Roles screen, you can 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, or Roles tab to view the current definitions.

    In this example, you will define a new physician and assign the physician to an existing group.

    1. Select the Users tab.

    2. Click Add.

    3. Enter the following values:

      User Name: joe@md.com

      User Password: welcome1

      Description: MedRec Physician

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

    4. Click Next.

  11. On the Assign Users to Groups screen, you can assign users to groups. Oracle recommends that you add 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 to the MedRecPhysicians group.

    1. In the Group pane, ensure that 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, deselect the check box for joe@md.com.

    3. In the Group pane, select MedRecPhysicians.

      A list of current assignments for the MedRecPhysicians 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.

  12. On the Assign Groups to Groups screen, 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.

  13. On the Assign Users and Groups to Global Roles screen, 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.

  14. On the Prepare Scripts and Files with Replacement Variables screen, 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.

  15. On the Review WebLogic Domain Template screen, review the settings for the new extension template before it is created. If you need to modify any of the information that you previously defined, click Previous to return to the required configuration window.

    Click Create.

  16. On the Creating Template screen, status messages are displayed during the template creation process.

    Click Done.