Installing Custom Data Source Examples
These examples may be used in both JasperServer or JasperServer Pro. For further information on developing
custom data sources, refer to the JasperServer User's Guide, or the JasperServer Pro Administration Guide.
The examples are found in <js-install>/samples/customDataSource. Once you have deployed a JasperServer web
application to your application server, you can use Ant to build and deploy the examples.
If you used an installer to install JasperServer version 2.1 or later, you will have Ant installed already. Ant may be run with
the following command:
<js-install>/ant/bin/ant <ant-arguments>(for Linux/Unix)
<js-install>\ant\bin\ant <ant-arguments> (for Windows)
If you installed JasperServer manually with a WAR file, you will need to download Ant from http://ant.apache.org. Ant
1.6.2 was used for testing, but earlier versions should also work.
The JVM used for installing the examples needs to be a full Java Development Kit, because it needs to compile Java source
files. Ensure that the JAVA_HOME environment variable points to a JDK installation.
The sample directory includes the following files and directories:
* build.xml: The Ant build file
* src: Java source directory
* webapp: A directory containing other files required by the examples, such as JSPs and Spring configuration files,
which are copied directly to the JasperServer web application directory
* reports: A directory containing example JRXML files that use the sample custom data sources
Take the following steps to install the samples in your JasperServer web application (this can be built from the source code
or the delivered version of JasperServer):
* At the command line, change directories to the custom data source sample directory (<js-
install>/samples/customDataSource)
* Edit build.xml and set the webAppDir property to the root of the JasperServer web application.
* Run the Ant command (see above) with no arguments, which will execute the default target, which is named
deploy. The deploy target will run the following tasks:
o Compile the Java source under the src directory
o Deploy the compiled Java class files to the JasperServer web application
o Deploy files under the webapp directory to the the JasperServer web application
* Restart the application server
Custom Bean Data Source
The custom bean data source implementation creates a data source from a collection of Java beans declared in the source
code. Its Spring bean definition file is located in <js-install>/samples/customDataSource/webapp/WEB-
INF/applicationContext-sampleCDS.xml. It An example of a report using this data source is located in <js-
install>/samples/customDataSource/reports/simpleCDS.jrxml.
Webscraper Custom Data Source
The webscraper custom data source implementation can fetch a web page, decode the HTML, and extract selected data
which is turned into field values in the data source. Its Spring bean definition file is located in <js-
install>/samples/customDataSource/webapp/WEB-INF/applicationContext-webscraperDS.xml.
These are the configuration items for the datasource:
* URL: An HTTP URL which refers to the HTML page containing the desired content
* DOM path: An XPath expression which locates HTML elements to be turned into rows in the data source
* Field paths: XPath expressions for each field defined in the JRXML which are used to locate the field value within
each row selected by the DOM path
The implementation creates a data source by taking the following steps:
* Uses the URL to issue a GET request for an HTML page.
* Converts the HTML response into XML using JTidy (http://jtidy.sourceforge.net).
* Uses the DOM path to select XML elements from the converted response.
* Create a new data source row for each selected element
* For each field, use the field path to determine the content for each field
* The data source has two parameters: the URL of the web page, and the XPath which determines that elements in
the HTML page become rows in the data source. The parameters can be specified either by a data source definition
in the repository or by a query string in the JRXML.
The example reports for this data source read a web page from http://www.craigslist.org and extract a list of items for sale.
The file reports/webscrapertest.jrxml has no query defined. Instead, it relies on an instance of the custom data source
that has been created in the repository. Typical parameters to use with this data source are:
* URL: http://sfbay.craigslist.org/sfc/cta/
* DOM Path: /html/body/div[2]/div/p
The file reports/webscraperQEtest.jrxml contains a queryString element which specifies the URL and the DOM
path. It should be used without defining a data source instance, because JasperServer will not run the query executer for this
particular implementation if a data source is defined for the report unit.
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
TIB_js-jrs-cp_7.1.0_bin.zip (617个子文件)
ant 10KB
antRun 861B
ant.bat 7KB
do-js-upgrade.bat 6KB
time.bat 4KB
do-js-setup.bat 4KB
date.bat 2KB
do-js-install.bat 2KB
antRun.bat 2KB
js-import.bat 1KB
js-export.bat 1KB
lcp.bat 1KB
js-ant.bat 786B
js-upgrade-newdb-ce.bat 492B
js-upgrade-samedb-ce.bat 273B
js-install-ce.bat 219B
cpappend.bat 36B
envset.cmd 4KB
antenv.cmd 3KB
ant.cmd 3KB
runrc.cmd 2KB
js-create.ddl 32KB
js-create.ddl 27KB
js-drop.ddl 11KB
js-drop.ddl 10KB
quartz.ddl 9KB
quartz.ddl 9KB
quartz-drop.ddl 844B
quartz-drop.ddl 622B
sqlserver_java.sql.Driver 46B
oracle_java.sql.Driver 40B
db2_java.sql.Driver 34B
wtee.exe 56KB
upgrade-newdb.help 2KB
upgrade-samedb.help 1KB
install.help 519B
INSTALL 126B
icu4j-57.1.jar 10.77MB
groovy-all-2.4.5.jar 6.67MB
poi-ooxml-schemas-3.15.jar 5.59MB
jasperreports-6.4.31.jar 5.24MB
spring-js-resources-2.3.0.RELEASE.jar 4.25MB
Saxon-HE-9.6.0-4.jar 3.98MB
infinispan-core-8.1.0.Final.jar 3.24MB
mondrian-3.6.4-JS-2.jar 3.2MB
xalan-2.7.2.jar 3.01MB
bcprov-jdk15on-1.52.jar 2.77MB
teiid-engine-9.1.1.jar 2.76MB
xmlbeans-2.6.0.jar 2.6MB
xbean-2.2.0.jar 2.54MB
poi-3.15.jar 2.46MB
hibernate-core-3.3.2.GA-HHH-2763.jar 2.2MB
ecj-4.4.2.jar 2.2MB
lucene-core-4.5.1.jar 2.19MB
fop-0.95.jar 2.16MB
guava-18.0.jar 2.15MB
netty-all-4.0.32.Final.jar 2MB
jgroups-3.2.13.Final-redhat-1.jar 1.93MB
ant.jar 1.93MB
aspectjweaver-1.8.9.jar 1.78MB
aws-java-sdk-ec2-1.9.31.jar 1.75MB
axis-1.4-JS-4.jar 1.58MB
lucene-analyzers-common-4.5.1.jar 1.51MB
jai_core-1.1_mr.jar 1.5MB
jfreechart-1.0.19.jar 1.49MB
mongo-java-driver-3.3.0.jar 1.47MB
xercesImpl-2.11.0.jar 1.3MB
poi-ooxml-3.15.jar 1.28MB
ehcache-core-2.6.0.jar 1.27MB
ant-1.7.1.jar 1.26MB
activemq-client-5.13.2.jar 1.24MB
itext-2.1.7.js6.jar 1.08MB
snappy-java-1.1.2.6.jar 1.01MB
jasperserver-war-jar-7.1.0.jar 905KB
jackson-databind-2.3.2.jar 894KB
spring-core-3.2.18.RELEASE.jar 865KB
castor-xml-1.3.3.jar 852KB
spring-context-3.2.18.RELEASE.jar 848KB
jaxb-impl-2.1.5.jar 829KB
jasperserver-api-metadata-impl-7.1.0.jar 825KB
jasperserver-api-engine-impl-7.1.0.jar 824KB
ji-jpivot-6.1.0.jar 786KB
jts-1.13.jar 776KB
jackson-mapper-asl-1.9.2.jar 748KB
commons-collections4-4.1.jar 734KB
aws-java-sdk-rds-1.9.31.jar 696KB
js-1.6R3.jar 692KB
hibernate-validator-5.2.2.Final.jar 681KB
infinispan-commons-8.1.0.Final.jar 678KB
postgresql-9.4-1210.jdbc42.jar 662KB
postgresql-9.4-1210.jdbc41.jar 658KB
postgresql-9.4-1210.jdbc41.jar 658KB
postgresql-9.4-1210.jdbc41.jar 658KB
aws-java-sdk-redshift-1.9.31.jar 657KB
jacocoant.jar 633KB
spring-webmvc-3.2.18.RELEASE.jar 630KB
spring-web-3.2.18.RELEASE.jar 617KB
spring-beans-3.2.18.RELEASE.jar 600KB
jasperserver-dto-7.1.0.jar 597KB
c3p0-0.9.1.1.jar 594KB
共 617 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
wdmsyf
- 粉丝: 18
- 资源: 79
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功