[portal-commits] JBoss Portal SVN: r6091 - in trunk: common/src/main/org/jboss/portal/common/util and 10 other directories.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Wed Jan 24 18:44:25 EST 2007


Author: julien at jboss.com
Date: 2007-01-24 18:44:25 -0500 (Wed, 24 Jan 2007)
New Revision: 6091

Added:
   trunk/common/src/main/org/jboss/portal/common/xml/
   trunk/common/src/main/org/jboss/portal/common/xml/NullEntityResolver.java
   trunk/core/src/resources/portal-core-sar/dtd/
   trunk/core/src/resources/portal-core-sar/dtd/jboss-app_2_6.dtd
   trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
   trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
   trunk/core/src/resources/portal-core-sar/dtd/portlet-instances_2_6.dtd
Removed:
   trunk/core/src/resources/dtd/jboss-app_2_6.dtd
   trunk/core/src/resources/dtd/jboss-portlet_2_6.dtd
   trunk/core/src/resources/dtd/portal-object_2_6.dtd
   trunk/core/src/resources/dtd/portlet-instances_2_6.dtd
Modified:
   trunk/common/src/main/org/jboss/portal/common/util/LoaderResource.java
   trunk/common/src/main/org/jboss/portal/common/util/XML.java
   trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml
   trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java
   trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java
   trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java
   trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeploymentFactory.java
   trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
   trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
   trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
   trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
   trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebApp.java
   trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebAppFactory.java
   trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat4App.java
   trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat5App.java
   trunk/server/src/main/org/jboss/portal/server/deployment/WebAppIntercepter.java
Log:
- added configurable entity resolver service
- inject the entity resolver service in the various deployers
- fix the dtds so they are correct

Modified: trunk/common/src/main/org/jboss/portal/common/util/LoaderResource.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/LoaderResource.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/common/src/main/org/jboss/portal/common/util/LoaderResource.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -114,22 +114,16 @@
       try
       {
          in = Tools.safeBufferedWrapper(asInputStream());
-         Properties props = new Properties();
+         Properties props;
          if (xml)
          {
             DocumentBuilder builder = XML.getDocumentBuilderFactory().newDocumentBuilder();
             Document doc = asDocument(builder);
-            Element propertiesElt = doc.getDocumentElement();
-            for (Iterator i = XML.getChildren(propertiesElt, "entry").iterator(); i.hasNext();)
-            {
-               Element entryElt = (Element)i.next();
-               String key = entryElt.getAttribute("key");
-               String value = XML.asString(entryElt);
-               props.put(key, value);
-            }
+            props = XML.loadXMLProperties(doc);
          }
          else
          {
+            props = new Properties();
             props.load(in);
          }
          log.debug("Finished loading resource: " + location);

Modified: trunk/common/src/main/org/jboss/portal/common/util/XML.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/XML.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/common/src/main/org/jboss/portal/common/util/XML.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -379,4 +379,31 @@
       }
       return result;
    }
+
+   public static Properties loadXMLProperties(Element propertiesElt)
+   {
+      if (propertiesElt == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      Properties props = new Properties();
+      for (Iterator i = XML.getChildren(propertiesElt, "entry").iterator(); i.hasNext();)
+      {
+         Element entryElt = (Element)i.next();
+         String key = entryElt.getAttribute("key");
+         String value = XML.asString(entryElt);
+         props.put(key, value);
+      }
+      return props;
+   }
+
+   public static Properties loadXMLProperties(Document doc)
+   {
+      if (doc == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      return loadXMLProperties(doc.getDocumentElement());
+   }
+
 }

Added: trunk/common/src/main/org/jboss/portal/common/xml/NullEntityResolver.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/xml/NullEntityResolver.java	                        (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/xml/NullEntityResolver.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * 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.                   *
+ ******************************************************************************/
+package org.jboss.portal.common.xml;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NullEntityResolver implements EntityResolver
+{
+   public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
+   {
+      return null;
+   }
+}

Modified: trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -27,6 +27,7 @@
 import org.jboss.portal.common.metadata.MetaData;
 import org.jboss.portal.common.util.Tools;
 import org.jboss.portal.common.util.XML;
+import org.jboss.portal.common.xml.NullEntityResolver;
 import org.jboss.portal.core.model.portal.metadata.PortalObjectMetaData;
 import org.jboss.portal.core.model.portal.metadata.BuildContext;
 import org.jboss.portal.core.model.portal.PortalObject;
@@ -38,6 +39,7 @@
 import org.jboss.portal.server.deployment.jboss.Deployment;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.xml.sax.EntityResolver;
 
 import javax.management.MBeanServer;
 import javax.transaction.TransactionManager;
@@ -108,6 +110,17 @@
          log.debug("Loading portal metadata from " + url);
          in = Tools.safeBufferedWrapper(url.openStream());
          DocumentBuilder builder = XML.getDocumentBuilderFactory().newDocumentBuilder();
+         EntityResolver entityResolver = factory.getPortalObjectEntityResolver();
+         if (entityResolver == null)
+         {
+            log.debug("Coult not obtain entity resolver for " + url);
+            entityResolver = new NullEntityResolver();
+         }
+         else
+         {
+            log.debug("Obtained entity resolver " + entityResolver + " for " + url);
+         }
+         builder.setEntityResolver(entityResolver);
          Document doc = builder.parse(in);
          Element deploymentsElt = doc.getDocumentElement();
 

Modified: trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -29,6 +29,7 @@
 import org.jboss.portal.server.deployment.PortalWebApp;
 import org.jboss.portal.server.deployment.jboss.AbstractDeploymentFactory;
 import org.jboss.portal.server.deployment.jboss.Deployment;
+import org.xml.sax.EntityResolver;
 
 import javax.management.MBeanServer;
 import javax.transaction.TransactionManager;
@@ -54,6 +55,9 @@
    /** . */
    protected ContentHandlerRegistry contentHandlerRegistry;
 
+   /** . */
+   protected EntityResolver portalObjectEntityResolver;
+
    public boolean acceptFile(URL url)
    {
       String urlAsFile = url.getFile();
@@ -74,6 +78,16 @@
       }
    }
 
+   public EntityResolver getPortalObjectEntityResolver()
+   {
+      return portalObjectEntityResolver;
+   }
+
+   public void setPortalObjectEntityResolver(EntityResolver portalObjectEntityResolver)
+   {
+      this.portalObjectEntityResolver = portalObjectEntityResolver;
+   }
+
    public PortalObjectContainer getPortalObjectContainer()
    {
       return portalObjectContainer;

Modified: trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -30,6 +30,7 @@
 import org.jboss.portal.common.util.XML;
 import org.jboss.portal.common.value.StringValue;
 import org.jboss.portal.common.value.Value;
+import org.jboss.portal.common.xml.NullEntityResolver;
 import org.jboss.portal.core.model.instance.metadata.InstanceMetaData;
 import org.jboss.portal.core.model.instance.metadata.PreferencesMetaData;
 import org.jboss.portal.core.metadata.ServiceMetaData;
@@ -50,6 +51,7 @@
 import org.jboss.portal.server.deployment.PortalWebApp;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.xml.sax.EntityResolver;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -143,8 +145,6 @@
       // Read portlet-instances.xml
       try
       {
-         final DocumentBuilder builder = XML.getDocumentBuilderFactory().newDocumentBuilder();
-
          // All the meta data gathered
          final ArrayList metaDataCtxs = new ArrayList();
 
@@ -174,6 +174,7 @@
                      try
                      {
                         in = Tools.safeBufferedWrapper(url.openStream());
+                        DocumentBuilder builder = XML.getDocumentBuilderFactory().newDocumentBuilder();
                         Document doc = builder.parse(in);
                         Element deploymentsElt = doc.getDocumentElement();
                         for (Iterator i = XML.getChildrenIterator(deploymentsElt, "deployment"); i.hasNext();)
@@ -224,6 +225,7 @@
          // Output legacy file on the console
          if (metaDataCtxs.size() > 0)
          {
+            DocumentBuilder builder = XML.getDocumentBuilderFactory().newDocumentBuilder();
             Document doc = builder.newDocument();
             Element deployments = (Element)doc.appendChild(doc.createElement("deployments"));
             for (int i = 0; i < metaDataCtxs.size(); i++)
@@ -248,6 +250,18 @@
             in = Tools.safeBufferedWrapper(pwa.getServletContext().getResourceAsStream("/WEB-INF/portlet-instances.xml"));
             if (in != null)
             {
+               DocumentBuilder builder = XML.getDocumentBuilderFactory().newDocumentBuilder();
+               EntityResolver entityResolver = factory.getPortletInstancesEntityResolver();
+               if (entityResolver == null)
+               {
+                  log.debug("Coult not obtain entity resolver for portlet-instances.xml");
+                  entityResolver = new NullEntityResolver();
+               }
+               else
+               {
+                  log.debug("Obtained entity resolver " + entityResolver + " for portlet-instances.xml");
+               }
+               builder.setEntityResolver(entityResolver);
                Document doc = builder.parse(in);
 
                //

Modified: trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeploymentFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeploymentFactory.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeploymentFactory.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -27,6 +27,7 @@
 import org.jboss.portal.core.model.instance.InstanceContainer;
 import org.jboss.portal.server.deployment.PortalWebApp;
 import org.jboss.portal.server.deployment.jboss.Deployment;
+import org.xml.sax.EntityResolver;
 
 import javax.management.MBeanServer;
 import java.net.URL;
@@ -42,13 +43,26 @@
    protected InstanceContainer instanceContainer;
 
    /** . */
-   private boolean createInstances;
+   protected boolean createInstances;
 
+   /** . */
+   protected EntityResolver portletInstancesEntityResolver;
+
    public Deployment newInstance(URL url, PortalWebApp pwa, MBeanServer mbeanServer) throws DeploymentException
    {
       return new PortletAppDeployment(url, pwa, mbeanServer, this);
    }
 
+   public EntityResolver getPortletInstancesEntityResolver()
+   {
+      return portletInstancesEntityResolver;
+   }
+
+   public void setPortletInstancesEntityResolver(EntityResolver portletInstancesEntityResolver)
+   {
+      this.portletInstancesEntityResolver = portletInstancesEntityResolver;
+   }
+
    public InstanceContainer getInstanceContainer()
    {
       return instanceContainer;

Deleted: trunk/core/src/resources/dtd/jboss-app_2_6.dtd
===================================================================
--- trunk/core/src/resources/dtd/jboss-app_2_6.dtd	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/core/src/resources/dtd/jboss-app_2_6.dtd	2007-01-24 23:44:25 UTC (rev 6091)
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  ~ 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.                  ~
-  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<!--
-<!DOCTYPE jboss-app PUBLIC
-   "-//JBoss Portal//DTD JBoss Web Application 2.6//EN"
-   "http://www.jboss.org/portal/dtd/jboss-app_2_6.dtd">
--->
-
-<!ELEMENT jboss-app (app-name?)>
-
-<!--
-When a web application is deployed, the context path under wich it is deployed is taken as application
-name. The application name value in this descriptor is used to override it. When a component references a
-references a portlet, it needs to reference the application too and if the portlet application war file is renammed
-the reference is not valid anymore. Therefore this tag is used to have an application name that does not depend
-upon the context path under which the application is deployed.
--->
-<!ELEMENT app-name (#PCDATA)>
\ No newline at end of file

Deleted: trunk/core/src/resources/dtd/jboss-portlet_2_6.dtd
===================================================================
--- trunk/core/src/resources/dtd/jboss-portlet_2_6.dtd	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/core/src/resources/dtd/jboss-portlet_2_6.dtd	2007-01-24 23:44:25 UTC (rev 6091)
@@ -1,183 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  ~ 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.                  ~
-  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<!-- The additional configuration elements of the JBoss portlet container.
-
-<!DOCTYPE portlet-app PUBLIC
-   "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
-   "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
--->
-
-<!--
-The remotable element is used to configure the default behavior of the portlets with respect to WSRP
-exposure.
-
-For each portlet defined in portlet.xml, it is possible to configure specific settings
-of the portlet container.
-
-It is also possible to inject services in the portlet context of the application using the service elements.
--->
-<!ELEMENT portlet-app (remotable?,portlet*,service*)>
-
-<!--
-Additional configuration for a portlet.
-
-The portlet-name defines the name of the portlet. It must match a portlet defined already in portlet.xml
-of the same web application.
-
-The remotable element configures the portlet exposure to WSRP. If no value is present then the value considered
-is either the value defined globally at the portlet application level or false.
-
-The trans-attribute value specifies the behavior of the portlet when it is invoked at runtime with
-respect to the transactionnal context. According to how the portlet is invoked a transaction may exist or not
-before the portlet is invoked. Usually in the local context the portal transaction could be present.
-By default the value considered is NotSupported which means that the portal transaction will be suspended
-for the duration of the portlet invocation.
-
-Example :
-
-<portlet>
-   <portlet-name>MyPortlet</portlet-name>
-   <remotable>true</remotable>
-   <trans-attribute>Required</trans-attribute>
-</portlet>
-
--->
-<!ELEMENT portlet (portlet-name,remotable?,session-config?,transaction?,header-content?)>
-
-<!--
-The portlet name.
--->
-<!ELEMENT portlet-name (#PCDATA)>
-
-<!--
-The remotable value is used for WSRP exposure. The accepted values are the litterals true of false.
--->
-<!ELEMENT remotable (#PCDATA)>
-
-<!--
-todo
--->
-<!ELEMENT session-config (distributed)>
-
-<!--
-todo
--->
-<!ELEMENT distributed (#PCDATA)>
-
-<!--
-todo
--->
-<!ELEMENT transaction (trans-attribute)>
-
-<!--
-The trans-attribute value defines the transactionnal behavior. The accepted values are Required,
-Mandatory, Never, Supports, NotSupported and RequiresNew.
--->
-<!ELEMENT trans-attribute (#PCDATA)>
-
-<!--
-Specify content which should be included in the portal aggregated page when the portlet is present
-on that page. This setting only applies when the portlet is used in the local mode.
--->
-<!ELEMENT header-content (link|script|meta)*>
-
-<!--
-todo
--->
-<!ELEMENT link>
-
-<!--
-todo
--->
-<!ATTLIST link
-   rel CDATA #IMPLIED
-   href CDATA #IMPLIED
-   title CDATA #IMPLIED
-   type CDATA #IMPLIED
-   media CDATA #IMPLIED>
-
-<!--
-todo
--->
-<!ELEMENT script>
-
-<!--
-todo
--->
-<!ATTLIST script
-   src CDATA #IMPLIED
-   type CDATA #IMPLIED
-   language CDATA #IMPLIED>
-
-<!--
-todo
--->
-<!ELEMENT meta>
-
-<!--
-todo
--->
-<!ATTLIST meta
-   name CDATA #IMPLIED
-   content CDATA #REQUIRED>
-
-<!--
-Declare a service that will be injected by the portlet container as an attribute of the portlet context.
-
-Example :
-
-<service>
-   <service-name>UserModule</service-name>
-   <service-class>org.jboss.portal.identity.UserModule</service-class>
-   <service-ref>:service=Module,type=User</service-ref>
-</service>
-
-In the portlet it is then possible to use it by doing a lookup on the service name, for example in the
-init() lifecycle method :
-
-public void init()
-{
-   UserModule userModule = (UserModule)getPortletContext().getAttribute("UserModule");
-}
-
--->
-<!ELEMENT service (service-name,service-class,service-ref)>
-
-<!--
-The service name that will be used to bind the service as a portlet context attribute.
--->
-<!ELEMENT service-name (#PCDATA)>
-
-<!--
-The full qualified name of the interface that the service implements.
--->
-<!ELEMENT service-class (#PCDATA)>
-
-<!--
-The reference to the service. In the JMX Microkernel environment it consist of the JMX name of the service MBean.
-For an MBean reference if the domain is left out, then the current domain of the portal will be used.
--->
-<!ELEMENT service-ref (#PCDATA)>

Deleted: trunk/core/src/resources/dtd/portal-object_2_6.dtd
===================================================================
--- trunk/core/src/resources/dtd/portal-object_2_6.dtd	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/core/src/resources/dtd/portal-object_2_6.dtd	2007-01-24 23:44:25 UTC (rev 6091)
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  ~ 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.                  ~
-  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<!--
-<!DOCTYPE deployments PUBLIC
-   "-//JBoss Portal//DTD Portal Object 2.6//EN"
-   "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
--->
-
-<!--
-The deployements element is a container for deployment elements.
--->
-<!ELEMENT deployments (deployment*)>
-
-<!--
-The deployment is a container for an instance element.
--->
-<!ELEMENT deployment (parent-ref,if-exists?,(context|portal|page|window)*)>
-
-<!--
--->
-<!ELEMENT parent-ref #PCDATA>
-
-<!--
--->
-<!ELEMENT if-exists #PCDATA>
-
-<!--
--->
-<!ELEMENT context (context-name,properties?,portal*,listener?,security-constraint?)>
-
-<!--
--->
-<!ELEMENT context-name #PCDATA>
-
-<!--
--->
-<!ELEMENT portal (portal-name,properties?,supported-modes?,supported-window-states?,(page|window)*,listener?,security-constraint?)>
-
-<!--
--->
-<!ELEMENT supported-modes (mode*)>
-
-<!--
--->
-<!ELEMENT mode #PCDATA>
-
-<!--
--->
-<!ELEMENT supported-window-states (window-state*)>
-
-<!--
--->
-<!ELEMENT window-state #PCDATA>
-
-<!--
--->
-<!ELEMENT portal-name #PCDATA>
-
-<!--
--->
-<!ELEMENT page (page-name,properties?,(page|window)*,listener?,security-constraint?)>
-
-<!--
--->
-<!ELEMENT listener #PCDATA>
-
-<!--
--->
-<!ELEMENT page-name #PCDATA>
-
-<!--
--->
-<!ELEMENT window (window-name,(instance-ref|content),properties?,region,height,listener?)>
-
-<!--
--->
-<!ELEMENT window-name #PCDATA>
-
-<!--
--->
-<!ELEMENT instance-ref #PCDATA>
-
-<!--
--->
-<!ELEMENT content (content-type,content-uri)>
-
-<!--
--->
-<!ELEMENT content-type #PCDATA>
-
-<!--
--->
-<!ELEMENT content-uri #PCDATA>
-
-<!--
--->
-<!ELEMENT region #PCDATA>
-
-<!--
--->
-<!ELEMENT height #PCDATA>
-
-<!--
--->
-<!ELEMENT properties (property*)>
-
-<!--
--->
-<!ELEMENT property (name,value)>
-
-<!--
--->
-<!ELEMENT name #PCDATA>
-
-<!--
--->
-<!ELEMENT value #PCDATA>
-
-<!--
--->
-<!ELEMENT security-constraint (policy-permission)>
-
-<!--
--->
-<!ELEMENT policy-permission (action-name*,unchecked?,role-name*)>
-
-<!--
--->
-<!ELEMENT action-name #PCDATA>
-
-<!--
--->
-<!ELEMENT unchecked EMPTY>
-
-<!--
--->
-<!ELEMENT role-name #PCDATA>

Deleted: trunk/core/src/resources/dtd/portlet-instances_2_6.dtd
===================================================================
--- trunk/core/src/resources/dtd/portlet-instances_2_6.dtd	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/core/src/resources/dtd/portlet-instances_2_6.dtd	2007-01-24 23:44:25 UTC (rev 6091)
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  ~ 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.                  ~
-  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<!--
-<!DOCTYPE deployments PUBLIC
-   "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
-   "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
--->
-
-<!--
-The deployements element is a container for deployment elements.
--->
-<!ELEMENT deployments (deployment*)>
-
-<!--
-The deployment is a container for an instance element.
--->
-<!ELEMENT deployment (if-exists?,instance)>
-
-<!--
--->
-<!ELEMENT if-exists #PCDATA>
-
-<!--
-The instance element is used to create an instance of a portlet from the portlet application of the same
-war file containing the portlet-instances.xml file. The portlet will be created and configured only
-if the portlet is present and an instance with such a name does not already exist.
-
-Example :
-
-<instance>
-   <instance-id>MyPortletInstance</instance-id>
-   <portlet-ref>MyPortlet</portlet-ref>
-   <preferences>
-      <preference>
-         <name>abc</name>
-         <value>def</value>
-      </preference>
-   </preferences>
-   <security-constraint>
-      <policy-permission>
-         <role-name>User</role-name>
-         <action-name>view</action-name>
-      </policy-permission>
-   </security-constraint>
-</instance>
-
--->
-<!ELEMENT instance (instance-id,portlet-ref,preferences?security-constraint?)>
-
-<!--
-The identifier of the instance.
--->
-<!ELEMENT instance-id #PCDATA>
-
-<!--
-The reference to the portlet which is its portlet name.
--->
-<!ELEMENT portlet-ref #PCDATA>
-
-<!--
-The preferences element configures the instance with a specific set of preferences.
--->
-<!ELEMENT preferences (preference)>
-
-<!--
-The preference configure one preference of a set of preferences.
--->
-<!ELEMENT preference (name,value)>
-
-<!--
-A name.
--->
-<!ELEMENT name #PCDATA>
-
-<!--
-A string value.
--->
-<!ELEMENT value #PCDATA>
-
-<!--
-todo
--->
-<!ELEMENT security-constraint (policy-permission)>
-
-<!--
-todo
--->
-<!ELEMENT policy-permission (action-name*,unchecked?,role-name*)>
-
-<!--
-todo
--->
-<!ELEMENT action-name #PCDATA>
-
-<!--
-todo
--->
-<!ELEMENT unchecked EMPTY>
-
-<!--
-todo
--->
-<!ELEMENT role-name #PCDATA>

Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml	2007-01-24 23:44:25 UTC (rev 6091)
@@ -34,6 +34,22 @@
       <attribute name="ConfigLocation">conf/config.xml</attribute>
    </mbean>
 
+   <mbean
+      code="org.jboss.portal.server.impl.xml.EntityResolverService"
+      name="portal:service=EntityResolver"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <xmbean/>
+      <attribute name="DTDMapping">
+         <properties>
+            <entry key="-//JBoss Portal//DTD JBoss Portlet 2.6//EN">dtd/jboss-portlet_2_6.dtd</entry>
+            <entry key="-//JBoss Portal//DTD JBoss App 2.6//EN">dtd/jboss-app_2_6.dtd</entry>
+            <entry key="-//JBoss Portal//DTD Portal Object 2.6//EN">dtd/portal-object_2_6.dtd</entry>
+            <entry key="-//JBoss Portal//DTD Portlet Instances 2.6//EN">dtd/portlet-instances_2_6.dtd</entry>
+         </properties>
+      </attribute>
+   </mbean>
+
    <!-- Portal security services-->
    <mbean
       code="org.jboss.portal.security.impl.JBossAuthorizationDomainRegistryImpl"
@@ -978,6 +994,9 @@
       <depends
          optional-attribute-name="ContentHandlerRegistry"
          proxy-type="attribute">portal:container=PortalObject</depends>
+      <depends
+         optional-attribute-name="PortalObjectEntityResolver"
+         proxy-type="attribute">portal:service=EntityResolver</depends>
       <attribute name="SetupLocation">conf/data/default-object.xml</attribute>
       <!-- Set to false in clustered mode, otherwise set to true -->
       <attribute name="RegistrationControlledByService">@portal.single@</attribute>
@@ -1027,6 +1046,12 @@
       <depends
          optional-attribute-name="InstanceContainer"
          proxy-type="attribute">portal:container=Instance</depends>
+      <depends
+         optional-attribute-name="JBossPortletEntityResolver"
+         proxy-type="attribute">portal:service=EntityResolver</depends>
+      <depends
+         optional-attribute-name="PortletInstancesEntityResolver"
+         proxy-type="attribute">portal:service=EntityResolver</depends>
       <attribute name="StandardJBossApplicationMetaDataLocation">conf/standardjboss-portlet.xml</attribute>
       <attribute name="APIFactoryClassName">org.jboss.portlet.JBossAPIFactory</attribute>
       <!-- Set to false in clustered mode, otherwise set to true -->
@@ -1082,6 +1107,9 @@
       <depends
          optional-attribute-name="Deployer"
          proxy-type="attribute">portal:deployer=PortalWebApp</depends>
+      <depends
+         optional-attribute-name="JBossAppEntityResolver"
+         proxy-type="attribute">portal:service=EntityResolver</depends>
    </mbean>
 
    <mbean

Added: trunk/core/src/resources/portal-core-sar/dtd/jboss-app_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/jboss-app_2_6.dtd	                        (rev 0)
+++ trunk/core/src/resources/portal-core-sar/dtd/jboss-app_2_6.dtd	2007-01-24 23:44:25 UTC (rev 6091)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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.                  ~
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!--
+<!DOCTYPE jboss-app PUBLIC
+   "-//JBoss Portal//DTD JBoss Web Application 2.6//EN"
+   "http://www.jboss.org/portal/dtd/jboss-app_2_6.dtd">
+-->
+
+<!ELEMENT jboss-app (app-name?)>
+
+<!--
+When a web application is deployed, the context path under wich it is deployed is taken as application
+name. The application name value in this descriptor is used to override it. When a component references a
+references a portlet, it needs to reference the application too and if the portlet application war file is renammed
+the reference is not valid anymore. Therefore this tag is used to have an application name that does not depend
+upon the context path under which the application is deployed.
+-->
+<!ELEMENT app-name (#PCDATA)>
\ No newline at end of file

Added: trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd	                        (rev 0)
+++ trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd	2007-01-24 23:44:25 UTC (rev 6091)
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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.                  ~
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!-- The additional configuration elements of the JBoss portlet container.
+
+<!DOCTYPE portlet-app PUBLIC
+   "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+   "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+-->
+
+<!--
+The remotable element is used to configure the default behavior of the portlets with respect to WSRP
+exposure.
+
+For each portlet defined in portlet.xml, it is possible to configure specific settings
+of the portlet container.
+
+It is also possible to inject services in the portlet context of the application using the service elements.
+-->
+<!ELEMENT portlet-app (remotable?,portlet*,service*)>
+
+<!--
+Additional configuration for a portlet.
+
+The portlet-name defines the name of the portlet. It must match a portlet defined already in portlet.xml
+of the same web application.
+
+The remotable element configures the portlet exposure to WSRP. If no value is present then the value considered
+is either the value defined globally at the portlet application level or false.
+
+The trans-attribute value specifies the behavior of the portlet when it is invoked at runtime with
+respect to the transactionnal context. According to how the portlet is invoked a transaction may exist or not
+before the portlet is invoked. Usually in the local context the portal transaction could be present.
+By default the value considered is NotSupported which means that the portal transaction will be suspended
+for the duration of the portlet invocation.
+
+Example :
+
+<portlet>
+   <portlet-name>MyPortlet</portlet-name>
+   <remotable>true</remotable>
+   <trans-attribute>Required</trans-attribute>
+</portlet>
+
+-->
+<!ELEMENT portlet (portlet-name,remotable?,session-config?,transaction?,header-content?)>
+
+<!--
+The portlet name.
+-->
+<!ELEMENT portlet-name (#PCDATA)>
+
+<!--
+The remotable value is used for WSRP exposure. The accepted values are the litterals true of false.
+-->
+<!ELEMENT remotable (#PCDATA)>
+
+<!--
+todo
+-->
+<!ELEMENT session-config (distributed)>
+
+<!--
+todo
+-->
+<!ELEMENT distributed (#PCDATA)>
+
+<!--
+todo
+-->
+<!ELEMENT transaction (trans-attribute)>
+
+<!--
+The trans-attribute value defines the transactionnal behavior. The accepted values are Required,
+Mandatory, Never, Supports, NotSupported and RequiresNew.
+-->
+<!ELEMENT trans-attribute (#PCDATA)>
+
+<!--
+Specify content which should be included in the portal aggregated page when the portlet is present
+on that page. This setting only applies when the portlet is used in the local mode.
+-->
+<!ELEMENT header-content (link|script|meta)*>
+
+<!--
+todo + check if ANY cannot be restricted
+-->
+<!ELEMENT link ANY>
+
+<!--
+todo
+-->
+<!ATTLIST link
+   rel CDATA #IMPLIED
+   href CDATA #IMPLIED
+   title CDATA #IMPLIED
+   type CDATA #IMPLIED
+   media CDATA #IMPLIED>
+
+<!--
+todo + check if ANY cannot be restricted
+-->
+<!ELEMENT script ANY>
+
+<!--
+todo
+-->
+<!ATTLIST script
+   src CDATA #IMPLIED
+   type CDATA #IMPLIED
+   language CDATA #IMPLIED>
+
+<!--
+todo + check if ANY cannot be restricted
+-->
+<!ELEMENT meta ANY>
+
+<!--
+todo
+-->
+<!ATTLIST meta
+   name CDATA #IMPLIED
+   content CDATA #REQUIRED>
+
+<!--
+Declare a service that will be injected by the portlet container as an attribute of the portlet context.
+
+Example :
+
+<service>
+   <service-name>UserModule</service-name>
+   <service-class>org.jboss.portal.identity.UserModule</service-class>
+   <service-ref>:service=Module,type=User</service-ref>
+</service>
+
+In the portlet it is then possible to use it by doing a lookup on the service name, for example in the
+init() lifecycle method :
+
+public void init()
+{
+   UserModule userModule = (UserModule)getPortletContext().getAttribute("UserModule");
+}
+
+-->
+<!ELEMENT service (service-name,service-class,service-ref)>
+
+<!--
+The service name that will be used to bind the service as a portlet context attribute.
+-->
+<!ELEMENT service-name (#PCDATA)>
+
+<!--
+The full qualified name of the interface that the service implements.
+-->
+<!ELEMENT service-class (#PCDATA)>
+
+<!--
+The reference to the service. In the JMX Microkernel environment it consist of the JMX name of the service MBean.
+For an MBean reference if the domain is left out, then the current domain of the portal will be used.
+-->
+<!ELEMENT service-ref (#PCDATA)>

Added: trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd	                        (rev 0)
+++ trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd	2007-01-24 23:44:25 UTC (rev 6091)
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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.                  ~
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!--
+<!DOCTYPE deployments PUBLIC
+   "-//JBoss Portal//DTD Portal Object 2.6//EN"
+   "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
+-->
+
+<!--
+The deployements element is a container for deployment elements.
+-->
+<!ELEMENT deployments (deployment*)>
+
+<!--
+The deployment is a container for an instance element.
+-->
+<!ELEMENT deployment (parent-ref,if-exists?,(context|portal|page|window)*)>
+
+<!--
+-->
+<!ELEMENT parent-ref (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT if-exists (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT context (context-name,properties?,portal*,listener?,security-constraint?)>
+
+<!--
+-->
+<!ELEMENT context-name (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT portal (portal-name,properties?,supported-modes?,supported-window-states?,(page|window)*,listener?,security-constraint?)>
+
+<!--
+-->
+<!ELEMENT supported-modes (mode*)>
+
+<!--
+-->
+<!ELEMENT mode (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT supported-window-states (window-state*)>
+
+<!--
+-->
+<!ELEMENT window-state (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT portal-name (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT page (page-name,properties?,(page|window)*,listener?,security-constraint?)>
+
+<!--
+-->
+<!ELEMENT listener (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT page-name (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT window (window-name,(instance-ref|content),properties?,region,height,listener?)>
+
+<!--
+-->
+<!ELEMENT window-name (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT instance-ref (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT content (content-type,content-uri)>
+
+<!--
+-->
+<!ELEMENT content-type (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT content-uri (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT region (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT height (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT properties (property*)>
+
+<!--
+-->
+<!ELEMENT property (name,value)>
+
+<!--
+-->
+<!ELEMENT name (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT value (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT security-constraint (policy-permission)>
+
+<!--
+-->
+<!ELEMENT policy-permission (action-name*,unchecked?,role-name*)>
+
+<!--
+-->
+<!ELEMENT action-name (#PCDATA)>
+
+<!--
+-->
+<!ELEMENT unchecked EMPTY>
+
+<!--
+-->
+<!ELEMENT role-name (#PCDATA)>

Added: trunk/core/src/resources/portal-core-sar/dtd/portlet-instances_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/portlet-instances_2_6.dtd	                        (rev 0)
+++ trunk/core/src/resources/portal-core-sar/dtd/portlet-instances_2_6.dtd	2007-01-24 23:44:25 UTC (rev 6091)
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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.                  ~
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!--
+<!DOCTYPE deployments PUBLIC
+   "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
+   "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
+-->
+
+<!--
+The deployements element is a container for deployment elements.
+-->
+<!ELEMENT deployments (deployment*)>
+
+<!--
+The deployment is a container for an instance element.
+-->
+<!ELEMENT deployment (if-exists?,instance)>
+
+<!--
+-->
+<!ELEMENT if-exists (#PCDATA)>
+
+<!--
+The instance element is used to create an instance of a portlet from the portlet application of the same
+war file containing the portlet-instances.xml file. The portlet will be created and configured only
+if the portlet is present and an instance with such a name does not already exist.
+
+Example :
+
+<instance>
+   <instance-id>MyPortletInstance</instance-id>
+   <portlet-ref>MyPortlet</portlet-ref>
+   <preferences>
+      <preference>
+         <name>abc</name>
+         <value>def</value>
+      </preference>
+   </preferences>
+   <security-constraint>
+      <policy-permission>
+         <role-name>User</role-name>
+         <action-name>view</action-name>
+      </policy-permission>
+   </security-constraint>
+</instance>
+
+-->
+<!ELEMENT instance (instance-id,portlet-ref,preferences?,security-constraint?)>
+
+<!--
+The identifier of the instance.
+-->
+<!ELEMENT instance-id (#PCDATA)>
+
+<!--
+The reference to the portlet which is its portlet name.
+-->
+<!ELEMENT portlet-ref (#PCDATA)>
+
+<!--
+The preferences element configures the instance with a specific set of preferences.
+-->
+<!ELEMENT preferences (preference)>
+
+<!--
+The preference configure one preference of a set of preferences.
+-->
+<!ELEMENT preference (name,value)>
+
+<!--
+A name.
+-->
+<!ELEMENT name (#PCDATA)>
+
+<!--
+A string value.
+-->
+<!ELEMENT value (#PCDATA)>
+
+<!--
+todo
+-->
+<!ELEMENT security-constraint (policy-permission)>
+
+<!--
+todo
+-->
+<!ELEMENT policy-permission (action-name*,unchecked?,role-name*)>
+
+<!--
+todo
+-->
+<!ELEMENT action-name (#PCDATA)>
+
+<!--
+todo
+-->
+<!ELEMENT unchecked EMPTY>
+
+<!--
+todo
+-->
+<!ELEMENT role-name (#PCDATA)>

Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml	2007-01-24 23:44:25 UTC (rev 6091)
@@ -34,6 +34,9 @@
    </portlet>
    <portlet>
       <portlet-name>RolePortlet</portlet-name>
+      <transaction>
+         <trans-attribute>Required</trans-attribute>
+      </transaction>
       <header-content>
          <script type="text/javascript" language="javascript">
             function hideShow(id)
@@ -47,9 +50,6 @@
             }
          </script>
       </header-content>
-      <transaction>
-         <trans-attribute>Required</trans-attribute>
-      </transaction>
    </portlet>
    <portlet>
       <portlet-name>CatalogPortlet</portlet-name>
@@ -59,12 +59,12 @@
    </portlet>
    <portlet>
       <portlet-name>ManagementPortlet</portlet-name>
+      <transaction>
+         <trans-attribute>Required</trans-attribute>
+      </transaction>
       <header-content>
          <link rel="stylesheet" type="text/css" href="/images/management/management.css" title="" media="screen"/>
       </header-content>
-      <transaction>
-         <trans-attribute>Required</trans-attribute>
-      </transaction>
    </portlet>
    <portlet>
       <portlet-name>ConfiguratorPortlet</portlet-name>

Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml	2007-01-24 23:44:25 UTC (rev 6091)
@@ -28,12 +28,12 @@
 <portlet-app>
    <portlet>
       <portlet-name>CMSAdminPortlet</portlet-name>
+      <transaction>
+         <trans-attribute>Required</trans-attribute>
+      </transaction>
       <header-content>
          <link rel="stylesheet" type="text/css" href="/images/cms/admin/style.css" title="" media="screen"/>
       </header-content>
-      <transaction>
-         <trans-attribute>Required</trans-attribute>
-      </transaction>
    </portlet>
    <!-- Service injected in the portlet context. -->
    <service>

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -32,6 +32,7 @@
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
 import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.xml.NullEntityResolver;
 import org.jboss.portal.portlet.container.PortletApplicationContextImpl;
 import org.jboss.portal.portlet.container.PortletApplicationRegistry;
 import org.jboss.portal.portlet.container.PortletContainerAdapter;
@@ -54,6 +55,7 @@
 import org.jboss.portal.server.deployment.jboss.Deployment;
 import org.jboss.xb.binding.Unmarshaller;
 import org.jboss.xb.binding.UnmarshallerFactory;
+import org.xml.sax.EntityResolver;
 
 import javax.management.MBeanServer;
 import javax.servlet.ServletContext;
@@ -368,6 +370,17 @@
             //
             JBossApplicationMetaDataFactory factory = this.factory.createJBossApplicationMetaDataFactory();
             Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+            EntityResolver entityResolver = this.factory.getJBossPortletEntityResolver();
+            if (entityResolver == null)
+            {
+               log.debug("Coult not obtain entity resolver for jboss-portlet.xml");
+               entityResolver = new NullEntityResolver();
+            }
+            else
+            {
+               log.debug("Obtained entity resolver " + entityResolver + " for jboss-portlet.xml");
+            }
+            unmarshaller.setEntityResolver(entityResolver);
             jbossAppMD = (JBossApplicationMetaData)unmarshaller.unmarshal(in, new ValueTrimmingFilter(factory), null);
          }
       }

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -36,6 +36,7 @@
 import org.jboss.portal.server.deployment.jboss.Deployment;
 import org.jboss.xb.binding.Unmarshaller;
 import org.jboss.xb.binding.UnmarshallerFactory;
+import org.xml.sax.EntityResolver;
 
 import javax.management.MBeanServer;
 import java.io.InputStream;
@@ -76,6 +77,19 @@
    /** . */
    protected JBossApplicationMetaData standardJBossApplicationMetaData;
 
+   /** . */
+   protected EntityResolver jbossPortletEntityResolver;
+
+   public EntityResolver getJBossPortletEntityResolver()
+   {
+      return jbossPortletEntityResolver;
+   }
+
+   public void setJBossPortletEntityResolver(EntityResolver jbossPortletEntityResolver)
+   {
+      this.jbossPortletEntityResolver = jbossPortletEntityResolver;
+   }
+
    public ServerConfig getConfig()
    {
       return config;

Modified: trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebApp.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebApp.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebApp.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -25,12 +25,15 @@
 import org.apache.log4j.Logger;
 import org.jboss.portal.common.util.Tools;
 import org.jboss.portal.common.util.XML;
+import org.jboss.portal.common.xml.NullEntityResolver;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
+import org.xml.sax.EntityResolver;
 
 import javax.servlet.ServletContext;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.DocumentBuilder;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -170,7 +173,12 @@
       return done;
    }
 
-   protected final void init(ServletContext servletContext, URL url, ClassLoader loader, String contextPath) throws CannotCreatePortletWebAppException
+   protected final void init(
+      ServletContext servletContext,
+      URL url,
+      ClassLoader loader,
+      String contextPath,
+      EntityResolver jbossAppEntityResolver) throws CannotCreatePortletWebAppException
    {
       this.servletContext = servletContext;
       this.url = url;
@@ -179,7 +187,7 @@
       this.id = contextPath;
 
       //
-      readJBossAppDescriptor();
+      readJBossAppDescriptor(jbossAppEntityResolver);
 
       // Override the id if not null
       if (descriptor != null)
@@ -199,7 +207,7 @@
     *
     * @return the app id or null if it does not exists
     */
-   private void readJBossAppDescriptor()
+   private void readJBossAppDescriptor(EntityResolver jbossAppEntityResolver)
    {
       // Look for jboss-app.xml override
       InputStream in = null;
@@ -208,7 +216,18 @@
          in = Tools.safeBufferedWrapper(getServletContext().getResourceAsStream("/WEB-INF/jboss-app.xml"));
          if (in != null)
          {
-            descriptor = XML.getDocumentBuilderFactory().newDocumentBuilder().parse(in);
+            DocumentBuilder builder = XML.getDocumentBuilderFactory().newDocumentBuilder();
+            if (jbossAppEntityResolver == null)
+            {
+               log.debug("Coult not obtain entity resolver for jboss-app.xml");
+               jbossAppEntityResolver = new NullEntityResolver();
+            }
+            else
+            {
+               log.debug("Obtained entity resolver " + jbossAppEntityResolver + " for jboss-app.xml");
+            }
+            builder.setEntityResolver(jbossAppEntityResolver);
+            descriptor = builder.parse(in);
          }
       }
       catch (IOException e)

Modified: trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebAppFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebAppFactory.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebAppFactory.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -24,6 +24,7 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.web.WebApplication;
+import org.xml.sax.EntityResolver;
 
 import javax.management.MBeanServer;
 import java.lang.reflect.Method;
@@ -59,18 +60,18 @@
     *
     * @return the portal web app or null if it cannot be created.
     */
-   public PortalWebApp create(WebApplication webApp) throws CannotCreatePortletWebAppException
+   public PortalWebApp create(WebApplication webApp, EntityResolver jbossAppEntityResolver) throws CannotCreatePortletWebAppException
    {
       int version = getVersion();
       switch (version)
       {
          case TOMCAT4:
-            return new PortalWebTomcat4App(webApp);
+            return new PortalWebTomcat4App(webApp, jbossAppEntityResolver);
          case TOMCAT5:
-            return new PortalWebTomcat5App(webApp, server);
+            return new PortalWebTomcat5App(webApp, server, jbossAppEntityResolver);
          case TOMCAT6:
             // For now trying to build TC6 with TC5 web app
-            return new PortalWebTomcat5App(webApp, server);
+            return new PortalWebTomcat5App(webApp, server, jbossAppEntityResolver);
          default:
             throw new CannotCreatePortletWebAppException("JBossWeb cannot handle it : " + version);
       }

Modified: trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat4App.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat4App.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat4App.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -24,6 +24,7 @@
 
 import org.jboss.portal.server.servlet.CommandServlet;
 import org.jboss.web.WebApplication;
+import org.xml.sax.EntityResolver;
 
 import javax.servlet.ServletContext;
 import java.lang.reflect.Array;
@@ -43,7 +44,7 @@
 
    private final WebApplication webApp;
 
-   public PortalWebTomcat4App(WebApplication webApp) throws CannotCreatePortletWebAppException
+   public PortalWebTomcat4App(WebApplication webApp, EntityResolver jbossAppEntityResolver) throws CannotCreatePortletWebAppException
    {
       try
       {
@@ -56,7 +57,7 @@
          URL url = webApp.getURL();
 
          //
-         init(servletContext, url, null, contextPath);
+         init(servletContext, url, null, contextPath, jbossAppEntityResolver);
       }
       catch (Exception e)
       {

Modified: trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat5App.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat5App.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat5App.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -25,6 +25,7 @@
 import org.jboss.portal.server.servlet.CommandFilter;
 import org.jboss.portal.server.servlet.CommandServlet;
 import org.jboss.web.WebApplication;
+import org.xml.sax.EntityResolver;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -47,7 +48,7 @@
    private final Object standardContext;
    private final WebApplication webApp;
 
-   public PortalWebTomcat5App(WebApplication webApp, MBeanServer server) throws CannotCreatePortletWebAppException
+   public PortalWebTomcat5App(WebApplication webApp, MBeanServer server, EntityResolver jbossAppEntityResolver) throws CannotCreatePortletWebAppException
    {
       try
       {
@@ -64,7 +65,7 @@
          URL url = webApp.getURL();
 
          //
-         init(servletContext, url, loader, contextPath);
+         init(servletContext, url, loader, contextPath, jbossAppEntityResolver);
       }
       catch (Exception e)
       {

Modified: trunk/server/src/main/org/jboss/portal/server/deployment/WebAppIntercepter.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/deployment/WebAppIntercepter.java	2007-01-24 22:24:36 UTC (rev 6090)
+++ trunk/server/src/main/org/jboss/portal/server/deployment/WebAppIntercepter.java	2007-01-24 23:44:25 UTC (rev 6091)
@@ -26,6 +26,7 @@
 import org.jboss.deployment.SubDeployer;
 import org.jboss.portal.jems.as.system.AbstractJBossService;
 import org.jboss.web.WebApplication;
+import org.xml.sax.EntityResolver;
 
 import javax.management.Notification;
 import javax.management.NotificationListener;
@@ -69,15 +70,25 @@
    /** The right classloader for fixing the issue with the fact that the classloader is not good on event notifications. */
    private ClassLoader classLoader;
 
-   /**
-    *
-    */
+   /** The entity resolver for jboss-app.xml. */
+   private EntityResolver jbossAppEntityResolver;
+
    public WebAppIntercepter()
    {
       deployments = Collections.synchronizedMap(new HashMap());
       classLoader = Thread.currentThread().getContextClassLoader();
    }
 
+   public EntityResolver getJBossAppEntityResolver()
+   {
+      return jbossAppEntityResolver;
+   }
+
+   public void setJBossAppEntityResolver(EntityResolver jbossAppEntityResolver)
+   {
+      this.jbossAppEntityResolver = jbossAppEntityResolver;
+   }
+
    /** Set the deployer on this service. */
    public void setInterceptedDeployer(ObjectName interceptedDeployer)
    {
@@ -143,7 +154,7 @@
             if (start)
             {
                WebApplication webApp = findWebApp(info);
-               PortalWebApp pwa = factory.create(webApp);
+               PortalWebApp pwa = factory.create(webApp, jbossAppEntityResolver);
                deployments.put(keyURL, pwa);
                log.debug("Seen URL " + keyURL + " about to deploy");
                deploy(pwa);
@@ -197,7 +208,7 @@
             URL keyURL = webApp.getDeploymentInfo().url;
             if (!deployments.containsKey(keyURL))
             {
-               PortalWebApp pwa = factory.create(webApp);
+               PortalWebApp pwa = factory.create(webApp, jbossAppEntityResolver);
                deployments.put(keyURL, pwa);
                log.debug("Seen URL " + keyURL + " about to deploy");
                deploy(pwa);




More information about the portal-commits mailing list