4 Replies Latest reply on Jul 23, 2003 3:25 PM by Viet

    Dynamic Blocks

    lynchie Newbie

      I've been messing around with Nukes the past while and I've developed a module that will allow you to add blocks dynamically. It differs fromt he current JDBCDeploymentScanner in that it pulls the information from the DB and it doesn't require each block to be deployed in a separate sar file.

      You can simply add a new block, set its url to a rss/rdf feed and the content will be displayed in the block. Or you can just add some html content into it either. You can change the blocks properties at run-time, either changing its side or weight property.

      I have made changes to the JDBCDeploymentScanner files so I have included those files in the attached zip file.

      There are still some work to be done to the module, but i'd like some feedback as to whether it could be incorporated into nukes. If so, ill continue to work on it and improve the code.


        • 1. Re: Dynamic Blocks
          Viet Master

          I will look at it, thanks


          • 2. Re: Dynamic Blocks
            Viet Master

            I have just started to look at your work, it seems that you are doing to jobs in one :

            1.managing dynamic blocks
            2.managing RSS blocks

            I think I will split that in two parts. Can we discuss that ?

            I have a question, why are you using an EJB there ? it is possible to persist blocks in the database, i.e each deployed block through the JDBCDeploymentScanner will survive at a restart and the block will keep the values they add before.

            So please tell me if there is another use for that EJB I did not see.

            Thanks for your work it looks great, it will enhance Nukes a lot.


            • 3. Re: Dynamic Blocks
              lynchie Newbie

              Im not sure how you intend on splitting them into two parts? The idea of the block is so that you can put any content into it, so you can just display some static html text, or get the content from another source, i.e. an RSS feed.

              Looking at it now, there is no need for the EJB at all. Im only getting to grips with JMX at the moment, but I can now see that I could remove all the EJB code and use JMX to set the attributes. Ill update the code this weekend, probably Friday evening, removing all the EJB stuff, clean it up, and ill send it back to ya when its done.

              • 4. Re: Dynamic Blocks
                Viet Master

                I am currently working on the block module.

                It enables you to create block dynamicly. So you don;t have to take care of that.

                If you want your block to provide customisation use the methods :

                public void edit(org.jboss.nukes.html.Page page);
                public void update(org.jboss.nukes.html.Page page);

                in edit : you can display the html you need to configure a block instance

                in update you : update the block with the url you created in edit.

                then the changes are persisted in the database (mbean attributes)

                when a block is configured by the block module it calls the edit method to give the block to provide extra configuration.

                this module also enables you to act on block : change position and start/stop/create/destroy

                so you can focus on RSS only. in fact the only customization that block would need would be the URL of the target (being an rss feed ot something else)

                with the content type of the URL you can adapt your block to the rendering : RSS, image, text, html, etc...

                if its an rss, parse it and display it
                if its an image, put a bare img tag