領先一步
VMware 提供培訓和認證,以加速您的進展。
了解更多dm Server 2.0 的開發工作已經全面展開一段時間了,我很高興地宣佈第一個里程碑版本已經可以下載。您可以從我們的首頁下載。您可以在我的上一篇文章中找到關於此版本和即將發佈版本的功能的更多資訊。
在這篇部落格文章中,我將概述
為了 2.0 版本的開發,dm Server 團隊採用了 Scrum。您可以在我們的 JIRA 中看到我們當前的 sprint 和發佈 backlogs。一如既往,dm Server 的開發是由我們使用者的需求所驅動。如果您看到 backlog 中有您希望我們實作的項目,請花時間投票支持它。同樣地,如果您希望 dm Server 能夠執行目前 backlog 中未涵蓋的功能,請開啟一個新的使用者故事來描述您希望能夠做什麼。
Plan 檔案的語法非常簡單。最外層的 <plan/> 標籤定義了 name 和 version,以及 scoping 和 atomicity 需求。(對於這個里程碑,僅支援 scoped 和 atomic 的 Plans)。在
<?xml version="1.0" encoding="UTF-8"?>
<plan name="multi-artifact.plan" version="1.0.0" scoped="true" atomic="true"
xmlns="http://www.springsource.org/schema/dm-server/plan"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springsource.org/schema/dm-server/plan
http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
<artifact type="bundle" name="simple.bundle.one" version="[1.0.0, 2.0.0)"/>
<artifact type="bundle" name="simple.bundle.two" version="[1.0.0, 2.0.0)"/>
</plan>
要使用 plan,請將組成 plan 的 bundles 複製到 $DMS_HOME/repository/bundles/usr 目錄,並重新啟動 dm Server。伺服器啟動後,將 plan 檔案(具有 .plan 檔案擴展名)放入 $DMS_HOME/pickup 目錄。這將導致 plan 以與 PAR 檔案相同的語義進行部署。從 pickup 目錄中刪除 plan 檔案將導致 plan 取消部署。
M1 包含對 Cloning 支援的第一階段。請參閱roadmap 以取得 Cloning 的概觀。
仍然有很多使用者故事需要實作,並且有一些問題需要解決,但是支援 Cloning 的大部分基礎架構已經到位,並且通過了基本測試。
當 scoped 應用程式(即 PAR 檔案或 scoped plan)由於 uses constraint 而無法解析時,會自動觸發 Cloning。指定失敗 uses constraint 的 bundle 會被 cloned 到應用程式的 scope 中,然後嘗試進行解析,並且這個過程會重複,直到解析成功或沒有更多 candidate bundles 可供 clone,在這種情況下,應用程式的部署會失敗。
也可以使用新的 "sharing" 指令在 import-bundle 或 import-library 上手動觸發 Cloning。例如
Import-Bundle: org.foo.mybundle;sharing:=clone
或
Import-Library: org.springframework.spring;sharing:=clone
如果自動或手動 Cloning 導致 Spring DM extender 的任何 dependencies 被 clone,則該 extender 也會被 clone 到應用程式的 scope 中。一些直接處理 Spring 和 Spring DM 類型的 dm Server 代碼需要進行修改,以應對 Spring bundles 被 clone 的情況。在某些情況下,使用這些類型的程式碼被打包到小型 bundles 中,然後被 clone。在其他情況下,程式碼被更改為透過基於 OSGi blueprint service 草案的(非 cloned)介面來調度到這些類型。
M1 包含對 shared repository 支援的第一階段。可以透過確保 hosted repository PAR 檔案位於 pickup 目錄中,並且 config/hostedRepository.config 中的配置是適當的,來配置 dm Server 節點以 host shared repository。例如
{
"my-hosted-repo" : {
"type" : "external",
"searchPattern" : "repository/hosted/*"
}
}
這個配置將建立一個名為 my-hosted-repo 的 hosted repository,它將 populated with the contents of the repository/hosted directory。然後,可以透過更新其 config/repository.config 檔案以新增 remote repository 條目,來配置 dm Server 節點以存取這個 hosted repository。例如,假設 hosted repository 節點正在 my-host 上執行,並且它已配置 Tomcat 以監聽 8080 端口
{
...
"remote-repo" : {
"type" : "remote",
"uri" : "http://my-host:8080/com.springsource.server.repository/my-hosted-repo",
"indexRefreshInterval" : 30,
},
"repositoryChain" : [
"bundles-subsystems",
"bundles-ext",
"bundles-usr",
"libraries-ext",
"libraries-usr",
"remote-repo"
]
}
Shared repositories 以及 dm Server 2.0 的 repository 支援通常將在後續的部落格文章中進行更詳細的描述。
為了更好地反映 dm Server 的模組化特性,我們將 dm Server codebase 分割成許多新的 Subversion repositories,現在可以公開存取
Repository URL | 內容 |
---|---|
https://anonsvn.springsource.org/svn/dm-server-util | 通用 utility 程式碼 |
https://anonsvn.springsource.org/svn/dm-server-repository | Artifact repository |
https://anonsvn.springsource.org/svn/dm-server-osgi | OSGi 擴展和 Equinox hooks |
https://anonsvn.springsource.org/svn/dm-server-kernel | dm Kernel |
https://anonsvn.springsource.org/svn/dm-server-servlet | Servlet subsystem |
https://anonsvn.springsource.org/svn/dm-server-web | Web subsystem |
https://anonsvn.springsource.org/svn/dm-server | Packaging |
https://anonsvn.springsource.org/svn/dm-server-documentation | Documentation |
每個 repository 都分為一個通用的文件夾結構,repository 的根目錄下有三個目錄。讓我們看看 kernel 的 repository 作為一個例子
svn ls https://anonsvn.springsource.org/svn/dm-server-kernel
development-branches/
main-branches/
tags/
main-branches 和 tags 目錄是最令人感興趣的。tags 目錄包含 kernel 的每個 tagged release 的目錄,例如,它目前包含 M1 release 的單個標籤。main-branches 目錄包含每個 main branch 的目錄,也就是我們目前正在處理的 release。2.0 release 的代號是 Jersey(以島嶼命名),正如您在下面看到的,main-branches 目錄包含 jersey (2.0) release 的目錄
svn ls https://anonsvn.springsource.org/svn/dm-server-kernel/main-branches
jersey/
如果您只是想建立一個 dm Server 安裝 binary,最簡單的方法是 package 現有的 binaries。或者,如果您有興趣修改或新增到 dm Server codebase,也可以從原始碼編譯所有 dm Server codebase 並將它們 package 到安裝 binary 中。
在您可以從原始碼建置 dm Server 之前,需要在您的機器上完成以下設定
完成此設定後,您就可以建置 dm Server。
Packaging 現有的已發佈 binaries 很簡單。只需 checkout packaging repository
svn co https://anonsvn.springsource.org/svn/dm-server/tags/2.0.0.M1
然後移動到 build-dm-server 目錄並使用 Ant 執行 jar 和 package targets
cd 2.0.0.M1/build-dm-server
ant jar package
建置將下載包含 dm Server 2.0.0.M1 release 的所有 bundles 並將它們 package 到安裝 binary 中。您可以在 target/artifacts 目錄中找到這個 binary。
要完全從原始碼建置 dm Server,您必須 checkout 更多 repositories,以便您的機器上擁有整個 codebase。將各種 repositories checkout 到的目錄的名稱及其相對於彼此的位置非常重要,因此請使用下面顯示的目錄名稱並從同一個目錄執行所有 checkouts
svn co https://anonsvn.springsource.org/svn/dm-server-util/main-branches/jersey util
svn co https://anonsvn.springsource.org/svn/dm-server-repository/main-branches/jersey repository
svn co https://anonsvn.springsource.org/svn/dm-server-osgi/main-branches/jersey osgi-extensions
svn co https://anonsvn.springsource.org/svn/dm-server-kernel/main-branches/jersey kernel
svn co https://anonsvn.springsource.org/svn/dm-server-servlet/main-branches/jersey servlet
svn co https://anonsvn.springsource.org/svn/dm-server-web/main-branches/jersey web
svn co https://anonsvn.springsource.org/svn/dm-server-documentation/main-branches/jersey documentation
svn co https://anonsvn.springsource.org/svn/dm-server/main-branches/jersey packaging
接下來,移動到 packaging/build-dm-server 目錄
cd packaging/build-dm-server
現在執行 src-build Ant target
ant src-build
建置完成後,可以在 target/artifacts 中找到一個 timestamped dm Server 安裝 binary,形式為 zip 檔案。它的名稱將採用 springsource-dm-server-2.0.0.BUILD-