Jetspeed學習筆記

來源:互聯網
上載者:User

最近到了portal的開源項目jetspeed網頁中去看了下他的介紹,順便記下了這些jetspeed的學習資料,

 

  Jetspeed初識 學習Jetspeed要求初學者瞭解Apache Maven專案管理工具以及Apache Ant打包指令碼工具。 項目需要如下配置: Ant1.5或者更改版本 Maven1.0.2或者更高 Java1.4.2_02或者更高 Servlet2.4的工作引擎: Tomcat5.5.x Jetty Websphere6.0 Geronimo JBoss Weblogic 擷取Maven 需要在 http://maven.apache.org/網站擷取相應版本的maven 選擇資料庫 Jetspeed的安全模式要求資料庫授權給使用者來擷取使用者的基本資料。這個安全模式要求要求JDBC2.0及以上版本的驅動才能運行。以下的資料庫經測試均可以使用: Derby HSQLDB-Hypersonic SQL MySQL Oracle Postgres DB2 Sybase SQL Server Jetspeed項目預設的部署資料庫配置為Derby。資料庫的選擇將在Jetspeed的安裝過程中確定。如果你不想用Derby資料庫,在安裝過程中你可以選擇其他資料庫。 Servlet引擎 理論上,Jetspeed二代portals能夠運行在任何支援servlet2.4規範的servlet容器中。已經成功部署過Jetspeed二代portal應用程式的servlet引擎有如下幾種: Tomcat5.5.8或者更高 Jetty Websphere Geronimo JBoss Tomcat 配置過程 Jetspeed2可以用Tomcat應用程式管理者來管理portlet應用程式,為了能夠做到這一點,需要Tomcat管理者身份的使用者在${org.apache.jetspeed.server.home}/conf/tomcat-users.xml檔案中進行配置。 參考樣本tomcat-user.xml <tomcat-users>  <role rolename=”manager” /> <user username=”j2deployer” password=”xxxxxx” roles=”manager” />    </tomcat-user> Username與password的屬性值必須符合${org.apache.jetspeed.services.autodeployment.user}以及${org.apache.jetspeed.services.autodeployment.user}中表述的指定值。 Windows Tomcat5.5.9 的部署 為了正確的重新部署以及卸載,在Windows Tomcat5.5.9中,你需要設定全域的Context屬性”antiJARLocking”為true 參考 ${org.apache.jetspeed.server.home}/conf/context.xml 的配置如下: <Context antiJARLocking="true">    ... </Context> Jetty- 一個快速測試環境與產品的Servlet 容器 Jetty用於一個產品的部署,但它更常用於快速測試客戶化,而它本身又沒有妨礙產品的servlet容器。它不需要任何特殊的配置。 從原始碼或者安裝檔案來安裝Jetspeed 你需要選擇一種類型來安裝Jetspeed,要麼是安裝檔案,要麼是附帶有原始碼的檔案,這依賴與你想要做什麼。如果你修改Jetspeed的核心功能或者捐贈Jetspeed的開發項目,你將需要原始碼檔案。如果你僅僅是用它來建立你自己的個人化企業級portal,你可以選擇二進位的發版的Jetspeed。大多數人選擇安裝檔案。 Jetspeed的構建 你的安裝說明將依賴於你是否選擇原始碼檔案或者安裝檔案或者二進位的檔案 Jetspeed-2 的源碼學習 1. 命名習慣與基本規範 源碼基本規範 除非有特殊說明,你應當從Jetspeed目錄中或者從你的個人portal檔案中運行所有的maven構建命令。 另外,在*nix或者windows系統中,你必須以”/”作為檔案的分隔字元。例如:c:/windows,/home 命名習慣 以下是本文檔中一個常用的命名習慣列表。 變數用${some_variable}來表示。這就代表著在Jetspeed中的一種設定或者說在你的環境中的一種表示。屬性檔案則詳細的說明了這些變數的意思。 例如, ${org.apache.jetspeed.server.home}變數要麼表示在一個屬性檔案中更加定義好的屬性或者在構建過程中定義好的變數名,要麼表示Jetspeed中其他的構建檔案定義好的變數名。 ${USER_HOME}:表示使用者的根目錄,在Windows中,這表示c:/Documents and Settins/${username},${username}表示你用來登陸Windows的名字。 ${USER.HOME}在本文中與${USER_HOME}表示同一個意思。 ${CATALINA_HOME}:這是你的tomcat安裝的路徑。例如:c:/tomcat. 原始程式碼控制(SVN) Subversion(SVN)在Jetspeed項目中用於管理原始碼檔案。SVN與CVS類似。對於那些Windows系統而喜歡非命令列的操作使用者來說,我們推薦用TortoiseSVN,它可以外掛程式化到你的Windows瀏覽器當中,而對於那些用EclipseIDE的使用者來說,Subclipse外掛程式可以用於SVN。 Maven的安裝 在這篇文檔中,我們不會討論Maven的細節。然而,有些標準的maven行話我們感覺有必要讓你瞭解些。 在這篇文檔中,當你安裝Maven時,maven/目錄將被建立在你的${USRE_HOME}目錄中,你將看到maven知識庫中的提及的一些內容。 在maven/目錄中,你將看到一個repository目錄,這個目錄是當你運行你的構建檔案命令時,Maven用來來儲存所有下載的jar檔案的。它也是Maven放置你的jar檔案和war檔案的地方。他們將按照目錄式的結構儲存起來,格式化為:jar檔案是${groupId}/${projected}/jars/${projected}-${version}.jar,而war檔案是${groupId}/${projectId}/wars/${projectId}.war。其中${groupId},${projectId}以及${version}變數將在這篇檔案的後面討論。Jar檔案與war檔案也會在你的工程項目/target目錄中建立。 2.Jetspeed 構建與maven-plugin 的屬性 期初,你需要設定幾個屬性: 用Jetspeed2提供的maven-plugin你可以輕鬆的建立你自己的portal。它也用於你從原始碼構建jetspeed項目時。事實上,jetspeed-2構建過程就是一個個性的portal配置和安裝過程。 Jetspeed-2的maven-plugin為大多數的屬性定義了預設的值。當你下載或者校正jetspeed-2的源碼樹時,在根檔案中,你將看到它包含了一個工程的屬性檔案。 不過,有言在先:並不是所有的屬性都提供了一個預設的值,你必須自己指定一些屬性的預設值,當然你也將重新指定一些其他屬性的值。 看一看如下說明,在你的${USER_HOME}/build.properties檔案設定或者重設構建的或者maven-plugin的屬性。 必須設定的portal屬性有:

屬性 描述 預設值
org.apache.jetspeed.portal.home maven-plugin建立或者更新你的portal maven項目結構的檔案夾(with goal j2:portal.conf.project ).它將是你進行性所有portal開發的地方
例如: /home/myportal/
不預設
org.apache.jetspeed.portal.groupId 你的portal項目組的簡稱。這個值用作maven庫檔案夾儲存的位置標識。
例如: myprojects
不預設
org.apache.jetspeed.portal.artifactId 你的portal項目的簡稱,這個值用作portal war檔案的web應用上下文名稱。
例如: myportal
不預設
org.apache.jetspeed.portal.name Portal項目的全名.
這個值用於產生JavaDoc的標題名稱.
例如: My Test Portal
不預設
org.apache.jetspeed.portal.currentVersion 你的portal項目的目前的版本.
這個值用在maven產生的檔案名稱的尾碼.
例如: 1.0
不預設
可選的portal 配置屬性 下面的屬性全是${org.apache.jetspeed.portal.home}所指定的一些子檔案夾,基本定義如下:

屬性 描述 預設值
org.apache.jetspeed.portal.conf.dir The folder where the maven-plugin will generate and copy application server specific configuration files as a tomcat application context descriptor.
This folder and its contents is created or updated by plugin goal j2:portal.conf.tomcat .
target/portal-conf
org.apache.jetspeed.portal.sql.dir The folder where the maven-plugin will generate and copy portal and database server specific sql DDL and DML scripts.
This folder and its contents is always (re)created by plugin goal j2:portal.conf.sql .
target/portal-sql
org.apache.jetspeed.portal.db.dir The folder where the maven-plugin will create its build-in HSQLDB database(s).
This folder and its contents is created or updated by plugin goal j2:start.production.server or j2:start.test.server .
target/portal-db
org.apache.jetspeed.portal.webapp.dir The folder where the maven-plugin will copy the standard jetspeed web application resources.
This folder and its contents is created or updated by plugin goal j2:portal.copy.webapp .
target/${org.apache.jetspeed.portal.artifactId}
org.apache.jetspeed.portal.target.dir The folder where the maven-plugin will generate and copy runtime portal configuration files.
These configuration files contain values derived from build/plugin properties for the portal and OJB.
This folder and its contents is created or updated by plugin goal j2:portal.conf.jetspeed and goal j2:portal.conf.ojb .
target/${org.apache.jetspeed.portal.artifactId}
必須的應用程式伺服器的屬性 注意:maven-plugin 現在只支援Tomcat 伺服器5.0.x 或者5.5.x 。

屬性 描述 預設值
org.apache.jetspeed.server.home The root folder of your Tomcat server installation. Example: ${CATALINA_HOME}/ . 不預設
org.apache.jetspeed.server.shared The location of the shared jars in your Tomcat installation.
Example: ${org.apache.jetspeed.server.home}/shared/lib/
不預設
org.apache.jetspeed.deploy.war.dir The location of web applications in your Tomcat installation.
Example: ${org.apache.jetspeed.server.home}/webapps/
不預設
org.apache.jetspeed.services.autodeployment.user A Tomcat user with the manager role.
Used to access the Tomcat Manager application from within the portal, explained below.
不預設
org.apache.jetspeed.services.autodeployment.password The password of the Tomcat user above.
Used to access the Tomcat Manager application from within the portal, explained below.
不預設
org.apache.jetspeed.catalina.version.major The major version of the Tomcat server you are using: 5 or 5.5
Example: 5.5
不預設
可選的資料庫伺服器的屬性 Jetspeed-2以及它的maven-plugin提供的和用的預設資料庫是HSQLDB,如果你想用一個不同的資料庫的話,你需要覆蓋如下屬性;

屬性 描述 預設值
org.apache.jetspeed.production.database.default.name The type of database you are using. Used for sql script generation with Torque.
Currently supported databases (with corresponding Torque target database name): ·         hsql (hypersonic) ·         oracle (oracle) ·         mysql (mysql) ·         postgres (postresql) ·         mssql (mssql)
hsql
org.apache.jetspeed.production.database.url The jdbc connection url jdbc:hsqldb:hsql://127.0.0.1:9001
org.apache.jetspeed.production.database.user The database user name to connect with. sa
org.apache.jetspeed.production.database.password The database user its password to connect with. empty
org.apache.jetspeed.production.database.driver The jdbc driver class name org.hsqldb.jdbcDriver
org.apache.jetspeed.production.jdbc.drivers.path A Java classpath style path to the jdbc driver classes or jar(s) needed for connecting to the database.
Example: /lib/ojdbc14.jar;/lib/nls_charset12.jar
empty
一個例子:一個微型portal 的配置 必須首先確定在你的${USER_HOME}/build.properties檔案中你已經定義了如上所描寫的必需的屬性。微型的portal配置用了HSQLDB資料庫,它的屬性描述如下: # required portal configuration properties          org.apache.jetspeed.portal.home       = /home/myportal/ org.apache.jetspeed.portal.groupId     = myprojects org.apache.jetspeed.portal.artifactId    = myportal org.apache.jetspeed.portal.name       = My Test Portal org.apache.jetspeed.portal.currentVersion = 1.0   # required application server properties org.apache.jetspeed.server.home     = ${CATALINA_HOME}/ org.apache.jetspeed.server.shared    = ${org.apache.jetspeed.server.home}/shared/lib/ org.apache.jetspeed.deploy.war.dir    = ${org.apache.jetspeed.server.home}/webapps/ org.apache.jetspeed.services.autodeployment.user     = j2deployer org.apache.jetspeed.services.autodeployment.password = xxxxx org.apache.jetspeed.catalina.version.major           =

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.