网格开发工具使用小结之Globus Toolkit4(GT4)、Eclipse、Grid Development Tools(G

[复制链接]
查看11 | 回复6 | 2007-10-20 08:38:44 | 显示全部楼层 |阅读模式
本文介绍总结了本人使用Eclipse环境来进行GT4网格服务的开发的过程。 GT4 网格服务的开发中,开发人员做的最多的工作就是对项目文件和配置步骤(反复进行编译、链接、部署等)进行修改。如果没有诸如 Eclipse 之类的集成开发环境,当您在反复重复开发过程时,只能在很多工具(编辑器、命令行 shell、文件管理器、编译工具、应用程序容器等)之间不断地来回切换。为此我们希望通过采用合适的插件和配置之后,Eclipse就可以用来在一个单一的项目抽象中管理所有这些开发活动:从编码到部署到调试都可以在Eclipse中实现。本文主要本人是对工具使用的总结。对于网格和XML以及Eclipse设置中的一些概念和理论还比较模糊。DOC下载
网格开发工具使用小结之Globus Toolkit4(GT4)、Eclipse、Grid Development Tools(GDT)、Tomcat清华大学 软41 纪磊 [email protected].简介 本文介绍总结了本人使用Eclipse环境来进行GT4网格服务的开发的过程。 GT4 网格服务的开发中,开发人员做的最多的工作就是对项目文件和配置步骤(反复进行编译、链接、部署等)进行修改。如果没有诸如 Eclipse 之类的集成开发环境,当您在反复重复开发过程时,只能在很多工具(编辑器、命令行 shell、文件管理器、编译工具、应用程序容器等)之间不断地来回切换。为此我们希望通过采用合适的插件和配置之后,Eclipse就可以用来在一个单一的项目抽象中管理所有这些开发活动:从编码到部署到调试都可以在Eclipse中实现。 本文主要本人是对工具使用的总结。对于网格和XML以及Eclipse设置中的一些概念和理论还比较模糊。2.设置2.1. 所需工具:Eclipse(含Apache-ant 1.6.5):Version: 3.2.0Build id: M20060629-1905 GDT:The Eclipse Grid Development ToolsJDK:jdk-1_5_0_07-windows-i586-p.exeTomcat 5.5.20ws-core-4.0.3 (bin)Sysdeo Eclipse Tomcat Launcher Plug-in V3.2.0 beta32.2. 安装配置:对于JDK、ws-core-4.0.3、及Tomcat主要是设置环境变量: 按[win]+[Pause Break]键à高级à环境变量添加以下内容:在系统[Path]中添加:%GLOBUS_LOCATION%bin;%JAVA_HOME%bin;%CATALINA_HOME%bin其中%GLOBUS_LOCATION%为ws-core-4.0.3-bin.zip解压目录.%JAVA_HOME%、%CATALINA_HOME%分别为JDK和Tomcat安装目录,这三者需在环境变量中[新建]. JDK还需[新建]CLASSPATH=.;%JAVA_HOME%lib; Hit: 在可以运行 Tomcat 中的“admin”和“manager” 程序之前, 必须首先为此定义一个用户。将下面这行代码插入 %CATALINA_HOME%conftomcat-users.xml 中: 对于GDT和Sysdeo Tomcat Launcher, 只需并将其解压到 Eclipse 的 plug-ins 目录中既可. 在使用插件之前,我们需要先来配置一下它的一部分参数。打开Eclipse转到 Window > Preferences 菜单中,打开 Eclipse Preferences 对话框。选择 Tomcat 页面,然后选择 Version 5.x 按钮,填充 Tomcat Home 文本框,如图 1 所示:图 1. 设置 Tomcat 版本 在 Tomcat Manager App 页面中,输入管理者的用户名/密码,如图 2 所示。图 2. Tomcat Manager App 页面在 GDT Preferences页面中,输入GT4和Tomcat的安装路径,如图 3所示。图 3. GDT Preferences 页面3.使用GDT创建GT4服务3.1. 项目创建新建一个 Java 项目 (File -> New -> Project -> Java Project).选择源文件和输出文件分离。如图1:Fig. 1 - New Project Wizard, settings for ServiceProject. 3.2. 创建服务: 右击项目文件夹选择 New -> OtherFig. 2 - Selection of other new object wizards from context menu. From the List of Wizards select the "MAGE Service" wizard and continue to the next page.Fig. 3 - Selection of the MAGE Service wizard for the new object. Now enter all necessary information to create a new Service. In the following example we will create a Service called "Search" in the namespace "http://Tsinghua.edu/grid/search". The core implementation of our Service will be generated in the package "edu.tsinghua.grid.search" and the name of the class will also be "Search". Fig. 4 - Input to the new MAGE service wizard. Now click "Finish" and the service skeleton should be created in your project. 3.3. Fig. 5 - The service skeleton has been created in the service project. Sources have been created as source folders.3.4. 添加项目文件 GDT提供了两种java注释类来标示网格成员属性和成员方法l GridAttribute - for fields that should be exposed as WS-ResourceProperty l GridMethod - for methods that should be exposed by the grid service 本文采用例子如下(Search.java 文件)package edu.tsinghua.grid.search;import java.util.Vector;import de.fb12.gdt.GridService;import de.fb12.gdt.GridAttribute;import de.fb12.gdt.GridMethod;@GridService (name = "Search", namespace = "http://Tsinghua.edu/grid/search", targetPackage = "edu.tsinghua.grid.search", serviceStyle = "SSTYLE_FACTORY", resourceStyle = "RSTYLE_MAGE&quot

public class Search{@GridAttribute private int a;public int getA() { return a;}public void setA(int a) { this.a = a;}@GridMethod public void addA(int a){ this.a+=a;}@GridAttribute public Vector[I] resource;public Vector[I] getResource(){ return resource;}public void setResource(Vector[I] a){ resource=a;} @GridMethod public void search(int i, int j){ int k=0; resource=new Vector[I](100); for (k=0;k9) { System.out.println("Your query time is wrong!&quot

; return; } if(useable
Grid Service Buildfile
这个“主”编译文件会调用以下外部编译文件:WS-Core build-packages.xml Ant 编译文件(D:studygridwscoreshareglobus_wsrf_commonbuild-launcher.) WS-Core tomcat.xml Ant 编译文件(D:studygridwscoreshareglobus_wsrf_commontomcattomcat.xml) 5.2. 在为这个buildservice.xml部署文件创建一个启动配置之前,需要先创建一个buildservice.properties文件,它包含了这个服务所特有的name=value属性,以及指导各种部署过程所需的属性。这个buildservice.properties编译文件应该被添加到该项目的根目录中。这个文件的源代码如下:build.packages=/studygrid/wscore/share/globus_wsrf_common/build-packages.xmlbuild.tomcat=/studygrid/wscore/share/globus_wsrf_common/tomcat/tomcat.xmlgar.name=/studygrid/eclipse/workspace/scheServeice/Search/edu_tsinghua_grid_search_Search.gartomcat.dir=/studygrid/tomcat5.55.3. 创建启动配置使用这个现在已经链接到项目上的 Ant 编译文件以及所创建的一个对应的 .properties 文件,我们就可以创建一个启动配置,它会为这个服务部署GAR 文件。要实现这一点,请用鼠标右键单击buildservice.xml文件,并选择 Run > External Tools...,如图 1 所示。图 1. Run > External Tools 选项 如果需要,请从 Configurations 面板中选择 “Ant Build”,并单击 New,然后选择buildservice.xml,并将其重命名为 “search deploy” ,并在 Main 选项卡中的 Base Directory 域中输入该项目的根目录${workspace_loc:/catgrid}},如图 2 所示。图 2. External Tools 对话框 在 Properties 选项卡中,取消选中 “Use global properties...” 复选框,并单击 Add > Files...,将 buildservice.properties 文件从该项目的根目录中添加进来,如图 3 所示。图3.External Tools 对话框的 Properties 选项卡最后,在 Common 选项卡中,选中 External Tools 复选框,这样,在单击工具条上的 External Tools
回复

使用道具 举报

千问 | 2007-10-20 08:38:44 | 显示全部楼层
太紧密了,看不了!
希望下次楼上有机会整理一下!
回复

使用道具 举报

千问 | 2007-10-20 08:38:44 | 显示全部楼层
上传一个.
回复

使用道具 举报

千问 | 2007-10-20 08:38:44 | 显示全部楼层
谢谢,受益非浅
回复

使用道具 举报

千问 | 2007-10-20 08:38:44 | 显示全部楼层
下不来啊
回复

使用道具 举报

千问 | 2007-10-20 08:38:44 | 显示全部楼层
下不来啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行