应用SAP HANA “官方”开发模式的伙伴们在转到“多团队大规模”开发模式时会遇到各式各样的心理不适应的状况,各种纠结。比如GIT Repository和HANA Repository冲突什么的。
这些问题主要是思路没有完全转换过来,两种开发模式在不断的“打架”。做一个简单的开发模式映射这样大家或许比较容易去接受“多团队大规模”的开发模式。这个映射不一定完全正确,主要是帮助大家理解。
伙伴们想一想平常我们做JAVA或者.NET项目是怎么做的?一般情况是使用各种框架写JAVA/.NET的代码,然后用ORM映射数据库。写SQL Query时基本上都是在SQL里面去写,去测试然后拼接到自己的JAVA/.NET代码中。
+
那么我们在SAP HANA平台上开发同样可以学习这样的模式,当然这种模式可能比“官方”模式厚重点,但是好处也是显而易见的,比如前文提到的那些好处。前后端的开发都可以在Eclipse中,HANA Studio的作用完全等同拼写检查SQL Query等SQL层面的工作。这样我们在开发过程中就可以应用很多手段,方便的传递参数。比如替换rootpackage,通过maven的插件就很容易的可以做到。这样HANA Instance就扮演了一个编译器的作用。前端的代码编译好之后,和后端代码整合到一起Activate到HANA Repository中,这时的Activate就像是compile一样。Maven的插件,或者Ant的脚本把Activate这些HANA特有的动作都封装起来,开发人员完全还是遵循着传统多团队大规模开发的模式——写代码,编译,调试等。
+
由于Maven涉及到公司内部提供的插件,没有开源。所以就提供一个Ant的脚本以饷读者。
<project name="regi" basedir="."> <description>Regi wrapper</description> <!-- Properties for using REGI --> <property name="userstore.key" value="BUILD"/> <property name="userstore.cmdline" value="${client.dir}/hdbuserstore"/> <property name="regi.cmdline" value="${client.dir}/regi"/> <property name="regi.connection.args" value="--key=BUILD" /> <macrodef name="regi"> <attribute name="workspacedir" /> <attribute name="command" /> <sequential> <!-- make sure the directory exists --> <mkdir dir="@{workspacedir}" /> <!-- Create the workspace --> <exec executable="${regi.cmdline}" dir="@{workspacedir}" failonerror="true"> <arg line="@{command}" /> </exec> </sequential> </macrodef> <macrodef name="regi_apply"> <attribute name="workspacedir" /> <attribute name="command" /> <element name="files" /> <sequential> <!-- make sure the directory exists --> <mkdir dir="@{workspacedir}" /> <!-- Create the workspace --> <apply executable="${regi.cmdline}" dir="@{workspacedir}" failonerror="true" relative="true" parallel="true"> <arg line="@{command}" /> <files /> </apply> </sequential> </macrodef> <macrodef name="regi_setupuserstore"> <attribute name="workspacedir" /> <sequential> <!-- Setup a key in the user store for use by REGI --> <exec executable="${userstore.cmdline}" dir="@{workspacedir}" failonerror="true"> <arg line="SET ${userstore.key} ${hana.host} ${hana.user} ${hana.password}" /> </exec> </sequential> </macrodef> <macrodef name="regi_createworkspace"> <attribute name="workspacedir" /> <sequential> <!-- make sure the directory exists (needed for keystore operation) --> <mkdir dir="@{workspacedir}" /> <!-- Create the workspace --> <mkdir dir="@{workspacedir}" /> <exec executable="${regi.cmdline}" dir="@{workspacedir}" failonerror="true"> <arg line="${regi.connection.args} create workspace --force" /> </exec> </sequential> </macrodef> <macrodef name="regi_export"> <attribute name="workspacedir" /> <attribute name="deliveryUnit" default="" /> <attribute name="vendor" default="" /> <attribute name="fileName" default="" /> <sequential> <!-- Export the desired delivery unit to the specified file --> <regi workspacedir="@{workspacedir}" command="export @{deliveryUnit} @{vendor} @{fileName}" /> </sequential> </macrodef> <macrodef name="regi_track"> <attribute name="workspacedir" /> <attribute name="package" default="" /> <sequential> <echo>regi track @{package}</echo> <!-- Track the desired package --> <regi workspacedir="@{workspacedir}" command="track @{package}" /> </sequential> </macrodef> <macrodef name="regi_commit"> <attribute name="workspacedir" /> <sequential> <regi workspacedir="@{workspacedir}" command="commit" /> <regi workspacedir="@{workspacedir}" command="activate" /> </sequential> </macrodef> <macrodef name="regi_import"> <attribute name="workspacedir" /> <attribute name="import" /> <sequential> <regi workspacedir="@{workspacedir}" command="import @{import}" /> </sequential> </macrodef> <macrodef name="regi_cleanpackage"> <attribute name="package"/> <sequential> <echo message="Deleting regi package: @{package}" /> <!-- Brutally crush any and all evidence of the repo objects for the passed package --> <hdbsqlsql failonerror="false" sql=" delete from "_SYS_REPO"."ACTIVE_OBJECT" where PACKAGE_ID = ‘@{package}‘ OR PACKAGE_ID LIKE ‘@{package}.%‘ ${line.separator} delete from "_SYS_REPO"."OBJECT_HISTORY" where PACKAGE_ID = ‘@{package}‘ OR PACKAGE_ID LIKE ‘@{package}.%‘ ${line.separator} delete from "_SYS_REPO"."RUNTIME_OBJECTS" where PACKAGE_ID = ‘@{package}‘ OR PACKAGE_ID LIKE ‘@{package}.%‘ ${line.separator} delete from "_SYS_REPO"."PACKAGE_CATALOG" where PACKAGE_ID = ‘@{package}‘ OR PACKAGE_ID LIKE ‘@{package}.%‘ ${line.separator} delete from "_SYS_REPO"."INACTIVE_OBJECT" where PACKAGE_ID = ‘@{package}‘ OR PACKAGE_ID LIKE ‘@{package}.%‘ ${line.separator} delete from "_SYS_REPO"."ACTIVE_OBJECTCROSSREF" where FROM_PACKAGE_ID = ‘@{package}‘ OR FROM_PACKAGE_ID LIKE ‘@{package}.%‘ ${line.separator} delete from "_SYS_REPO"."ACTIVE_OBJECTCROSSREF" where TO_PACKAGE_ID = ‘@{package}‘ OR TO_PACKAGE_ID LIKE ‘@{package}.%‘ ${line.separator} delete from "_SYS_REPO"."INACTIVE_OBJECTCROSSREF" where FROM_PACKAGE_ID = ‘@{package}‘ OR FROM_PACKAGE_ID LIKE ‘@{package}.%‘ ${line.separator} delete from "_SYS_REPO"."INACTIVE_OBJECTCROSSREF" where TO_PACKAGE_ID = ‘@{package}‘ OR TO_PACKAGE_ID LIKE ‘@{package}.%‘ ${line.separator} "/> </sequential> </macrodef> <macrodef name="regi_clean"> <attribute name="workspacedir" /> <sequential> <delete dir="@{workspacedir}/._SYS_REGI_settings"/> </sequential> </macrodef> <macrodef name="regi_checkout_trackedPackages"> <attribute name="workspacedir" /> <sequential> <echo>regi checkout trackedPackages --force</echo> <echo>[email protected]{workspacedir}</echo> <!-- Checkout all packages that have been tracked. --> <regi workspacedir="@{workspacedir}" command="checkout trackedPackages --force" /> </sequential> </macrodef> <macrodef name="regi_delete_packages"> <attribute name="workspacedir" /> <attribute name="packages" /> <sequential> <echo>regi delete packages @{packages}</echo> <echo>[email protected]{workspacedir}</echo> <!-- Delete the desired package --> <regi workspacedir="@{workspacedir}" command="delete packages @{packages}" /> </sequential> </macrodef> </project>
时间: 2024-10-01 02:47:49