16、 Portal管理
研究portal管理中的【portlet應用生命周期管理】,可以發(fā)現(xiàn),這個portlet是一個普通的GenericServletPortlet,其通過以下代碼來獲得一些系統(tǒng)的管理器:
PortletContext context = getPortletContext();
//注冊管理器
registry = (PortletRegistry)context.getAttribute(CommonPortletServices.CPS_REGISTRY_COMPO
NENT);
//portlet工廠管理器
portletFactory = (PortletFactory)context.getAttribute(CommonPortletServices.CPS_PORTLET_FAC
TORY_COMPONENT);
//部署管理器
dm = (DeploymentManager)context.getAttribute(CommonPortletServices.CPS_DEPLOYMENT_
MANAGER_COMPONENT);
asm = (ApplicationServerManager)context.getAttribute(CommonPortletServices.CPS_APPLICATION_ SERVER_MANAGER_COMPONENT);
//應用服務管理器
if (null == registry) {
throw new PortletException("Failed to find the Portlet Registry on portlet initialization");
}
if (null == portletFactory) {
throw new PortletException("Failed to find the Portlet Factory on portlet initialization");
}
//服務管理器是否可用,決定于【應用管理器】是否可用
serverManagerAvailable = (asm != null && asm.isConnected());
其應用是在j2-admin應用的包:org.apache.jetspeed.portlets.palm中,牽涉到對portal應用的管理,可以參考一下它。
16、 Portal中跨域的session管理用的是PortletMessaging
可以參考SSO管理中對PortletMessaging的使用:
//接收
String realm = (String)PortletMessaging.receive(request, "site", "realm");
//
StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, "SSOBrowser", "status");
//發(fā)布
PortletMessaging.publish(request, "site", "selectedUrl", selectedSite);
//銷毀
PortletMessaging.cancel(request, "site", "selected");
16、 Jetspeed應用中的WEB-INF/jetspeed_macros.vm中包含了所有可以使用的宏
從
17、Jetspeed-layout部署的一些說明:
1、 是最早被部署的portlet應用,控制了整個的布局、裝飾管理。
2、 其不是被部署為一個單獨的應用,而是被部署到“WEB-INF\apps”目錄下了,原因不明。
3、 autodeployment.staging.dir :部署的監(jiān)聽路徑
4、 autodeployment.target.dir:部署的目標路徑
18、Jetspeed部署配置文件:WEB-INF/conf/jetspeed.properties
這個配置文件定義了jetspeed部署服務器的所有規(guī)則 ,包括部署用戶名和密碼(修改它可以解決默認安裝部署失敗的問題-和tomcat保存一致),默認的裝飾(tigris),默認編碼格式,默認頁面(page)的布局,管理員的電子郵件配置,默認用戶等等
19、Jetspeed部署及其部署管理器:
它被作為Jetspeed的一個子項目來單獨開發(fā),其項目路徑為:
http://portals.apache.org/jetspeed-2/multiproject/jetspeed-deploy-tools/deploy-tools.html
JetspeedDeploy and the DeploymentManager
JetspeedDeploy負責Jetspeed-2中portlet應用程序的管理. 當一個新的portlet應用被注冊時, the DeployPortletAppEventListener invokes JetspeedDeploy to prepare the portlet application for deployment.
new JetspeedDeploy(event.getPath(), toFile.getAbsolutePath(), stripLoggers); JetspeedDeploy copies the web application archives (.war) from the input directory to the output directory and parses the web.xml, portlet.xml, and context.xml to ensure their compliance with the Jetspeed-2 portal engine.
JetspeedDeploy invokes the JetspeedWebApplicationRewriter to infuse the web.xml with the JetspeedContainer servlet if it does not already exist:
<servlet> <servlet-name>JetspeedContainer</servlet-name> <display-name>Jetspeed Container</display-name> <description>MVC Servlet for Jetspeed Portlet Applications</description> <servlet-class>org.apache.jetspeed.container.JetspeedContainerServlet</servlet-class> <init-param> <param-name>contextName</param-name> <param-value>${portlet-application-name}</param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> ... <servlet-mapping> <servlet-name>JetspeedContainer</servlet-name> <url-pattern>/container/*</url-pattern> </servlet-mapping>
In the same fashion, the JetspeedDeploy invokes the JetspeedContextRewriter to manipulate a portlet application context.xml file. For more information about Tomcat context.xml, see
tomcat‘s documentation.
JetspeedDeploy Standalone Usage
JetspeedDeploy也可以通過命令行來單獨調(diào)用:
java -jar jetspeed-deploy-tools-<version>.jar -s inputWarPath outputWarPath
說明:
-s: flag indicating whether or not to strip to loggers from the application. When the flag is present, the loggers available in the application will be removed. inputWarPath: the path of the war to process. outputWarPath: the path of the processed war.
其工作模式描述如下,居于線程: