taylor 2004/07/06 16:32:18
Modified: portal/src/java/org/apache/jetspeed/util/descriptor
PortletApplicationWar.java
Log:
If a portlet is going to make use of a CPS, it must declare it
Here we validate the CPS upon deployment
completed JS2-70 -- Support service definitions in Jetspeed portlet descriptor
this commit completes step 2, validation
http://nagoya.apache.org/jira/browse/JS2-70
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.11 +25 -3
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/util/descriptor/PortletApplicationWar.java
Index: PortletApplicationWar.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/util/descriptor/PortletApplicationWar.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- PortletApplicationWar.java 6 Jul 2004 16:56:19 -0000 1.10
+++ PortletApplicationWar.java 6 Jul 2004 23:32:18 -0000 1.11
@@ -39,8 +39,11 @@
import org.apache.commons.vfs.FileSystemManager;
import org.apache.commons.vfs.FileType;
import org.apache.commons.vfs.impl.VFSClassLoader;
+import org.apache.jetspeed.om.common.JetspeedServiceReference;
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
import org.apache.jetspeed.om.common.servlet.MutableWebApplication;
+import org.apache.jetspeed.services.JetspeedPortletServices;
+import org.apache.jetspeed.services.PortletServices;
import org.apache.jetspeed.tools.pamanager.PortletApplicationException;
import org.apache.pluto.om.common.SecurityRoleRef;
import org.apache.pluto.om.common.SecurityRoleRefSet;
@@ -232,19 +235,31 @@
public MutablePortletApplication createPortletApp() throws
PortletApplicationException, IOException
{
Reader portletXmlReader = getReader(PORTLET_XML_PATH);
+ PortletServices cps = JetspeedPortletServices.getSingleton();
+
try
{
PortletApplicationDescriptor paDescriptor = new
PortletApplicationDescriptor(portletXmlReader, paName);
portletApp = paDescriptor.createPortletApplication();
// validate(portletApplication);
-
+ Reader extMetaDataXml = null;
try
{
- Reader extMetaDataXml = getReader(EXTENDED_PORTLET_XML_PATH);
+ extMetaDataXml = getReader(EXTENDED_PORTLET_XML_PATH);
if (extMetaDataXml != null)
{
ExtendedPortletMetadata extMetaData = new
ExtendedPortletMetadata(extMetaDataXml, portletApp);
extMetaData.load();
+ // validate services
+ Iterator services =
extMetaData.portletApp.getJetspeedServices().iterator();
+ while (services.hasNext())
+ {
+ JetspeedServiceReference jsr =
(JetspeedServiceReference)services.next();
+ if (null == cps.getService(jsr.getName()))
+ {
+ throw new PortletApplicationException("Invalid Portlet
Service Requested: " + jsr.getName());
+ }
+ }
}
}
catch (IOException e)
@@ -254,6 +269,13 @@
catch (MetaDataException e)
{
log.warn("Failed to load existing metadata. " + e.toString(), e);
+ }
+ finally
+ {
+ if (null != extMetaDataXml)
+ {
+ extMetaDataXml.close();
+ }
}
return portletApp;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]