7 Replies Latest reply on Aug 24, 2005 3:55 AM by Tomasz Cmok

    How to create dynamically new portals?

    Tomasz Cmok Newbie

      Hi,

      I'm starting to work on a new project - web platform. JBoss and Jboss Portal is one of the frameworks im considering to use.
      One of the platform features has to be a possibility to dynamically create new portals using the predefined set of portlets. The goal is to let the customers of my customer to create they own portals within the same platform. The platform will provide some set of standard portlets that a user creating his own new portal could use and custimize their look and feel.

      I.e. - one of such standard portlets will be my customer's catalogue of products. The final customers must be able to create their own portal, upload some HTML files and/or graphics and display them in the main portlet and put somewhere (where they want) that standard catalogue portlet. Of course he must be able to customize look and feel of all components used by his portal.

      I know that it's a bit similar to this what CMS provides, but I think (maybe I'm wrong) that CMS brings too much overhead that will not be used at all in this platform.

      My questions to you are:

      1) Is such dynamic and on-the-fly (without restarting whole platform) portal creation possible with JB Portal?

      2) Can such parallel portal use the predefined set of the same portlets and tags?

      3) Do some examples of some 'Admin portlet' that allows creation of new portals in run time exist or do I have to write everything from the scratch?

      4) Any other advices of what's the best (most effective) way to accomplish the above described functionality?

      Thanks in advance,
      Tomasz

        • 1. Re: How to create dynamically new portals?
          Viet Master

          Hello Tom,


          what you describe is scheduled for 2.2 release.

          • 2. Re: How to create dynamically new portals?
            Tomasz Cmok Newbie

            Hi Julien,

            OK - so I have couple more questions:

            1) When do you plat to release final 2.2 (have read something about Nov?)

            2) How safe (in terms of compatibility, etc.) is to start development on 2.0 i.e. implementation of other functionality, wait till 2.2 and then upgrade and use new features of 2.2 to implement that part of functionality I descibed above?

            Tomasz

            • 3. Re: How to create dynamically new portals?
              Marcel Kostal Newbie

              It's also possible in JBP 2.0.
              Take a look at org.jboss.portal.core.deployment.jboss.PortalDeployment class. Especially the create() method that is derived from super class.
              Everything what you need to is to override the create() method in your new class derived form PortalDeployment.
              To obtain the serverManager use this peace of code:

              MBeanServer server = MBeanServerLocator.locateJBoss();
              ObjectName objName = new ObjectName("portal:service=ServerManager");
              

              and instead of
              getServerManager().deploy(portalMD);

              call
              server.invoke(objName, "deploy", new Object[] {portalMD}, new String[] {"org.jboss.portal.server.metadata.ServerObjectMetaData"});



              • 4. Re: How to create dynamically new portals?
                Tomasz Cmok Newbie

                marec,

                Thanks for a hint. I assume the code you provided will rescan the deploy directories and deploy this what is new in there - right?

                So - whenever I create new portal dynamically (i.e. some basic set of config files in new *.war directory), I just call create() in my derived class and this should do the trick?

                Thanks,
                Tomasz

                • 5. Re: How to create dynamically new portals?
                  Tomasz Cmok Newbie

                  ...and what do I need 'server' MBean for - it doesn't seem to be referenced in your suggested code?

                  Tomasz

                  • 6. Re: How to create dynamically new portals?
                    Marcel Kostal Newbie

                     

                    "tomcmok" wrote:
                    I assume the code you provided will rescan the deploy directories and deploy this what is new in there - right?

                    No. It is not rescaning. You don't need to have WAR file or any file. Everything what you need is portal description XML String in a variable. Your overriden create method will create org.w3c.Document from this String instead of loading it from file.

                    "tomcmok" wrote:
                    So - whenever I create new portal dynamically (i.e. some basic set of config files in new *.war directory), I just call create() in my derived class and this should do the trick?

                    yes, what you need to do is to create instance of you class and call create().

                    "tomcmok" wrote:
                    ...and what do I need 'server' MBean for - it doesn't seem to be referenced in your suggested code?

                    Not referenced? and what is this than?
                    server.invoke(objName, "deploy", new Object[] {portalMD}, new String[] {"org.jboss.portal.server.metadata.ServerObjectMetaData"});

                    You have to call it instead of "getServerManager()" method than is called in the class you derived from.

                    • 7. Re: How to create dynamically new portals?
                      Tomasz Cmok Newbie

                       

                      Not referenced? and what is this than?


                      ...yeah, I was too much fosused on the parameters ;)

                      Ok - thanks - I'll give it a try and eventually come back to bother you with more questions ;)

                      Cheers,
                      Tomasz