8 Replies Latest reply on Mar 5, 2012 7:54 AM by antoine_h

    disablePortalContainer ? what is it used for ?

    antoine_h

      Hello,

       

      in the code of the PortalContainerConfig, there is a method to disable a Portal Container :

       

      /**
          * Disables a portal container if it has not yet been disabled.
          * @param name the name of the portal container to disable
          */
         public synchronized void disablePortalContainer(String name)
      ....
      

       

      What does "disable a portal container" mean, and what is it used for ?

       

      I have look in the code, and in the logs, and the only place where it is really used, is in the RootContainer class :

       

         /**
          * Register a new portal container. It will try to detect if {@link PortalContainerDefinition} has
          *  been defined, if so it will create the portal container later otherwise we assume that we 
          * expect the old behavior, thus the portal container will be initialized synchronously 
          * @param context the context of the portal container
          */
         public void registerPortalContainer(ServletContext context)
         {
            SecurityManager security = System.getSecurityManager();
            if (security != null)
               security.checkPermission(ContainerPermissions.MANAGE_CONTAINER_PERMISSION);     
            
            PortalContainerConfig config = getPortalContainerConfig();
            if (config.hasDefinition())
            {
               // The new behavior has been detected thus, the creation will be done at the end asynchronously
               if (config.isPortalContainerName(context.getServletContextName()))
               {
                  // The portal context has been registered has a portal container
                  portalContexts.add(new WebAppInitContext(context));
               }
               else
               {
                  if (PropertyManager.isDevelopping())
                  {
                     log.info("We assume that the ServletContext '" + context.getServletContextName()
                        + "' is not a portal since no portal container definition with the same name has been"
                        + " registered to the component PortalContainerConfig. The related portal container"
                        + " will be declared as disabled.");
                  }
                  config.disablePortalContainer(context.getServletContextName());
               }
               // We assume that a ServletContext of a portal container owns configuration files
               final PortalContainerPreInitTask task = new PortalContainerPreInitTask()
               {
      
                  public void execute(ServletContext context, PortalContainer portalContainer)
                  {
                     portalContainer.registerContext(context);
                  }
               };
               PortalContainer.addInitTask(context, task);
            }
            else
            {
               // Ensure that the portal container has been registered
               config.registerPortalContainerName(context.getServletContextName());
               // The old behavior has been detected thus, the creation will be done synchronously
               createPortalContainer(context);
            }
         }
      

       

      Does anyone have more explaination of this disabling a portal container ?

       

      Is there anything in the user interface of the portal, to create a portal container or to delete / remove one ?

       

      Any explaination or link to some documentation are welcome !

       

      My question is about global "how the portal works", but also for this performance question :

       

      Thanks,

       

      Antoine

      JBoss Portal and GateIn (JSR-286), JSF, Richfaces, J2EE, Drools, BRMS.

      http://www.sysemo.com/Sysemo-expertise-portails-jboss-portal.php

        • 1. Re: disablePortalContainer ? what is it used for ?
          theute

          if you extend /portal for your own portal container /toto, you may want to disable access to /portal

           

          A portal container is linked to a (or several) packages, so there is no portal UI for that. An Eclipse plugin would be neat (any contributor ?). I quickly made a Maven archetype (not something really ready to be put on a repo yet) https://github.com/theute/GateIn-Portal-Extension-Maven-Archetype

          1 of 1 people found this helpful
          • 2. Re: disablePortalContainer ? what is it used for ?
            antoine_h

            Thanks Thomas,

             

            For that use case (one "toto" custom portal container, without any regular "portal" PortalContainer), I will remove the regular "portal" PortalContainer config.

            If not needed, there's no need to keep the config of this portal container instance that is never used, no ?

             

            => can the regular "portal" PortalContainer be removed (remove of the config, hence no more instance created) ?

            Or it must be kept in place and disabled ?

             

            **************

            it's ok that there is no UI for creating or deleting a portal container : this is not the kind of thing we need to do often.

            it is very rare to have to do it : at the start of a project for a big portal... and that's it.... (AFAIK).

             

            Antoine

            • 3. Re: disablePortalContainer ? what is it used for ?
              antoine_h

              My question is about global "how the portal works",

              but also for this performance question :

              https://community.jboss.org/thread/196190

              • 4. Re: disablePortalContainer ? what is it used for ?
                theute

                "how the portal works" is a too wide question for me to answer (even more since I'm currently in a meeting )

                 

                You may want to extend "portal" the one we ship, to benefit from enhancements when we ship a new version, in that case you shouldn't undeploy the default "portal".

                 

                You may also consider scenarios where you have a "common" portal container and you customize it on multiple portal containers.

                 

                For instance this example shows that in action: http://anonsvn.jboss.org/repos/gatein/portal/tags/3.2.0-GA/examples/portal/config/src/main/java/conf/configuration.xml

                 

                It's supposed that 02portal.war is deployed as it extends it in a portal accessible at /sample-portal (but /portal is still example). It's a very light customization of /portal AFAIR it just replaces an image, a translation key and adds a page, all the other parts are used from /portal.

                 

                 

                For the performance question, we didn't see it as a bottleneck, did you ?

                1 of 1 people found this helpful
                • 5. Re: disablePortalContainer ? what is it used for ?
                  antoine_h

                  Thanks for the quick answers.

                  Thomas Heute wrote:

                  For the performance question, we didn't see it as a bottleneck, did you ?

                  No, of course this filter is not a bottleneck.

                  but without waiting for a true visible bottleneck, while tuning the config of the portal container (and some login/logout config), I just wondered if this filter could be removed : the less filters on each http requests, for many users in parallel, ... the better.

                   

                  I'll give a try without it... and if it runs widely, ... I'll see it quickly.

                   

                  Thanks again,

                  Antoine

                  • 6. Re: disablePortalContainer ? what is it used for ?
                    theute

                    I understand that. If it's useless why keeping it, it's probably true for many parts, but personally I wouldn't bother since it's likely a very tiny thing and I can't tell the consequences in the long term.

                    That's a personal choice.

                    • 7. Re: disablePortalContainer ? what is it used for ?
                      nfilotto

                      I confirm what Thomas said, this feature (aka https://issues.jboss.org/browse/EXOJCR-842) has been added mainly to allow customers that frequently ask to "rename" the entry point of their portal aka "/portal" to anything they want by simply creating a portal extension as you did and defining only their portal container in the PortalContainerConfig which will implicitly disable the portal container "portal" (that will try to register itslef from the portal.war of gatein.ear). Knowing that any extension depends on resources available in /portal you cannot remove it (moreover it is strictly forbidden to modify any file in gatein.ear for support purpose) so /portal is still available that is why you need this filter to prevent any access to it that would cause issues of type https://issues.jboss.org/browse/GTNPORTAL-1345

                      • 8. Re: disablePortalContainer ? what is it used for ?
                        antoine_h

                        ok

                        very clear

                        thanks a lot.

                        Antoine