package org.osivia.site.customizer.attributes; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.jboss.portal.core.controller.ControllerException; import org.jboss.portal.core.model.portal.command.render.RenderPageCommand; import org.jboss.portal.core.theme.PageRendition; import org.osivia.portal.api.theming.IAttributesBundle; import fr.toutatice.portail.cms.nuxeo.api.services.NuxeoConnectionProperties; /** * Customized attributes bundle. * * @author Cédric Krommenhoek * @see IAttributesBundle */ public class CustomizedAttributesBundle implements IAttributesBundle { /** SSO applications attribute name. */ private static final String APPLICATIONS = "osivia.sso.applications"; /** Singleton instance. */ private static final IAttributesBundle INSTANCE = new CustomizedAttributesBundle(); /** Attribute names. */ private final Set names; /** SSO applications. */ private final List applications; /** * Constructor. */ private CustomizedAttributesBundle() { super(); // Attributes names this.names = new HashSet(); this.names.add(APPLICATIONS); // SSO applications this.applications = new ArrayList(); this.applications.add(NuxeoConnectionProperties.getPublicBaseUri().toString().concat("/logout")); this.applications.add(System.getProperty("cas.logout")); } /** * Get singleton instance. * * @return instance */ public static IAttributesBundle getInstance() { return INSTANCE; } /** * {@inheritDoc} */ @Override public void fill(RenderPageCommand renderPageCommand, PageRendition pageRendition, Map attributes) throws ControllerException { // SSO applications attributes.put(APPLICATIONS, this.applications); } /** * {@inheritDoc} */ @Override public Set getAttributeNames() { return this.names; } }