8 Sample Applications

This chapter describes the sample programs included with the Oracle Communications Billing and Revenue Management (BRM) SDK, how to use the sample code, and how to run the sample programs.

Caution:

These programs can change or delete data in your BRM database.

About Using the PCM C Sample Programs

BRM SDK includes a set of sample applications and templates using the Portal Communication Model (PCM) C application programming interface (API). You can use these sample programs and templates in the following ways:

  • Use the sample programs as code samples for extending BRM components and applications and for writing custom applications.

  • Run the corresponding executable application with a sample program to observe the changes it makes in BRM.

  • Use the templates, which provide the basic structure for the components, to create your custom components, such as Facilities Modules (FMs) and Data Managers (DMs).

These samples are supported on several platforms: Linux, AIX, Solaris, and HP-UX IA64. Compile these sample programs using the appropriate compiler for your platform.

Finding the PCM C Sample Programs

You can view the sample programs by clicking the links to the sample programs. When you install BRM SDK on UNIX, sample programs and templates are found in the following directories:

  • Most sample programs and the templates are installed in BRM_SDK_Home/source/samples by default.

  • Other sample programs can be found in BRM_SDK_Home/source/samples/apps/c.

  • Templates are located in BRM_SDK_Home/source/templates.

For information on installing BRM SDK on UNIX, see "Installing BRM SDK" in BRM Installation Guide.

Description of the PCM C Sample Programs

The sample programs demonstrate how to write code for various tasks when customizing BRM.

Each sample includes these supporting files:

  • Source files to view or modify for your own applications.

  • Makefiles to compile the sample programs on UNIX, if you make changes to the samples.

  • A compiled application that verifies that the sample programs work as expected and that allows you to observe the changes the programs make in BRM.

  • A pin.conf that allows you to specify the information required for the sample application to connect to BRM.

The following tables provide:

  • A list of the sample programs and templates.

  • A description of each sample program and template.

  • Information on any executable program that you can run to observe the results.

Table 8-1 lists a sample for setting makefile macros.

Table 8-1 Setting Makefile Macros (File Located in BRM_SDK_Home/source/samples)

Sample Description

env.unix

Shows you how the environment is set up, for example, the location of include directories. The makefiles reference the appropriate environment file for this information.

Instructions on setting the makefile macros are included in these text files.


Table 8-2 lists the sample flist files.

Table 8-2 Creating an Flist (Files Located in BRM_SDK_Home/source/samples/flists/C)

Sample Description

simple_flist.c

Shows how to create an flist with simple fields.

Run simple_flist.exe to see a printout of the flist created, which contains a POID and two strings containing the first and last names.

For information on how to run simple_flist, see "Running the Sample PCM C Programs".

flists_with_arrays.c

Shows how to create flists with arrays containing a single element and multiple elements.

Run flists_with_arrays.exe to see the flists created by this sample.

For information on how to run flists_with_arrays, see "Running the Sample PCM C Programs".

flists_with_substructs.c

Shows how to create an flist with a substructure.

Run flists_with_substructs.exe to see the flists created by this sample.

For information on how to run flists_with_substructs, see "Running the Sample PCM C Programs".


Table 8-3 lists a sample file for creating a context.

Table 8-3 Creating a Context (File Located in BRM_SDK_Home/source/samples/context/C)

Sample Description

create_context.c

Shows you how to open a context, connect to BRM, perform operations, close the context and test if the connection is open.

Run CreateContext.exe to see how to open a context.

For information on how to run create_context, see "Running the Sample PCM C Programs".


Table 8-4 lists a sample file for calling an opcode.

Table 8-4 Calling an Opcode (File Located in BRM_SDK_Home/source/samples/callopcode/C)

Sample Description

test_loopback.c

Shows you how to call an opcode.

This sample calls the PCM_OP_TEST_LOOPBACK opcode which just returns the flist that you pass in as the input.

Run test_loopback.exe to verify that the program returns input flist as the output.

For information on how to run test_loopback, see "Running the Sample PCM C Programs".


Table 8-5 lists the sample files for client application functions.

Table 8-5 Creating a Client Application (Files Located in BRM_SDK_Home/source/samples/apps/c)

Sample Description

sample_act.c

Shows how to generate activity for a service.

For more information about this program, see "Creating Events by Using the sample_act.c Program".

sample_app.c

Shows how to create a customer account with services.

For more information about this program, see "Creating Accounts by Using the sample_app.c Program".

sample_del.c

Shows how to remove accounts from BRM.

For more information about this program, see "Removing Accounts by Using the sample_del.c Program".

sample_search.c

Shows how to search for objects and fields.

For more information about this program, see "Searching by Using the sample_search.c Program".

sample_who.c

Shows how to display the current users.

For more information about this program, see "Displaying Current Users by Using the sample_who.c Program".


Table 8-6 lists the FM template files.

Table 8-6 Templates for Creating an FM

Sample Description

fm_generic_opcode.c

Provides structure for generic (FM) opcodes. See "Using the FM and DM Templates".

This file is in BRM_SDK_Home/templates/fm_template.

fm_generic_config.c

Shows you how to map from the opcode to the function. See "Using the FM and DM Templates".

This file is in BRM_SDK_Home/templates/fm_template.

op_define.h

Header file required by FM templates which defines PCM_OP_GENERIC.

This file is in BRM_SDK_Home/templates/fm_template.


Table 8-7 lists the template file for creating a DM.

Table 8-7 Template for Creating a DM

Sample Description

dm_generic.c

Shows the basic structure of a Data Manager. See "Using the FM and DM Templates".

This file is in BRM_SDK_Home/templates/dm_template.


Table 8-8 lists the sample files for using the multithreaded application (MTA) APIs.

Table 8-8 Files for Using the Multithreaded Application (MTA) API

Sample Description

pin_mta_monitor.c

(located in BRM_SDK_Home/bin)

Sample monitoring utility.

pin_mta_test.c

(located in BRM_SDK_Home/source/

samples/apps/c/mta_sample)

Sample test program using the MTA framework.


Compiling the Sample PCM C Programs

In addition to using the sample programs as a working programming example, you can also use them as a basis for your own applications. You can make changes to the sample programs, compile, and run them to test your changes. The sample programs directory includes the following files:

  • env.unix to set the environment

  • Makefiles for UNIX to compile the samples

To compile the sample programs on UNIX:

  1. Go to BRM_SDK_Home/source/samples and open env.nt or env.unix, depending on your operating system.

  2. Set up the path for the environment by following the instructions in the file.

  3. Save the file.

  4. Compile using the appropriate make utility:

    make
    

Running the Sample PCM C Programs

The executable versions of the sample programs are provided in addition to the source files. To see the output generated by a sample program, follow these basic steps:

  1. Go to the directory where the sample program is located. The default structure is: BRM_SDK_Home/source/samples or BRM_SDK_Home/source/samples/apps/c.

  2. Edit the entry in the configuration file pin.conf to point to the Connection Manager (CM).

  3. Run the program by running the executable file, for example:

    create_context.exe
    

Using the FM and DM Templates

In addition to the sample programs, the BRM SDK includes FM and DM templates that you can use as starting points for your own customized versions. You can make changes to the templates, compile them, and run them to test your changes. Makefiles and .dlls are provided for the templates in BRM_SDK_Home/source/templates/fm_template and BRM_SDK_Home/source/templates/dm_template.

The templates are provided in two forms:

  • C files that you can modify and compile according to the instructions in Compiling the Sample PCM C Programs.

  • DSP files that you can open as projects in Microsoft Visual Studio.

See "Testing New or Customized Policy FMs" and "Testing New or Customized DMs" in BRM Developer's Guide for information about testing the modified templates.

Creating Events by Using the sample_act.c Program

The sample_act.c program simulates customer activity by creating a session event for a service object. Use this program to generate any number of sessions to test new BRM functionality or custom opcodes.

For information on the structure and parameters, see the source file sample_act.c located in BRM_SDK_Home/source/samples/apps/c.

Syntax for sample_act.c

Run the program with appropriate parameters listed in Table 8-9 to specify the events you want to simulate. The options can be in any order.

Syntax for creating a typical IP telephony call

% sample_act [-c event_subtype] [-d duration_in_seconds] [-e session] 
[-l login] [-s service_type] [-f] [-v] [-A phone_num_origin] 
[-D phone_num_destination]

Syntax for creating a typical event

% sample_act [-c event_subtype] [-d duration_in_seconds] [-e session] 
[-l login] [-s service_type] [-f] [-v]

Table 8-9 sample_act.c Execution Parameters

Parameter Description Condition

-b

Start time

Required

-c

Event subtype

Required

-d

Duration in seconds

Required

-e

Event type

Required

-f

Flist debugging on

Optional

-g

Lineage

Optional

-h

Help - starts usage program

Optional

-i

Impact category

Optional

-l

Login

Required

-n

RUM name

Optional

-q

Rate quantity

Required

-r

Rate name

Optional

-s

Service type

Required

-t

Test mode on

Optional

-v

Verbose status on

Optional

-?

Help - starts usage program

Optional


This example generates an IP session event:

% sample_act -v -e session -l login -d 3600 -s /service/ip

Creating Accounts by Using the sample_app.c Program

The sample_app.c program creates a new account with services in the specified plan. You can modify this program to add new services to an account or to create dummy accounts to test BRM functionality.

This program performs the following actions:

  1. Opens a database channel

  2. Retrieves the specified plan

  3. Adds the customer information to the plan

  4. Creates the customer account

  5. Closes the database channel

For information on the structure and parameters, see the source file sample_app.c located in BRM_SDK_Home/source/samples/apps/c.

Syntax for sample_app.c

Run the program with appropriate options listed in Table 8-10, and plan name. The options can be in any order except that the name of the plan must be the last entry.

% sample_app  [-l login] [-p password] <plan>

Table 8-10 sample_act.c Account Creation Parameters

Parameter Description Condition

-l

Login

Required

-p

Password

Required

-d

Set error level

Optional

-h

Print standard error

Optional


The following example accepts the account logon and password for jsmith.

sample_app -l jsmith -p my_password email_plan

Removing Accounts by Using the sample_del.c Program

The sample_del.c program finds an account by searching for one of its service logins, and then deletes the account and all of its related objects.

Caution:

This program deletes accounts permanently. You cannot retrieve any accounts that you delete by running this program.

For information on the structure and parameters, see the source file, sample_del.c located in BRM_SDK_Home/source/samples/apps/c.

Syntax for sample_del.c

The sample_del.c program does not take any parameters.

% sample_del  /servicetype login
  

This example deletes the /service/ip account with the login smith:

% sample_del /service/ip smith

Searching by Using the sample_search.c Program

The sample_search.c program demonstrates the different types of searches in BRM.

  • Read-object search with single result expected

    Searches for the master account object and displays the results with PIN_FLIST_PRINT.

  • Read-fields search with multiple results expected

    Searches for the POID, merchant, and status of all nonbillable accounts in the database.

  • Step search

    Searches for services that require AES-encrypted passwords. The first 10 such services are retrieved in 2 blocks of 5 services each.

For information on the structure, see the source file sample_search.c located in BRM_SDK_Home/source/samples/apps/c.

Syntax for sample_search.c

The sample_search.c program does not take any parameters.

% sample_search

Displaying Current Users by Using the sample_who.c Program

The sample_who.c program finds all the active dialup sessions in the database, looks up the login for each user with an open session, and displays a list of all customers currently logged in to your Internet service.

For information on the structure, see the source file sample_who.c located in BRM_SDK_Home/source/samples/apps/c.

Syntax for sample_who.c

The sample_who.c program does not take any parameters.

% sample_who

Troubleshooting the sample_app.c Application

If you cannot run the sample_app application, use this information to identify any problems and resolve them.

Problem: Test Failed

sample# sample_app 
bad/no "userid" from pin.conf file
  
Test Failed, See Log File.

Solution

Edit the sample_app configuration file to include the correct userid entry and make sure the application is configured correctly.

Problem: Bad Port Number

sample# sample_app 
(11400): bad receive of login response, err 4 
(11400): login failed 4
  
Test Failed, See Log File
  
sample# cat default.pinlog 
E Fri Mar 15 14:56:44 1998  db2.corp <no name>:11393  pcm.c(1.41):90
         Connect open failed (4/100) in pcm_context_open 
E Fri Mar 15 14:58:39 1998  db2.corp  <no name>:11400  pcm.c(1.41):90
         Connect open failed (4/5) in pcm_context_open

Solution

Edit the cm_ptr entry in the sample_app configuration file with the valid CM port number.

Problem: Customer Account Creation Error

sample# sample_app
  
Test Failed, See Log File
  
E Fri Mar 15 15.10:37 1998  db2.corp  :11405  sample_app.c:167
         op_cust_create_acct error [location= class= errno= field num= recid=<0> reserved=<0>]

Solution

Load the BRM objects into the database.

About Using the PCM C++ Sample Programs

BRM SDK includes a set of sample applications using the PCM C++ API. You can use these sample programs in the following ways:

  • Use the sample programs as code samples for extending BRM components and applications and for writing custom applications.

  • Run the corresponding executable application with a sample program to observe the changes it makes in BRM.

These samples are supported on several platforms: Linux, AIX, Solaris, and HP-UX IA64. Compile these sample programs using the appropriate compiler for your platform.

Finding the Sample PCM C++ Programs

When you install BRM SDK on UNIX, the sample programs are installed by default in BRM_Home/InfranetSDK/source/samples.

For information on installing BRM SDK, see "Installing BRM SDK" in BRM Installation Guide.

You can also display the sample programs by clicking the links in this document.

Note:

The installation directory is called BRM_SDK_home in the documentation.

Description of the Sample PCM C++ Programs

The sample programs demonstrate how to write code for various tasks when customizing BRM.

Each sample includes these supporting files:

  • Source files to view or modify for your own applications

  • Makefiles to compile the sample programs on UNIX, if you make changes to the samples

  • A compiled application that verifies that the sample programs work as expected and that allows you to observe the changes the programs make in BRM

  • A configuration file pin.conf that allows you to specify the information required for the sample application to connect to BRM

The following tables provide:

  • A list of the sample programs

  • A description of each sample program

  • Information on any executable program that you can run to observe the results

Table 8-11 lists the file for setting makefile macros.

Table 8-11 Setting Makefile Macros (File Located in BRM_SDK_Home/source/samples)

Sample Description

env.unix

Shows you how the environment is set up, for example, the location of include directories. The makefiles reference the appropriate environment file for this information.

Instructions on setting the makefile macros are included in these text files.


Table 8-12 lists the sample files for creating an flist.

Table 8-12 Creating an Flist (Files Located in BRM_SDK_Home/source/samples/flists/C++)

Sample Description

simple_flist.cpp

Shows how to create an flist with simple fields.

Run simple_flist.exe to see a printout of the flist created, which contains a POID and two strings containing the first and last names.

For information on how to run simple_flist, see "Running the Sample PCM C Programs".

flists_with_arrays.cpp

Shows how to create flists with arrays containing a single element and multiple elements.

Run flists_with_arrays.exe to see the flists created by this sample.

For information on how to run flists_with_arrays, see "Running the Sample PCM C Programs".

flists_with_substruct.cpp

Shows how to create an flist with a substructure.

Run flists_with_substruct.exe to see the flists created by this sample.

For information on how to run flists_with_substruct, see "Running the Sample PCM C Programs".


Table 8-13 lists the sample file for creating a context.

Table 8-13 Creating a Context (File Located in BRM_SDK_Home/source/samples/context/C++)

Sample Description

create_context.cpp

Shows you how to open a context, connect to BRM, perform operations, test if the connection is open, and close the context.

Run create_context.exe to verify that the program returns input flist as the output.

For information on how to run create_context, see "Running the Sample PCM C Programs".


Table 8-14 lists the sample file for calling an opcode.

Table 8-14 Calling an opcode (File Located in BRM_SDK_Home/source/samples/callopcode/C++)

Sample Description

test_loopback.cpp

Shows you how to call an opcode.

This sample calls the PCM_OP_TEST_LOOPBACK opcode which just returns the flist that you pass in as the input.

Run test_loopback.exe to verify that the program returns input flist as the output.

For information on how to run test_loopback, see "Running the Sample PCM C Programs".


Table 8-15 lists the sample files for creating a client application.

Table 8-15 Creating a Client Application (Files Located in BRM_SDK_Home/source/samples/apps/C++)

Sample Description

sample_act.cpp

Shows how to generate activity for a service.

This sample generates email activity for an account.

Run sample_act.exe to see how the program works.

For information on how to run sample_act, see "Running the Sample PCM C Programs".

sample_PinBD.cpp

Shows how to use the class PinBigDecimal. This program illustrates how to create a big decimal number from a string or double, the use of various rounding modes and setting the number of decimal places, the use of mathematical functions, etc.

Run sample_PinBD.exe to see how the program works.

For information on how to run sample_PinBD, see "Running the Sample PCM C Programs".


Table 8-16 lists the sample files for using the multithreaded application (MTA) APIs.

Table 8-16 Files for Using the Multithreaded Application (MTA) API

Sample Description

pin_mta_monitor

(located in BRM_SDK_Home/bin)

Sample monitoring utility.

pin_mta_test.c

(located in BRM_SDK_Home/source/

samples/apps/c/mta_sample)

Sample test program using the MTA framework.


Compiling the Sample PCM C++ Programs

In addition to using the sample programs as working programming examples, you can also use them as a basis for your own applications. You can make changes to the sample programs, compile, and run them to test your changes. The sample programs directory includes the following files:

  • env.unix to set the environment

  • Makefiles for UNIX to compile the samples

To compile the sample programs:

  1. Go to BRM_SDK_Home/source/samples, and open env.unix.

  2. Set up the path for the environment by following the instructions in the file.

  3. Save the file.

  4. Compile using the make utility:

    make
    

Running the Sample PCM C++ Programs

The executable versions of the sample programs are provided. To see the output generated by a sample program, follow these basic steps:

  1. Go to the directory where the sample program is located. The default path is BRM_SDK_Home/source/samples.

  2. Edit the entry in the configuration file pin.conf to point to the CM.

  3. Run the program by running the executable, for example:

    create_context.exe
    

About Using the PCM Java Sample Programs

BRM SDK includes a set of sample applications using the PCM Java API. You can use these sample programs in the following ways:

  • Use the sample programs as code samples for extending BRM components and applications and for writing custom applications.

  • Run the corresponding executable application with a sample program to observe the changes it makes in BRM.

These samples are supported on several platforms: Linux, AIX, Solaris, and HP-UX IA64. Compile these sample programs using the appropriate compiler for your platform.

Finding the Sample PCM Java Programs

When you install BRM SDK, the sample programs are installed by default in BRM_Home/InfranetSDK/source/samples.

For information on installing BRM SDK, see "Installing BRM SDK" in BRM Installation Guide.

You can also display the sample programs by clicking the links in this document.

Note:

The installation directory is called BRM_SDK_home in the documentation.

Description of the Sample PCM Java Programs

The sample programs demonstrate how to write code for various tasks when customizing BRM.

Each sample includes these supporting files:

  • Source files to view or modify for your own applications

  • Makefiles to compile the sample programs, if you make changes to the samples

  • A compiled application that verifies that the sample programs work as expected and that allows you to observe the changes the programs make in BRM

  • A configuration file infranet.properties that allows you to specify the information required for the sample application to connect to BRM

The following tables provide:

  • A list of the sample programs and makefiles

  • A description of each sample program and makefile

  • Information on any executable program that you can run to observe the results

Table 8-17 lists the sample file for setting the makefile macros.

Table 8-17 Setting Makefile Macros (File Located in BRM_SDK_Home/source/samples)

Sample Description

env.unix

Shows you how the environment is set up, for example, the location of include directories. The makefiles reference the appropriate environment file for this information.

Instructions on setting the makefile macros are included in these text files.


Table 8-18 lists the sample files for creating an flist.

Table 8-18 Creating an Flist (Files Located in BRM_SDK_Home/source/samples/flists/Java)

Sample Description

SimpleFlist.java

Shows how to create an flist with simple fields.

Run SimpleFlist.class to see a printout of the flist created, which contains a POID and two strings containing the first and last names.

For information on how to run SimpleFlist, see "Running the Sample PCM C Programs".

FlistsWithArrays.java

Shows how to create flists with arrays containing a single element and with arrays containing multiple elements.

Run FlistsWithArrays.class to see the flists created by this sample.

For information on how to run FlistsWithArrays, see "Running the Sample PCM C Programs".

FlistsWithSubstructs.java

Shows how to create an flist with a substructure.

Run FlistsWithSubstructs.class to see the flists created by this sample.

For information on how to run FlistsWithSubstructs, see "Running the Sample PCM C Programs".


Table 8-19 lists the sample file for creating a context.

Table 8-19 Creating a Context (File Located in BRM_SDK_Home/source/samples/context/Java)

Sample Description

CreateContext.java

Shows you how to open a context, connect to BRM, perform operations, test if the connection is open, and close the context.

Run CreateContext.class to see how to open a context.

For information on how to run CreateContext, see "Running the Sample PCM C Programs".


Table 8-20 lists the sample file for calling an opcode.

Table 8-20 Calling an Opcode (File Located in BRM_SDK_Home/source/samples/callopcode/Java)

Sample Description

TestLoopback.java

Shows you how to call an opcode.

This sample calls the PCM_OP_TEST_LOOPBACK opcode which just returns the flist that you pass in as the input.

Run TestLoopback.class to verify that the program returns input flist as the output.

For information on how to run TestLoopback, see "Running the Sample PCM C Programs".


Table 8-21 lists the sample files for creating a client application.

Table 8-21 Creating a Client Application (Files Located in BRM_SDK_Home/source/samples/apps/Java)

Sample Description

CreateCustomUsageEvent.java

Shows you how to generate an email activity event for a particular account.

Run CreateCustomUsageEvent.class to see how the program works.

For more information on CreateCustomUsageEvent, see "Creating Events by Using the CreateCustomUsageEvent.java Program".

For information on how to run CreateCustomUsageEvent, see "Creating Events by Using the CreateCustomUsageEvent.java Program".

CreateCustomer.java

Shows you how to create a new customer through the user interface defined in CreateCustomerUI.java,using the account information definition from CreateCustomerAccountInfo.java and the model created by CreateCustomerModel.java.

Run CreateCustomer.class to see how to create a customer using these four programs. For more information on CreateCustomer, see "Creating Accounts by Using the CreateCustomer.java Program".

For information on how to run CreateCustomer, see "Running the Sample PCM C Programs".

CreateCustomerUI.java

Defines the user interface used by CreateCustomer.

CreateCustomerAccountInfo.java

Defines the account information and holds the data.

CreateCustomerModel.java

Shows you how to create new customers by creating flists to pass information to it, including customer name and address, pertinent plan, billing information, invoice data, etc. Then it adds the requested login and password to each service array element and creates the customer in the BRM database.

Of the four CreateCustomer programs, Create CustomerModel.java is where all the BRM actions take place in this program..


Compiling the Sample PCM Java Programs

In addition to using the sample programs as working programming examples, you can also use them as a basis for your own applications. You can make changes to the sample programs, compile, and run them to test your changes. The sample programs directory includes the following files:

  • env.unix to set the environment

  • Makefiles to compile the samples

To compile the sample programs:

Important:

To compile the sample programs, you must have a Java compiler installed on your system. For a list of compatible versions of the Java compiler, see "BRM Software Compatibility" in BRM Installation Guide.
  1. Go to BRM_SDK_Home/source/samples, and open env.unix.

  2. Set up the path for the environment by following the instructions in the file. Make sure the JDK_HOME variable includes the absolute path of your Java compiler.

  3. Save the file.

  4. Compile using the make utility:

    make
    

Running the Sample PCM Java Programs

The executable versions of the sample programs are provided. To see the output generated by a sample program, follow these basic steps:

  1. Go to the directory where the sample program is located. The default structure is: BRM_SDK_Home/source/samples.

  2. Edit the configuration file infranet.properties to point to the CM.

  3. Set the classpath to:

    java -classpath <path to jar files> <sample_name>
      
    

    For example:

    classpath/BRM_SDK_Home/jars/pcm.jar;/BRM_SDK_Home/jars/pcmext.jar;. SimpleFlist
      
    
  4. Run the program, for example:

    java create_context
    

Creating Accounts by Using the CreateCustomer.java Program

The CreateCustomer.java program creates a new account with services in the specified plan. You can modify this program to add new services to an account or to create dummy accounts to test BRM functionality.

This program performs the following actions:

  1. Opens a database channel

  2. Retrieves the specified plan

  3. Adds the customer information to the plan

  4. Creates the customer account

  5. Closes the database channel

For information on the structure and parameters, look at the source file CreateCustomer.java located in BRM_SDK_Home/source/samples/apps/Java.

Creating Events by Using the CreateCustomUsageEvent.java Program

The CreateCustomUsageEvent.java program simulates customer activity by creating an activity event for an email service object. Use this program to generate any number of email events.

For information on the structure, see the source file CreateCustomUsageEvent.java located in BRM_SDK_Home/source/samples/apps/Java.

Running the CreateCustomUsageEvent Program

  1. Create the storable class of type event/activity/email and these custom fields.

    EMAIL_EVENT_INFO   PIN_FLDT_SUBSTRUCT [0]   ID# 10001
    EMAIL_FROM    PIN_FLDT_STR [0]             10002
    EMAIL_TO      PIN_FLDT_STR [0]             10003
     
    

    For information, see "Creating, Editing, and Deleting Fields and Storable Classes" in BRM Developer's Guide.

  2. Follow the instructions in "Making Custom Fields Available to Your Applications" in BRM Developer's Guide to make the custom fields available to your applications.

  3. Restart the CM, the client tools, and other components.

  4. Run CreateCustomUsageEvent to generate email activity events:

    java CreateCustomUsageEvent
    

About Using the PCM Perl Sample Programs

BRM SDK includes a set of sample applications using the PCM Perl API. You can use these sample programs in the following ways:

  • Use the sample programs as code samples for extending BRM components and applications and for writing custom applications.

  • Run the corresponding executable application with a sample program to observe the changes it makes in BRM.

These samples are supported on several platforms: Linux, AIX, Solaris, and HP-UX IA64. Compile these sample programs using the appropriate compiler for your platform.

Finding the Sample PCM Perl Programs

When you install BRM SDK on UNIX, the sample programs are installed by default in BRM_Home/InfranetSDK/source/samples.

For information on installing BRM SDK, see "Installing BRM SDK" in BRM Installation Guide.

You can also display the sample programs by clicking the links in this document.

Note:

The installation directory is called BRM_SDK_home in the documentation.

Description of the Sample PCM Perl Programs

The sample programs demonstrate how to write code for various tasks when customizing BRM.

Each sample includes these supporting files:

  • Source files to view or modify for your own applications

  • A compiled application that you can run to verify that the sample programs work as expected and to observe the changes the program makes in BRM

  • A configuration file pin.conf where you specify the configuration information for the sample application to connect to BRM

The following tables provide:

  • A list of the sample programs

  • A description of each sample program

  • Information on any executable program that you can run to observe the results

Table 8-22 lists the sample files for creating an flist.

Table 8-22 Creating an Flist (Files Located in BRM_SDK_Home/source/samples/flists/perl)

Sample Description

simple_flist.pl

Shows how to create an flist with simple fields.

Run simple_flist.pl to see a printout of the flist created, which contains a POID and two strings containing the first and last names.

flist_with_arrays.pl

Shows how to create flists with arrays containing a single element.

Run flist_with_arrays.pl to see the flist created by this sample.

flist_with_substruct.pl

Shows how to create an flist with a substructure.

Run flist_with_substruct.pl to see the flist created by this sample.


Table 8-23 lists the sample files for creating a context.

Table 8-23 Creating a Context (Files Located in BRM_SDK_Home/source/samples/context/perl)

Sample Description

connect.pl

Shows you how to open a context, connect to BRM using pin.conf parameters, perform operations, test if the connection is open, and close the context.

Run contect.pl to verify that the program returns input flist as the output.

For information on how to run connect.pl, see "Running the Sample PCM C Programs".

create_context.pl

Shows you how to open a context, connect to BRM using logon information within the program, perform operations, test if the connection is open, and close the context.

Run create_context.pl to demonstrate how to open a context.

For information on how to run create_context.pl, see "Running the Sample PCM C Programs".


Table 8-24 lists the sample file for calling an opcode.

Table 8-24 Calling an Opcode (File Located in BRM_SDK_Home/source/samples/callopcode/perl)

Sample Description

test_loopback.pl

Shows you how to call an opcode.

This sample calls the PCM_OP_TEST_LOOPBACK opcode which just returns the flist that you pass in as the input.

Run test_loopback.pl to verify that the program returns input flist as the output.

For information on how to run test_loopback.pl, see "Running the Sample PCM C Programs".


Running the Sample PCM Perl Programs

The executable versions of the sample programs are provided. To see the output generated by a sample program, follow these basic steps:

  1. Go to the directory where the sample program is located. The default structure is: BRM_Home/InfranetSDK/source/samples.

  2. Edit the entry in the configuration file pin.conf to point to the CM.

  3. Run the program by executing the program name under Perl, for example:

    perl create_context.pl
    

    Note:

    Use the Perl installed by the SDK (or with the BRM server), located in BRM_Home/perl/bin/perl. This version of Perl is preconfigured for BRM.