From 5a21a67c5d63fc2930e4dce73734111948532330 Mon Sep 17 00:00:00 2001 From: Carsten Ziegeler Date: Sat, 5 Aug 2006 17:57:14 +0000 Subject: [PATCH] Fix initialization problem and add missing component git-svn-id: https://svn.apache.org/repos/asf/cocoon/trunk@429018 13f79535-47bb-0310-9956-ffa450edef68 --- .../layout/impl/DefaultLayoutFactory.java | 30 ++++--------------- .../om/PortletDefinitionRegistryImpl.java | 4 ++- .../COB-INF/profiles/coplettype/portal.xml | 7 ++++- 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java b/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java index 31acc78dfa4..6a740e0f9c5 100644 --- a/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java +++ b/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java @@ -111,8 +111,6 @@ public class DefaultLayoutFactory protected final Map layouts = new HashMap(); - protected Configuration[] layoutsConf; - protected static long idCounter = System.currentTimeMillis(); /** @@ -153,7 +151,6 @@ protected void configureLayout(Configuration layoutConf) } else { throw new ConfigurationException("Default renderer '" + defaultRenderer + "' is not configured for layout '" + type + "'"); } - this.layouts.put(desc.getType(), desc); } @@ -162,24 +159,12 @@ protected void configureLayout(Configuration layoutConf) */ public void configure(Configuration configuration) throws ConfigurationException { - this.layoutsConf = configuration.getChild("layouts").getChildren("layout"); - } - - protected void init() { - // FIXME when we switch to another container we can remove - // the lazy evaluation - if ( this.layoutsConf != null ) { - synchronized (this) { - if ( this.layoutsConf != null ) { - for(int i=0; i < layoutsConf.length; i++ ) { - try { - this.configureLayout( layoutsConf[i] ); - } catch (ConfigurationException ce) { - throw new PortalRuntimeException("Unable to configure layout.", ce); - } - } - this.layoutsConf = null; - } + final Configuration[] layoutsConf = configuration.getChild("layouts").getChildren("layout"); + for(int i=0; i < layoutsConf.length; i++ ) { + try { + this.configureLayout( layoutsConf[i] ); + } catch (ConfigurationException ce) { + throw new PortalRuntimeException("Unable to configure layout.", ce); } } } @@ -197,8 +182,6 @@ public Layout newInstance(String layoutType) */ public Layout newInstance(String layoutType, String id) throws LayoutException { - this.init(); - LayoutDescription layoutDescription = (LayoutDescription)this.layouts.get( layoutType ); if ( layoutDescription == null ) { @@ -240,7 +223,6 @@ public void inform(RemoveLayoutEvent event, PortalService service) { */ public void remove(Layout layout) { if ( layout != null ) { - this.init(); if ( layout instanceof CompositeLayout ) { final CompositeLayout cl = (CompositeLayout)layout; while ( cl.getItems().size() > 0 ) { diff --git a/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java b/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java index a50895f3caa..1932da10b6e 100644 --- a/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java +++ b/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java @@ -50,6 +50,7 @@ import org.apache.cocoon.portal.impl.AbstractComponent; import org.apache.cocoon.portal.pluto.deployment.Deployer; import org.apache.cocoon.portal.pluto.deployment.WebApplicationRewriter; +import org.apache.commons.lang.StringUtils; import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceResolver; import org.apache.excalibur.xml.EntityResolver; @@ -511,7 +512,8 @@ protected void load(InputSource portletXml, // TODO - parse coplet.xml if available final CopletType cbd = pcm.getProfileManager().getCopletType(this.copletBaseDataName); // TODO - check portletId for invalid characters! - final CopletDefinition cd = pcm.getCopletFactory().newInstance(cbd, portlet.getId().toString()); + final String defId = StringUtils.replaceChars(portlet.getId().toString(), '.', '_'); + final CopletDefinition cd = pcm.getCopletFactory().newInstance(cbd, defId); cd.setAttribute("portlet", portlet.getId().toString()); cd.setAttribute("buffer", Boolean.TRUE); if ( this.getLogger().isInfoEnabled() ) { diff --git a/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/coplettype/portal.xml b/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/coplettype/portal.xml index 5f74c6572f9..e0149aba094 100644 --- a/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/coplettype/portal.xml +++ b/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/coplettype/portal.xml @@ -14,14 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. --> - + + uri portlet + + buffer + true + full-screen false