3 Replies Latest reply on Feb 5, 2007 5:31 AM by mlipp

    How to configure the portal from code

    lipp1

      Hi,

      I have a portlet application and want to automate the installation. Besides the deployment of the portlets, I want to configure some users and roles and I want to provide pages that display the portlets.

      Is there any API that I can use to configure the Portal? Or can I insert this information in the database? All information, or are pages stored in the filesystem? Where? I searched in the reference manual but didn't find anything.

      Any help appreciated.

      - Michael

        • 1. Re: How to configure the portal from code
          theute

          Yes you can use the roleModule and userModule.

          As a less clean process, you could also direclty access the database, it would work as of today. (there are 3 tables, one for users, one for roles and one to set roles to users.)

          Information like portal object information (pages, windows...) are stored in the database, you can use related services or check the code of the management portlet to see how it is done.

          • 2. Re: How to configure the portal from code
            antoine_h

            question : why can't you use the usual *-object.xml to describe the pages, windows etc... of your portal ?
            and put all this in a webapp (.war file) and deploy it like that ?
            do you have a specific need ?

            seems more simple to use the xml descriptor than programatically write all this setup of your portal.

            for the users : see also how it is done the first time the portal launch, for the creation of the two default user (user and admin).

            they are set by a file :
            \deploy\jboss-portal_2_4_1SP1.sar\conf\hibernate\user\setup.txt
            this file is used by hibernate to populate the user and role tables at first launch.

            It shows how to populate some user with the UserImpl and RoleImpl classes. You can reuse this to write some better way to do it than just replacing this file.

            you could also launch a sql script to populate automatically the tables with your user definition.

            • 3. Re: How to configure the portal from code

              Thanks for replying, special thanks to Antoine. I had the wrong question in mind when I was searching for an API. After all, you simply deploy anything in JBoss, don't you, even portal pages ...

              - Michael