Main -> Documentation -> The OBI Interface -> Modifying the Display of Records in the OBI -> Creating a New Formatting Class

Creating a New Formatting Class

Introduction

This topic describes how to create a new formatting class by copying an existing formatting class, and how to use the new class to display records in the OBI. This topic also describes how to create a class package for your custom formatting classes, and how to configure the WebZ system to use your package.


When Should You Create a New Formatting Class?

It is recommended that you create a new formatting class in the following cases:

  • If you wish to modify an existing formatting class, especially a formatting class that was installed with your WebZ system. You can modify the new class without affecting the existing class and the databases that use it.
     
  • If you want to learn more about formatting classes by experimenting with a "test" class. Modifcations made to the test class do not affect the existing classes.
     
  • If you wish to design a wholly new formatting class from the ground up. You should copy an existing class that most closely performs like the one you wish to design.
     


Before You Begin

  • The tasks contained in in this topic involve editing Java source code files and compiling Java classes. This topic assumes that you have a basic understanding of the Java language and know how to complie Java class files.
     
  • Verify that your CLASSPATH environment variable is set correctly, otherwise the Java source code files will not compile and you will have to manually specify executable paths to the Java compiler in order to compile your Java source files.
     

Creating a New Formatting Class, MarcArticleBriefTest.class

In the following example, you will create a new formatting class, called MarcArticleBriefTest.class, from an existing formatting class, MarcArticleBriefFmt.class. You will modify the Date field label in the new class, configure the ABI/Inform database to use the new class, and view the results in the OBI.


Creating the MarcArticleBriefTest Class

1. Copy the MarcArticleBriefFmt.java source file to a new file, MarcArticleBriefTest.java. The MarcArticleBriefFmt.java file is located in the <WebZ_root>/classes/ORG/oclc/fmts/obi directory. Create the new file in this same directory: Do not copy it to another directory.

2. In the new MarcArticleBriefTest.java file, replace all occurences of "MarcArticleBriefFmt" with "MarcArticleBriefTest".

3. Locate the following line of code in the new MarcArticleBriefTest.java file:

protected final static String yearLabel = "Date: ";

and change it to the following:

protected final static String yearLabel = "Publication Date: ";

4. Save and close the file.

5. Compile the MarcArticleBriefTest.java file into a Java class file.


Configuring the ABI/Inform Database to Use the MarcArticleBriefTest Formatting Class

Edit the configuration of the ABI/Inform database so that it uses the MarcArticleBriefTest formatting class to format brief records. The ABII.ini configuration file is located in the <WebZ_root>/ini/dbs directory. Make a backup copy of the file before modifying it.

In the [Formats] section of the ABII.ini configuration file, change the brief format setting to the following:

brief = ORG.oclc.fmts.obi.MarcArticleBriefTest

After making the change, save and close the file.


Viewing the Results in the OBI

1. Stop and restart the WebZ system in order to read in the configuration changes you made to the ABI/Inform database.

2. Access the WebZ system via a browser and select the ABI/Inform database from the Database Selection screen.

3. Perform a search against the database. In the search results screen, notice that "Publication Date" is now the label for the Date field. This indicates that the MarcArticleBriefTest formatting class successfully formatted the records for display.


[Main][Documentation][Support][Technical Reference][Community][Glossary][Search]

Last Modified: