Rebuild ibatis to support source code download and compilation of data columns stored in the file system and sqlmapconfig parsing.

Source: Internet
Author: User
Tags change settings

Link

Http://www.cnblogs.com/suyuan/archive/2009/04/16/1437360.html

From this articleArticleAt first, I will explain it step by step.IbatisSource codeImplement the above functions,This article introducesIbatisDownload,Compile andSqlmapconfigResolution.Here we useJavaVersion,. NetFor the version, see the current version..

Download:

IbatisOfficial WebsiteHttp://ibatis.apache.org/

You can download the latestIbatisSourceCode.

The official source code does not include dependency packages..Only one dependency package list is provided,No full columns yet.At the same time, some packages in the list officially provided have been upgraded, and old version downloads are no longer provided.,We try to find the closest version to the official list..Otherwise, compilation may fail..

If you are in trouble,Here I provide dependency packages in the list listed officially

/Files/Suyuan/ibatisneedlib.rar

Download source code,After the dependency package is attached,Note:, IbatisYesJdk1.5Environment,If you chooseJdk1.6,Change settings,Otherwise, the compilation is incorrect..

 

The next step begins.,Haha

 

In the previous article,We have already introducedSqlmaperconfigAdd a node to the file

<Basedirectory resource = "D:/ibatis/"/>

This node is used to specify the root path of the file system..

IbatisDuring initializationSql-map-2.dtdAndSql-map-config-2.dtdVerifyXMLFile is correct,IfSqlmaperconfigAdding the node will cause initialization errors..

First, modifySql-map-config-2.dtdFile

Then define the node.

After completing the preceding operations,InXMLAdd the node we configured No initialization error will occur..

After configuration is complete,Does not work,Because there is no Parsing,Add the parsing part.

IbatisPairXMLResolution All put in thisPackage com. ibatis. sqlmap. Engine. Builder. xmlBelow

for sqlmapconfig the parsed class corresponds to sqlmapconfigparser

We only need to add the following method to this class.,And put this method in SqlmapconfigparserIn the constructor..

Put this method in the constructor. ActuallyNodeletparserAddedNodeProcessing Method.

 

Note: This Code

the parsed value is assigned to an attribute of an object. . the object is sqlmapexecutordelegate , that is to say , we need to add an attribute to this object:

private string basedirectory; sqlmapexecutordelegate like a big manager , same , in future transformation , we will use this object multiple times .

Here we assume that we are not in the configuration file ConfigurationBasedirectoryNode,The current directory is used by default.

Basedirectory = system. getproperty ("user. dir ");

 

 

OK,For We have successfully addedBasedirectoryNode,The configuration path will beHashPaths are combined into our file storage paths.

 

This article ends here,The rest will be explained below

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.