研究portal管理中的【portlet應(yīng)用生命周期管理】,可以發(fā)現(xiàn),這個(gè)portlet是一個(gè)普通的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);
//應(yīng)用服務(wù)管理器
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");
}
//服務(wù)管理器是否可用,決定于【應(yīng)用管理器】是否可用
serverManagerAvailable = (asm != null && asm.isConnected());
|
其應(yīng)用是在j2-admin應(yīng)用的包:org.apache.jetspeed.portlets.palm中,牽涉到對(duì)portal應(yīng)用的管理,可以參考一下它。
16、 Portal中跨域的session管理用的是PortletMessaging
可以參考SSO管理中對(duì)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應(yīng)用中的WEB-INF/jetspeed_macros.vm中包含了所有可以使用的宏
從
17、Jetspeed-layout部署的一些說明:
1、 是最早被部署的portlet應(yīng)用,控制了整個(gè)的布局、裝飾管理。
2、 其不是被部署為一個(gè)單獨(dú)的應(yīng)用,而是被部署到“WEB-INF\apps”目錄下了,原因不明。
3、 autodeployment.staging.dir :部署的監(jiān)聽路徑
4、 autodeployment.target.dir:部署的目標(biāo)路徑
18、Jetspeed部署配置文件:WEB-INF/conf/jetspeed.properties
這個(gè)配置文件定義了jetspeed部署服務(wù)器的所有規(guī)則 ,包括部署用戶名和密碼(修改它可以解決默認(rèn)安裝部署失敗的問題-和tomcat保存一致),默認(rèn)的裝飾(tigris),默認(rèn)編碼格式,默認(rèn)頁面(page)的布局,管理員的電子郵件配置,默認(rèn)用戶等等
它被作為Jetspeed的一個(gè)子項(xiàng)目來單獨(dú)開發(fā),其項(xiàng)目路徑為:
http://portals./jetspeed-2/multiproject/jetspeed-deploy-tools/deploy-tools.html
JetspeedDeploy and the DeploymentManager
JetspeedDeploy 負(fù)責(zé)Jetspeed-2中portlet應(yīng)用程序的管理. 當(dāng)一個(gè)新的portlet應(yīng)用被注冊時(shí), 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 也可以通過命令行來單獨(dú)調(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.
其工作模式描述如下,居于線程:
|
|