Author: julien(a)jboss.com
Date: 2008-04-13 13:33:04 -0400 (Sun, 13 Apr 2008)
New Revision: 10557
Removed:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-app.xml
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/JBossApplicationMetaDataFactory.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossApplicationMetaData.java
Log:
JBPORTAL-1985 : Replace jboss-app.xml with an app-id element in jboss-portlet.xml but keep
jboss-app.xml for legacy
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java 2008-04-13
16:45:00 UTC (rev 10556)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java 2008-04-13
17:33:04 UTC (rev 10557)
@@ -82,6 +82,9 @@
/** . */
private PortletAppDeploymentFactory factory;
+ /** . */
+ private String appId;
+
public PortletAppDeployment(URL url, PortalWebApp pwa,
ManagedObjectRegistryEventListener listener, MBeanServer mbeanServer,
PortletAppDeploymentFactory factory)
{
super(url, pwa, listener, mbeanServer, factory);
@@ -461,7 +464,7 @@
private String resolvePortletRef(String ref)
{
- return "local." + pwa.getId() + "." + ref;
+ return "local." + getAppId() + "." + ref;
}
private class InstanceMetaDataContext
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java 2008-04-13
16:45:00 UTC (rev 10556)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java 2008-04-13
17:33:04 UTC (rev 10557)
@@ -44,6 +44,7 @@
import org.jboss.portal.portlet.impl.jsr168.ContainerInfoBuilderContextImpl;
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
import org.jboss.portal.portlet.info.PortletInfo;
+import org.apache.log4j.Logger;
import java.util.Collection;
import java.util.LinkedHashMap;
@@ -54,19 +55,29 @@
*/
public class CoreInfoBuilder implements InfoBuilder
{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(CoreInfoBuilder.class);
+
+ /** . */
private JBossApplicationMetaData jbossApplicationMetaData;
+ /** . */
private PortletApplication10MetaData portletApplicationMD;
+ /** . */
private CoreInfoBuilderContext builderContext;
+ /** . */
private LinkedHashMap<String, PortletInfo> portlets;
+ /** . */
private ContainerPortletApplicationInfo application;
-
- public CoreInfoBuilder(JBossApplicationMetaData jbossApplicationMetaData,
PortletApplication10MetaData portletApplicationMD,
- CoreInfoBuilderContext builderContext)
+ public CoreInfoBuilder(
+ JBossApplicationMetaData jbossApplicationMetaData,
+ PortletApplication10MetaData portletApplicationMD,
+ CoreInfoBuilderContext builderContext)
{
this.portletApplicationMD = portletApplicationMD;
this.jbossApplicationMetaData = jbossApplicationMetaData;
@@ -86,11 +97,20 @@
public void build()
{
+
//
+ String contextPath = builderContext.getWebApp().getContextPath();
+ String id = jbossApplicationMetaData.getId();
+
+ //
+ log.debug("Going to build portlet application metadata for application with
context path '" + contextPath + "' with id '" + id +
"'");
+
+ //
ContainerInfoBuilderContext containerBuilderContext = new
ContainerInfoBuilderContextImpl(portletApplicationMD, builderContext.getWebApp());
- ContainerInfoBuilder builder = new
ContainerInfoBuilder(builderContext.getWebApp().getContextPath(), portletApplicationMD,
containerBuilderContext);
+ ContainerInfoBuilder builder = new ContainerInfoBuilder(id, portletApplicationMD,
containerBuilderContext);
builder.build();
+ //
this.application = builder.getApplication();
//
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2008-04-13
16:45:00 UTC (rev 10556)
+++
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2008-04-13
17:33:04 UTC (rev 10557)
@@ -40,9 +40,14 @@
It is also possible to inject services in the portlet context of the application
using the service elements.
-->
-<!ELEMENT portlet-app (remotable?,portlet*,service*)>
+<!ELEMENT portlet-app (app-id?, remotable?,portlet*,service*)>
<!--
+The portlet application id that will be used by the portlet container instead of the
context path.
+-->
+<!ELEMENT app-id (#PCDATA)>
+
+<!--
Additional configuration for a portlet.
The portlet-name defines the name of the portlet. It must match a portlet defined
already
Deleted:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-app.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-app.xml 2008-04-13
16:45:00 UTC (rev 10556)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-app.xml 2008-04-13
17:33:04 UTC (rev 10557)
@@ -1,26 +0,0 @@
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<jboss-app>
- <app-name>samples</app-name>
-</jboss-app>
\ No newline at end of file
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml 2008-04-13
16:45:00 UTC (rev 10556)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml 2008-04-13
17:33:04 UTC (rev 10557)
@@ -26,6 +26,7 @@
"http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
<portlet-app>
+ <app-id>samples</app-id>
<remotable>true</remotable>
<portlet>
<portlet-name>PortletSessionPortlet</portlet-name>
Modified:
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/JBossApplicationMetaDataFactory.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/JBossApplicationMetaDataFactory.java 2008-04-13
16:45:00 UTC (rev 10556)
+++
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/JBossApplicationMetaDataFactory.java 2008-04-13
17:33:04 UTC (rev 10557)
@@ -141,8 +141,12 @@
if (object instanceof JBossApplicationMetaData)
{
JBossApplicationMetaData app = (JBossApplicationMetaData)object;
- if ("remotable".equals(localName))
+ if ("app-id".equals(localName))
{
+ app.setId(value);
+ }
+ else if ("remotable".equals(localName))
+ {
if ("true".equalsIgnoreCase(value))
{
app.setRemotable(Boolean.TRUE);
Modified:
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2008-04-13
16:45:00 UTC (rev 10556)
+++
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2008-04-13
17:33:04 UTC (rev 10557)
@@ -85,8 +85,12 @@
/** . */
private PortletApplicationLifeCycle portletApplicationLifeCycle;
+ /** . */
private ManagedObjectRegistryEventListener listener;
+ /** . */
+ private String appId;
+
public PortletAppDeployment(URL url, PortalWebApp pwa,
ManagedObjectRegistryEventListener listener, MBeanServer mbeanServer,
PortletAppDeploymentFactory factory)
{
super(url, pwa, mbeanServer);
@@ -104,6 +108,16 @@
portletAppMD = buildPortletApplicationMetaData();
jbossAppMD = buildJBossApplicationMetaData();
+ //
+ if (jbossAppMD.getId() == null)
+ {
+ log.debug("The portlet application does not have an explicit id value,
will use the value provided by the jboss-app.xml instead");
+ jbossAppMD.setId(pwa.getId());
+ }
+
+ //
+ appId = jbossAppMD.getId();
+
// Merge or provide defaults
JBossApplicationMetaData standardJBossAppMD =
factory.getStandardJBossApplicationMetaData();
if (standardJBossAppMD != null)
@@ -405,4 +419,9 @@
}
return jbossAppMD;
}
+
+ public String getAppId()
+ {
+ return appId;
+ }
}
Modified:
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossApplicationMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossApplicationMetaData.java 2008-04-13
16:45:00 UTC (rev 10556)
+++
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossApplicationMetaData.java 2008-04-13
17:33:04 UTC (rev 10557)
@@ -35,6 +35,9 @@
/** . */
protected Boolean remotable;
+ /** The application id that overrides the context path. */
+ protected String id;
+
/** . */
protected Map<String, JBossPortletMetaData> portlets;
@@ -57,4 +60,14 @@
{
this.remotable = remotable;
}
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
}