(1)bosent开发手册 下载本文

开发手册

开发文档

需要注意的是:

2. 在bosentbusiness下建一个component-load.xml文件。这个文件主要是组件配置到系统中,系统在启动的时候能加载到组件。如:

需要注意的是: component-location必须是你应用模块的名字,否则系统不能加载你的应用。sss

3. 启动bosent。完成以上配置以后,在启动bosent系统时,系统会自动加载配置好的组件。在后台日志中可以看到系统加载bosentbusiness下的helloworld组件,如:

? 加载组件:

2010-07-10 11:21:13,288 (main) [ComponentContainer.java:160:INFO ] Auto-Loading component directory : [D:/workspace/bosent_baseline_framework/bosentbusiness]

2010-07-10 11:21:13,303 (main) [ComponentContainer.java:219:INFO ] Loading component : [helloworld]

? 建表: 2010-07-10 13:53:40,492 (main) [ DatabaseUtil.java:353:WARN ] Entity [HelloHobby] has no table in the database 2010-07-10 13:53:40,550 (main) [DatabaseUtil.java:366:INFO ] Created table [BOSENT.HELLO_HOBBY]

2010-07-10 13:53:40,550 (main) [DatabaseUtil.java:353:WARN ] Entity [HelloPerson] has no table in the database

2010-07-10 13:53:40,588 (main) [DatabaseUtil.java:366:INFO ] Created table [BOSENT.HELLO_PERSON]

2010-07-10 13:53:40,589 (main) [DatabaseUtil.java:353:WARN ] Entity [HelloPersonHobby] has no table in the database

2010-07-10 13:53:40,635 (main) [DatabaseUtil.java:366:INFO ] Created table [BOSENT.HELLO_PERSON_HOBBY]

29

开发手册

开发文档

? 建索引外键:

2010-07-10 13:53:41,205 (main) [DatabaseUtil.java:2972:INFO ] Created 2 foreign key indices for entity [HelloPersonHobby]

2010-07-10 13:53:41,220 (main) [DatabaseUtil.java:2765:INFO ] Created 2 declared indices for entity [HelloHobby]

2010-07-10 13:53:41,237 (main) [DatabaseUtil.java:2765:INFO ] Created 2 declared indices for entity [HelloPerson]

2010-07-10 13:53:41,251 (main) [DatabaseUtil.java:2765:INFO ] Created 2 declared indices for entity [HelloPersonHobby] ? 加载服务:

2010-07-10 12:10:49,773 (main) [ModelServiceReader.java:210:INFO ] Loaded [ 2] Services from file:/D:/workspace/bosent_baseline_framework/bosentbusiness/helloworld/servicedef/services.xml

4. 待bosent系统启动完后,可以在数据库中看见新建的3张表。如图所示:

5. 加载初始化数据。根据4.2加载种子数据的操作方式,加载新组件中配置的种子数据。后台日志会打印日志:

2010-07-10 14:13:02,532 (main) [EntityDataLoadContainer.java:275:INFO ] 00012 of 41252 from file:/D:/workspace/bosent_baseline_framework/bosentbusiness/helloworld/data/HobbiesData.xml。 种子数据加载完成后,会在数据库表HELLO_HOBBY中生成相应的数据,因为这个应用只配置了”HelloHobby”实体的初始化数据。如图所示:

至此证明新加的helloworld组件配置成功。

5.1.8 serviceUi

通过serviceUi可以模拟客户端调用服务,生成serviceUi后,可以通过界面操作传入参数值调用服务,就可以通过这种方式测试服务。

30

开发手册

开发文档

1. 配置serviceUi,主要就是配置一个xml文件。在应用组件下建目录config/serviceUi。

通过3.2 java build path配置方式,把config目录配置为类路径。再建立一个serviceUi描述的xml文件serviceUi_HelloWorldService.xml。如图所示:

文件内容如下:

class-name=\>

title=\创建person\>

other-name=\ optional=\ type=\ title=\/>

other-name=\ optional=\ type=\ title=\/>

2. 通过serviceUi调用服务。配置好serviceUi后,启动bosent,再浏览器的url中输

入:http://localhost:8080/serviceUi。就会出现Bosent Service User Interface 界面。在左边树中选择”HelloWorld”->”创建person”(这两项都是通过第一步中配置serviceUi文件而来,见配置文件内容)。如图所示:

随便输入一个personID值,点击”确定”。查看后台输出日志:

2010-07-13 10:46:11,321 (http-0.0.0.0-8080-5) [ SaveDataServlet.java:46 :INFO ] SaveDataServlet Start

31

开发手册

开发文档

2010-07-13 10:46:11,323 (http-0.0.0.0-8080-5) [ SaveDataServlet.java:54 :INFO ] The

character encoding of the request is: [UTF-8]. The character encoding we will use for the request and response is: [UTF-8]

session2 = org.apache.catalina.session.StandardSessionFacade@19a8c41

2010-07-13 10:46:11,383 (http-0.0.0.0-8080-5) [ SaveDataServlet.java:110:INFO ] IN_PUT :Map结构: |

+----\

2010-07-13 10:46:11,384 (http-0.0.0.0-8080-5) [ SaveDataServlet.java:141:INFO ] SaveDataServlet end

2010-07-13 10:46:11,953 (http-0.0.0.0-8080-5) [ServiceExecutorServlet.java:86 :INFO ] ServiceExecutorServlet Start

2010-07-13 10:46:11,955 (http-0.0.0.0-8080-5) [ServiceExecutorServlet.java:121:INFO ] IN_PUT :Map结构: |

+----\

2010-07-13 10:46:12,248 (http-0.0.0.0-8080-5) [ AbstractEngine.java:73 :INFO ] Loaded Service Locations : [main-rmi=rmi://localhost:1099/RMIDispatcher, main-http=http://localhost:8080/webtools/control/httpService, entity-sync-rmi=rmi://localhost:1099/RMIDispatcher, entity-sync-http=http://localhost:8080/webtools/control/httpService, rita-rmi=rmi://localhost:1099/RMIDispatcher, eedcc-test=http://localhost:8080/webtools/control/httpService] 2010-07-13 10:46:12,311 (http-0.0.0.0-8080-5) [ HelloWorldServices.java:31 :INFO ] helloPersonId = 23123

2010-07-13 10:46:12,398 (http-0.0.0.0-8080-5) [ServiceExecutorServlet.java:144:INFO ] OUT_PUT:Map结构: |

+----\ |

+----\

2010-07-13 10:46:12,401 (http-0.0.0.0-8080-5) [ServiceExecutorServlet.java:294:INFO ] ServiceExecutorServlet end 以上日志表明,配置serviceUi调用服务成功。

5.1.9 webservice

本节主要介绍服务对外发布生成web service的方式,主要是针对NetWeaver版本。生

成web service的前提条件是配置serviceUi。生成web service的方式bosent已经有了一个代码生成器。通过Eclipse的方式运行代码生成器即可。

32