Using domains with custom data sources

Please note: the following description is related to SQL data sources only. If you want to use a different data source type further changes are required. To enable a custom data source for usage in a domain you can effect the following changes to the applicationContext-semanticLayer.xml. You will also need to shut off the cache or implement a cache key generator if required.

Add the bean data source to the list of data sources. Add this entry:

<entry key="com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.BeanReportDataSource"
       value-ref="baseJdbcMetaDataFactory" />

to the metaDataFactoryFactory configuration:

<bean name="metaDataFactoryFactory"
class="com.jaspersoft.commons.semantic.metaapi.impl.MetaDataFactoryFactoryImpl">
  <property name="implementationObjectFactory" ref="mappingResourceFactory"/>
  <property name="dataSourceTypeMapping">
    <map>
      <entry key="com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JdbcReportDataSource"
      value-ref="baseJdbcMetaDataFactory"/>
      <entry key="com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JndiJdbcReportDataSource"
      value-ref="baseJdbcMetaDataFactory"/>
      <entry key="com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.VirtualReportDataSource"
      value-ref="virtualMetaDataFactory"/>
      <entry key="com.jaspersoft.commons.semantic.datasource.SemanticLayerDataSource"
      value-ref="domainMetaDataFactory"/>
      <entry key="com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.AwsReportDataSource"
      value-ref="baseJdbcMetaDataFactory"/>
      <entry key="com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.AzureSqlReportDataSource"
      value-ref="baseJdbcMetaDataFactory"/>
      <entry key="com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.CustomReportDataSource"
      value-ref="customDataSourceMetaDataFactory"/>
      <entry key="com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.BeanReportDataSource"
      value-ref="baseJdbcMetaDataFactory"/>
    </map>
  </property>
</bean>

You will also need to add the entry:

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.BeanReportDataSource</value>

to dataSourceTreeDataProvider:

<bean name="dataSourceTreeDataProvider" 
      class="com.jaspersoft.commons.semantic.tree.DataSourceTreeDataProvider" 
      scope="prototype">
    <property name="repositoryService" ref="${bean.repositoryService}" />
    <property name="supportedClasses">
        <list>
            <value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JdbcReportDataSource</value>
            <value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.AwsReportDataSource</value>
            <value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.AzureSqlReportDataSource</value>
            <value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JndiJdbcReportDataSource</value>
            <value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.VirtualReportDataSource</value>
            <value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.CustomReportDataSource</value>
            <value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.BeanReportDataSource</value>
        </list>
    </property>
    <property name="dataSourceServiceFactories" ref="dataSourceServiceFactories"/>
</bean>

TIBCO JasperReports® Server version 7.5 Hotfix Update

For JasperReports® Server 7.5 Hotfix, you have to modify applicationContext-pro-settings.xml:

Add the bean data source to the list of supported data sources for the domain designer. Add this entry:

<util:constant static-field=“com.jaspersoft.jasperserver.dto.resources.ResourceMediaType.BEAN_DATA_SOURCE_CLIENT_TYPE”/>

to domainSettings supportedDataSources:

<entry key=“supportedDataSources”>
  <util:list>
    <util:constant static-field=“com.jaspersoft.jasperserver.dto.resources.ResourceMediaType.AWS_DATA_SOURCE_CLIENT_TYPE”/>
    <util:constant static-field=“com.jaspersoft.jasperserver.dto.resources.ResourceMediaType.AZURE_SQL_DATA_SOURCE_CLIENT_TYPE”/>
    <util:constant static-field=“com.jaspersoft.jasperserver.dto.resources.ResourceMediaType.JDBC_DATA_SOURCE_CLIENT_TYPE”/>
    <util:constant static-field=“com.jaspersoft.jasperserver.dto.resources.ResourceMediaType.JNDI_JDBC_DATA_SOURCE_CLIENT_TYPE”/>
    <util:constant static-field=“com.jaspersoft.jasperserver.dto.resources.ResourceMediaType.VIRTUAL_DATA_SOURCE_CLIENT_TYPE”/>
    <util:constant static-field=“com.jaspersoft.jasperserver.dto.resources.ResourceMediaType.BEAN_DATA_SOURCE_CLIENT_TYPE”/>
    <value>remoteXmlDataSource2</value>
    <value>mongoDBQueryDataSource2</value>
    <value>mongoDbJDBCDataSource</value>
    <value>jsonDataSource2</value>
    <value>jdbcQueryDataSource2</value>
    <value>xlsDataSource</value>
    <value>xlsxDataSource</value>
    <value>textDataSource</value>
    <value>jsonQLDataSource</value>
  </util:list>
</entry>

You will also need to modify applicationContext.xml to add the following line:

<value>com.jaspersoft.jasperserver.dto.resources.ClientBeanDataSource</value>

to jdbcDataSourceMetadataBuilderSupportedList:

<util:list id="jdbcDataSourceMetadataBuilderSupportedList" list-class="java.util.ArrayList">
  <value>com.jaspersoft.jasperserver.dto.resources.ClientJdbcDataSource</value>
  <value>com.jaspersoft.jasperserver.dto.resources.ClientJndiJdbcDataSource</value>
  <value>com.jaspersoft.jasperserver.dto.resources.ClientVirtualDataSource</value>
  <value>com.jaspersoft.jasperserver.dto.resources.ClientAwsDataSource</value>
  <value>com.jaspersoft.jasperserver.dto.resources.ClientAzureSqlDataSource</value>
  <value>com.jaspersoft.jasperserver.dto.resources.ClientBeanDataSource</value>
</util:list>

and then restart JasperReports® Server.

Feedback