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