100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > db4o_8.0对象数据库官方文档翻译_学习笔记一

db4o_8.0对象数据库官方文档翻译_学习笔记一

时间:2020-06-12 14:25:00

相关推荐

db4o_8.0对象数据库官方文档翻译_学习笔记一

官网软件下载可能过慢,以下为我的分享:

db4o-8.0-java.zip (包含db4o的API及jar包,以及OME插件等):/s/1gdBx13X

Eclipse分享(适合OME插件的Eclipse版本):/s/1kTEDgf9

Welcome

db4oisthenativeJava,.NETandMonoopensourceobjectdatabase.

db4o是本地的Java,.NET和Mono的开源对象数据库.

Thistutorialwaswrittentogetyoustartedwithdb4oasquicklyaspossible.Beforeyoustart,pleasemakesurethatyouhavedownloadedthelatestdb4odistributionfromthedb4objectswebsite.

写这份指南是为了让你能够对db4o尽快上手。在开始之前,请首先确保你已经从db4objects的网站上下载了最新的db4o发行包。

Youareinvitedtojointhedb4ocommunityinthepublicdb4oforumstoaskforhelpatanytime.

你被邀请加入db4o社区的公共论坛,在那里可以随时请求帮助。

Links

Inordertoaccessfreedeveloperresourcesyoumaywanttoregisterondb4odeveloperwebsite.

Feelfreeregistertotheforums/Users/register.aspx.

为了可以访问免费的开发者资源,你可能需要在db4o开发者网站上要注册一个账号,论坛的注册网址为:/Users/register.aspx

thatyoumayfinduseful:

下面是一些上的一些可能对你比较有用的链接:

AllDownloads

SVNRepository

CommunityProjects

DownloadContents(下载内容)

Thedb4oJavadistributioncomesasonezipfile,db4o-8.0-java.zip.Whenyouunzipthisfile,yougetthefollowingdirectorystructure:

db4o的Java发布版本是以一个zip文件(db4o-8.0-java.zip)的形式进行发布的。解压缩这个文件后,你将获得下面的目录结构:

Pleasetakealookatallthesupplieddocumentationformatstochoosetheonethatworksbestforyou:

.请看一下所有的文档格式,选择一个最适合你的:

db4o-8.0/doc/api/index.html

TheAPIdocumentationfordb4oissuppliedasJavaDocsHTMLfiles.WhileyoureadthroughthistutorialitmaybehelpfultolookintotheAPIdocumentationoccasionally.

db4o的API文档以JavaDocs的HTML文件格式提供。当你阅读这份指南的时候,偶尔翻阅一下这个API文档是很有帮助的。

db4o-8.0/doc/reference/index.html

Thereferencedocumentationisacompletecompilationforexperienceddb4ousers.

参考文档是对有经验的db4o用户来说是一个完整的编辑物。

db4o-8.0/doc/tutorial/index.html

ThisistheinteractiveHTMLtutorial.Examplescanberun"live"againstadb4odatabasefromwithinthebrowser.InordertousetheinteractivefunctionalityaJavaJRE1.3oraboveneedstobeinstalledandintegratedintothebrowser.Javasecuritysettingshavetoallowappletstoberun.Ifyouhaveproblemsusingtheinteractivefunctionality,pleaserefertoTutorialTroubleshooting.

这是交互式的HTML的指南。示例可以依靠一个db4o数据库在浏览器上实时运行。为了使用交互功能:你需要安装一个1.3或更新版本的JRE并把它集成到浏览器里。Java的安全设置必须允许运行applet,如果你在使用交互功能的时候遇到了问题,请参考指南的TutorialTroubleshooting部分。

db4o-8.0/doc/tutorial/db4o-8.0-tutorial.pdf

ThePDFversionofthetutorialallowsbestfulltextsearchcapabilities.

这份PDF版本的指南很好的支持全文检索功能。

1.FirstGlance(开始前的了解)

Beforedivingstraightintothefirstsourcecodesampleslet'sgetyoufamiliarwithsomebasics.

在进入第一个示例代码之前,让我们先了解一些必要的基础知识。

1.1.Thedb4oengine(db4o引擎)

Thedb4oobjectdatabaseengineconsistsofonesinglecorejarfile.Inadditionyoumaywanttouseclient/serverlibraryoroptionalcomponents.Youmayalsogetitallinasinglejar"db4o-all":

do4o对象数据库引擎由一个Jar文件组成。另外你可能想要使用客户机/服务器库或可选组件,其实你都可以在一个jar包(db4o-all)中得到你想要的。

db4o-8.0-core-java1.1.jar

willrunwithmostJavaJDKsthatsupplyJDK1.1.xfunctionalitysuchasreflectionandExceptionhandling.ThatincludesmanyIBMJ9configurations,SymbianandSavaje.

运行在大部分支持JDK1.1特性(如反射及异常处理)的javaJDK,其中包括了一些IBMJ9configurations,Symbian和Savaje。

db4o-8.0-core-java1.2.jar

isbuiltforallJavaJDKsbetween1.2and1.4.

用于1.2至1.4版本的JavaJDK。

db4o-8.0-core-java5.jar

isbuiltforJavaJDK5andJDK6

用于1.5至1.6版本的JavaJDK。

Ifyouintendtouseclient/serverversionofdb4oyouwilladditionallyneedclient/serverlibrary

如果你想要使用客户端/服务器版本的db4o,你可能需要额外的一些客户端/服务器的包

matchingyourJDKversion(对应你的jdk版本):

db4o-8.0-cs-java1.1.jar

db4o-8.0-cs-java1.2.jar

db4o-8.0-cs-java5.jar

Someadvancedfunctionalitysuchasclustersupport,platform-specificIOadapters,

statistictoolsetccanbeaddedbyincludingdb4ooptionallibrary:

一些高级的功能,例如集群支持,特定于平台的IO适配器,统计工具等也可以通过添加db4o可选包支持。

db4o-8.0-optional-java1.1.jar

db4o-8.0-optional-java1.2.jar

db4o-8.0-optional-java5.jar

Youcanalsogetalloftheaboveinasinglejar:

你也可以通过一个jar包,获得以上所有的功能支持。

db4o-8.0-all-java1.1.jar

db4o-8.0-all-java1.2.jar

db4o-8.0-all-java5.jar

1.2.Installation(安装)

Ifyouaddoneoftheabovedb4o-*.jarfilestoyourCLASSPATHdb4oisinstalled.Forbeginnersitisrecommendedtouse"db4o-all"librarytoavoidconfusionwiththelocationofcertainclasses.IncaseyouworkwithanintegrateddevelopmentenvironmentlikeEclipseyouwouldcopythedb4o-*.jartothe/lib/folderunderyourprojectandadddb4otoyourprojectasalibrary.

只要把上面的db4o-*.jar中的某个添加到CLASSPATH中,就算完成了db4o的安装。初学者建议使用“db4o-all”库,以避免对于某些类的位置混淆。假如你使用像Eclipse这样的IDE,那么就应该把db4o-*.jar复制到项目文件夹中的lib目录下,并把db4o作为一个代码库加到你的项目当中。

1.3.ObjectManagerEnterpriseinstallation(OME)

ObjectManagerEnterprise(OME)isanobjectbrowserfordb4odatabases.OMEinstallationcanbefoundin/omefolderofthedistribution.ThezipfileinthisfoldercontainstheEclipsepluginversionofOME.

OME是db4o数据库的一个对象浏览器,它的安装可以在/ome文件夹下的介绍中找到,这个文件夹下的zip压缩文件包含了Eclipse的OME插件版本。

Toinstalltheplugin,youneedtohaveaversionofEclipse>=3.3installed.Unzipthefiletoafolderofyourchoice.ThenopenEclipse,select'Help'->'SoftwareUpdates...'->'AvailableSoftware'fromthemenu.Choose'AddSite...'->'Local...'andselecttheunzippedfolder.FollowtheEclipseUpdateManagerinstructionsfortheOMEfeaturefromhereon.

插件的安装,你压根安装一个版本在3.3以上的Eclipse,然后把文件解压到你指定的目录,打开Eclipse,在菜单栏选择'Help'->'SoftwareUpdates...'->'AvailableSoftware',选择'AddSite...'->'Local...',然后选择解压的文件,在这里遵循Eclispe对于OME特性的更新管理指令。

TheactualmenustructuremayvaryoverEclipseversions.(TheaboveappliestoEclipse3.4Ganymede.)Whenindoubt,pleaserefertotheEclipsedocumentationonSoftwareUpdates.

Alternatively,youcaninstallthepluginmanuallybysimplycopyingthecontentsofthe'plugins'and'features'foldersfromtheunzippedfoldertothecorrespondingsubfoldersintherootfolderofyourEclipseinstallation.

实际的菜单结构在Eclipse版本可能会有所不同。(以上适用于Eclipse3.4Ganymede)。如果有疑问,请参阅Eclipse文档软件更新。

1.4.APIOverview(API预览)

DonotforgettheAPIdocumentationwhilereadingthroughthistutorial.ItprovidesanorganizedviewoftheAPI,lookingfromajavapackageperspectiveandyoumayfindrelatedfunctionalitytothethemeyouarecurrentlyreadingupon.

Forstarters,thejavapackagescom.db4oandcom.db4o.queryareallthatyouneedtoworryabout.

请在阅读本指南的时候,不要忘记API文档。它从Java包(package)的角度出发提供了有组织的API视图,你可以在阅读本指南的同时使用它方便地找到与主题相关的功能。

首先,com.db4o、com.db4o.query是我们所需要关心的。

com.db4o

Thecom.db4ojavapackagecontainsalmostallofthefunctionalityyouwillcommonlyneedwhenusingdb4o.Twoobjectsofnotearecom.db4o.Db4oEmbedded,andthecom.db4o.ObjectContainerinterface.

com.db4o包含了几乎所有通常所需要用到的功能。其中有两个值得留意的接口:com.db4o.Db4o和com.db4o.ObjectContainer。

Thecom.db4o.Db4ofactoryisyourstartingpoint.Staticmethodsinthisclassallowyoutoopenadatabasefileandcreateaninitialconfiguration.Forclient/serverenvironmentyouwillneedtousecom.db4o.cs.Db4oClientServerfactoryclasstostartaserver,orconnecttoanexistingserver,butthiswillbediscussedlater,startaserver,orconnecttoanexistingserver.Themostimportantinterface,andtheonethatyouwillbeusing99%ofthetimeiscom.db4o.ObjectContainer:Thisisyourdb4odatabase.

而com.db4o.Db4o工厂类是我们进行开发的起始点,该类的静态方法提供了打开数据库文件、创建初始化的配置的功能。对于客户端/服务器的环境,你可能需要用com.db4o.cs.Db4oClientServer工厂类来启动服务或者连接到已有的服务器的功能,这将会稍后讨论。com.db4o.ObjectContainer是一个99%的时间都会用到的、最重要的接口:在开发过程中,它就是你的db4o数据库。

-AnObjectContainercaneitherbeadatabaseinsingle-usermodeoraclientconnectiontoadb4oserver.

-EveryObjectContainerownsonetransaction.Allworkistransactional.WhenyouopenanObjectContainer,youareinatransaction,whenyoucommit()orrollback(),thenexttransactionisstartedimmediately.

-EveryObjectContainermaintainsit'sownreferencestostoredandinstantiatedobjects.Indoingso,itmanagesobjectidentities,andisabletoachieveahighlevelofperformance.

-ObjectContainersareintendedtobekeptopenaslongasyouworkagainstthem.WhenyoucloseanObjectContainer,alldatabasereferencestoobjectsinRAMwillbediscarded.

-ObjectContainer可以作为单用户模式的数据库,也可以作为db4o服务器的客户端连接。

-每个ObjectContainer持有一个事务,所有的操作都是事务相关的。当你打开一个ObjectContainer时,事务已经开始了,当你commit()或者rollback(),它将会马上启动下一个事务。

-每个ObjectContainer会自己管理那些被其存储并实例化的对象的引用。而做这些工作的同时,它还管理这对象的唯一标识,这样是它能够达到很高的性能。

-在使用ObjectContainer的过程中,只要你还在使用它,它就会一直保持打开状态。而当你关闭这个ObjectContainers时,所有保存在内存中的对象引用都将被丢弃掉。

com.db4o.ext

IncaseyouwonderwhyyouonlyseeveryfewmethodsinanObjectContainer,hereiswhy:Thedb4ointerfaceissuppliedintwostepsintwojavapackages,com.db4oandcom.db4o.extforthefollowingreasons:

也许你会问为什么ObjectContainer里面只有那么少的方法,原因是将db4o接口被分别放置在com.db4o和com.db4o.ext这两个包中,这么做是为了:

-It'seasiertogetstarted,becausetheimportantmethodsareemphasized.

-Itwillbeeasierforotherproductstocopythebasicdb4ointerface.

-Itisanexampleofhowalightweightversionofdb4ocouldlook.

-便于快速开始,因为重要的方法都在ObjectContainer中被强调了。

-其他产品更容易复制db4o的基本接口。

-很好地展现了一个db4o的轻量级版本。

Everycom.db4o.ObjectContainerobjectisalsoancom.db4o.ext.ExtObjectContainer.YoucancastittoExtObjectContaineroryoucanusethemethodtogettotheadvancedfeatures.

每个com.db4o.ObjectContainer对象同时也是一个com.db4o.ext.ExtObjectContainer对象。你可以把它转换成ExtObjectContainer,或者可以使用方法来获得更高级的特性。

com.db4o.config

Thecom.db4o.configjavapackagecontainstypesandclassesnecessarytoconfiguredb4o.TheobjectsandinterfaceswithinarediscussedintheConfigurationsection.

com.db4o.config包里面包含了配置db4o所需的类型和类,我们将在配置章节中讨论它的对象和接口。

com.db4o.query

Thecom.db4o.queryjavapackagecontainsthePredicateclasstoconstructNativeQueries.TheNativeQueryinterfaceistheprimarydb4oqueryinginterfaceandshouldbepreferredovertheSodaQueryAPI.

com.db4o.query包中包含了用来构造原生查询的Predicate类。NativeQuery接口是db4o最主要的查询接口,并且它应该比Soda查询API更常用。

db4o_8.0对象数据库官方文档翻译_学习笔记二:

/oceans521/article/details/43194621

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。