Skip to content

Commit

Permalink
Fix initialization problem and add missing component
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/cocoon/trunk@429018 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
cziegeler committed Aug 5, 2006
1 parent b1f842e commit 5a21a67
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
Expand Up @@ -111,8 +111,6 @@ public class DefaultLayoutFactory

protected final Map layouts = new HashMap();

protected Configuration[] layoutsConf;

protected static long idCounter = System.currentTimeMillis();

/**
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}
}
}
Expand All @@ -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 ) {
Expand Down Expand Up @@ -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 ) {
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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() ) {
Expand Down
Expand Up @@ -14,14 +14,19 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- SVN $Id$ -->
<!-- @version $Id$ -->
<coplets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<coplet-type id="URICoplet">
<coplet-adapter>uri</coplet-adapter>
</coplet-type>

<coplet-type id="Portlet">
<coplet-adapter>portlet</coplet-adapter>
<configuration>
<name>buffer</name>
<value xsi:type="java:java.lang.Boolean">true</value>
</configuration>
<configuration>
<name>full-screen</name>
<value xsi:type="java:java.lang.Boolean">false</value>
Expand Down

0 comments on commit 5a21a67

Please sign in to comment.