现在的位置: 首页 > 综合 > 正文

Jetspeed2学习笔记(四)

2013年12月11日 ⁄ 综合 ⁄ 共 3723字 ⁄ 字号 评论关闭
16、 Portal管理
研究portal管理中的【portlet应用生命周期管理】,可以发现,这个portlet是一个普通的GenericServletPortlet,其通过以下代码来获得一些系统的管理器:
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");
//发布
PortletMessaging.publish(request, "site", "selectedUrl", selectedSite);
//销毁
PortletMessaging.cancel(request, "site", "selected");
 
16、 Jetspeed应用中的WEB-INF/jetspeed_macros.vm中包含了所有可以使用的宏
  
 
 
17Jetspeed-layout部署的一些说明:
1、 是最早被部署的portlet应用,控制了整个的布局、装饰管理。
2、 其不是被部署为一个单独的应用,而是被部署到“WEB-INF/apps”目录下了,原因不明。
3、 autodeployment.staging.dir :部署的监听路径
4、 autodeployment.target.dir:部署的目标路径
 
18Jetspeed部署配置文件:WEB-INF/conf/jetspeed.properties
   这个配置文件定义了jetspeed部署服务器的所有规则 ,包括部署用户名和密码(修改它可以解决默认安装部署失败的问题-和tomcat保存一致),默认的装饰(tigris),默认编码格式,默认页面(page)的布局,管理员的电子邮件配置,默认用户等等
 
19Jetspeed部署及其部署管理器:
它被作为Jetspeed的一个子项目来单独开发,其项目路径为:
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也可以通过命令行来单独调用:
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.
其工作模式描述如下,居于线程:

抱歉!评论已关闭.