Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

About the rom.def file

The rom.def file contains metadata defining the specific ROM elements, their properties, their slots, and their methods. You can find rom.def in:

$INSTALL_DIR\eclipse\plugins
   \org.eclipse.birt.report.model_<version>.jar

The rom.def file is an internal file that the design engine uses to present a property sheet for a ROM element. The property sheet for an element contains the element’s properties and their types, the element’s methods, and valid choice selections for each of the element’s properties.

The rom.def file specifies the following kinds of metadata:

  • Choice

    A choice definition specifies all the allowable values that an attribute can have. Most choice definitions relate to style attributes. The following example from rom.def defines all the allowable font families available to a fontFamily style specification.

    <ChoiceType name="fontFamily">
       <Choice displayNameID="Choices.fontFamily.serif"
          name="serif" />
       <Choice displayNameID="Choices.fontFamily.sans-serif"
          name="sans-serif" />
       <Choice displayNameID="Choices.fontFamily.cursive"
          name="cursive" />
       <Choice displayNameID="Choices.fontFamily.fantasy"
          name="fantasy" />
       <Choice displayNameID="Choices.fontFamily.monospace"
          name="monospace" />
    </ChoiceType>
  • Class

    A class definition defines a Java class that a report designer application can access using the BIRT model API. There are class descriptions for data types, such as String, Date, and Array. There are also class descriptions for the functional classes such as Total, Finance, and DateTimeSpan. Finally, there are class definitions for the report object definitions, such as Report, DataSet, DataSource, ReportDefn, and ColumnDefn. A class definition consists of definitions of the class attributes, methods, and localization identifiers. The following example from rom.def defines the Report class.

    <Class displayNameID="Class.Report" name="Report"
       toolTipID="Class.Report.toolTip">
       <Member dataType="ReportDefn"
          displayNameID="Class.Report.design" name="design"
          toolTipID="Class.Report.design.toolTip" />
       <Member dataType="Object[]"
          displayNameID="Class.Report.params" name="params"
          toolTipID="Class.Report.params.toolTip" />
       <Member dataType="Object[]"
          displayNameID="Class.Report.config" name="config"
          toolTipID="Class.Report.config.toolTip" />
    </Class>

    The preceding class definition does not have methods. The following example illustrates a class method definition.

    <Method displayNameID="Class.Total.sum" isStatic="true"
       name="sum" returnType="number"
       toolTipID="Class.Total.sum.toolTip">
       <Argument name="expr" tagID="Class.Total.sum.expr"
          type="number" />
       <Argument name="filter" tagID="Class.Total.sum.filter"
          type="String" />
       <Argument name="group" tagID="Class.Total.sum.group"
          type="String" />
    </Method>
  • Element

    An element definition consists of the element’s name, display name, methods, and properties, as well as the element from which it inherits. The rom.def file contains an element definition for every ROM element. The following example from the rom.def file illustrates an element definition.

    <Element canExtend="true"
       displayNameID="Element.OdaDataSource"
       extends="DataSource"
       isAbstract="false" isNameRequired="true"
       javaClass="org.eclipse.birt.report.model.elements
          .OdaDataSource" name="OdaDataSource" since="1.0"
       xmlName="oda-data-source">
       <Property
          displayNameID="Element.OdaDataSource.extensionID"
          isIntrinsic="true" name="extensionID" since="1.0"
          type="string" />
       <Property detailType="ExtendedProperty"
          displayNameID=
          "Element.OdaDataSource.privateDriverProperties"
          isList="true" name="privateDriverProperties"
          since="1.0"
          type="structure" />
       <PropertyVisibility name="extensionID"
          visibility="hide" />
       <PropertyVisibility name="privateDriverProperties"
          visibility="hide" />
    </Element>

    The preceding element definition does not contain any methods. The following example illustrates an element method definition.

    <Method context="factory"
       displayNameID="Element.ScriptDataSource.open"
       name="open" since="1.0"
       toolTipID="Element.ScriptDataSource.open.toolTip">
       <Argument name="reportContext"
          tagID="Element.ScriptDataSet.open.reportContext"
          type="org.eclipse.birt.report.engine.api.script
             .IReportContext" />
       <Argument name="object"
          tagID="Element.ScriptDataSet.open.object"
          type="Object" />
    </Method>
  • Structure

    A structure is a complex data type that usually consists of two or more members. A few structures that are candidates for future expansion have only a single member. The following example from the rom.def file illustrates the definition of a structure.

    <Structure displayNameID="Structure.DateTimeFormatValue"
       name="DateTimeFormatValue" since="1.0">
       <Member detailType="dateTimeFormat"
          displayNameID="Structure.DateTimeFormatValue.category"
          isIntrinsic="true" name="category" since="1.0"
          type="choice" />
       <Member
           displayNameID="Structure.DateTimeFormatValue.pattern"
           isIntrinsic="true" name="pattern" since="1.0"
           type="string" />
    </Structure>
  • Style

    A style definition contains the least information of any type of metadata described in rom.def. A style definition defines the name of the style, its display name, and a reference value. The following example illustrates a style definition.

    <Style displayNameID="Style.Report" name="report"
       reference="Overall default" />
  • Validator

    A validator definition specifies a Java class with which to do validation. Two of the validator classes are for validating values and all the rest are semantic validators. The following example from rom.def shows how to specify a validator.

    <SemanticValidator
       class="org.eclipse.birt.report.model.api.validators
          .DataSetResultSetValidator"
       modules="design, library"
       name="DataSetResultSetValidator" />
  • + Share This
  • 🔖 Save To Your Account