You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by sg...@apache.org on 2001/03/29 08:10:31 UTC
cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/factory PortletFactory.java
sgala 01/03/28 22:10:31
Modified: src/java/org/apache/jetspeed/portal/factory
PortletFactory.java
Log:
Solving a couple problems with portlet instantiation
Revision Changes Path
1.116 +44 -33 jakarta-jetspeed/src/java/org/apache/jetspeed/portal/factory/PortletFactory.java
Index: PortletFactory.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/factory/PortletFactory.java,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -r1.115 -r1.116
--- PortletFactory.java 2001/03/07 06:46:36 1.115
+++ PortletFactory.java 2001/03/29 06:10:31 1.116
@@ -86,7 +86,8 @@
@author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
@author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
-@version $Id: PortletFactory.java,v 1.115 2001/03/07 06:46:36 taylor Exp $
+@author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
+@version $Id: PortletFactory.java,v 1.116 2001/03/29 06:10:31 sgala Exp $
*/
public class PortletFactory {
@@ -115,7 +116,7 @@
PortletConfig pc = PortletConfigFactory.getPortletConfig( regEntry );
// merge the parameters between Registry and Portlets
- pc.setInitParameters(
+ pc.addInitParameters(
ParametersFactory.getParameters( entry,
pc.getInitParameters() ) );
@@ -304,47 +305,56 @@
throw new PortletException( "Abstract entries can not be instantiated -> " + entry.getName() );
}
-
- if ( classname == null ) {
- classname = entry.getClassname();
- }
- if ( pc.getURL() == null ) {
- pc.setURL( entry.getURL() );
- }
+ //here
+ org.apache.jetspeed.om.registry.peer.PortletEntry parent = entry;
+ while ( parent != null &&
+ (classname == null ||
+ pc.getURL() == null ||
+ pc.getCapabilityMap() == null
+ ) )
+ {
+ classname = parent.getClassname();
-
- if ( entry.getCapabilityMap() != null &&
+ if ( pc.getURL() == null ) {
+ pc.setURL( parent.getURL() );
+ }
- pc.getCapabilityMap() == null ) {
-
- //update the CapabilityMap within the PortletConfig
- pc.setCapabilityMap( entry.getCapabilityMap() );
-
- } else {
-
- pc.setCapabilityMap( new PortletCapabilityMap() );
+ if ( parent.getCapabilityMap() != null &&
+ pc.getCapabilityMap() == null ) {
+ //update the CapabilityMap within the PortletConfig
+ pc.setCapabilityMap( parent.getCapabilityMap() );
+ }
- }
+ //Keep on looking in the parent entry
+ if( parent.getParent() == null ) {
+ // To stop the while loop
+ parent = null;
+ } else {
+ parent = (org.apache.jetspeed.om.registry.peer.PortletEntry)
+ RegistryManager.getEntry( RegistryManager.PORTLET_REGISTRY,
+ parent.getParent() );
+ }
+ }
- // HACK, FIX ME: Even though the parameters are empty,
- // don't delete the "old" parameters but ADD the "new" ones
- pc.setInitParameters( ParametersFactory.getParameters( entry ) );
+ // Merge parameters. It will overwrite parameters
+ // already in portletConfig with parameters in entry, augmented
+ // with other parameters up all the chain
+ // or parent portlets.
+ pc.addInitParameters( ParametersFactory.getParameters( entry,
+ pc.getInitParameters() ) );
+
+ if ( pc.getCapabilityMap() == null )
+ {
+ pc.setCapabilityMap( new PortletCapabilityMap() );
+ }
+
+
-/*
- //make sure that no one tries to instantiate a portlet with a file URL
- if ( pc.getURL() != null && pc.getURL().indexOf( "file:" ) == 0 ) { //SGP stripper one /
-
- String message = "Local URLs not served through HTTP to prevent security holes: " + pc.getURL();
- Log.error( message );
- throw new PortletException( message );
-
- }
-*/
//BEGIN ARGUMENT VALIDATION
/*
@@ -462,6 +472,7 @@
return portlet;
}
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org