1 2 Previous Next 20 Replies Latest reply on May 13, 2003 10:45 PM by Matt Smith

    Nukes DB installer

    Viet Master

      is someone interested in doing the db installer ?

      that would be a simple servlet doing plain JDBC access. The purpose is to set up the nukes tables instead of having the user to source the files. even JSP are suitable. it comes as a separate war archive.

      HTML and gfx can be taken from original postnuke installshield.

      julien

        • 1. Re: Nukes DB installer
          Matt Smith Newbie

          I'm still working on the web links module. Should have it done this weekend, but I would like to do the installer as well. I have the weekend off so I should be able to complete both of them. How does that sound?


          Matt

          • 2. Re: Nukes DB installer
            Viet Master

            > I'm still working on the web links module. Should

            cool

            > have it done this weekend, but I would like to do the
            > installer as well. I have the weekend off so I
            > should be able to complete both of them. How does
            > that sound?

            pretty simple,

            1.take html + gfx from postnuke so it looks fancy

            2.let user choose its target database providing
            the jndi name of its configured datasource.
            (you can assume hsqldb will always be installed since bundled with jboss)

            3.parse some ddl file and execute statements one by one in the target DB. log what's done on the installer
            providing errors info if any / outputting statement one by one, etc....



            that's a piece of code we need. I am currently working on mbean persistence in database. After that we need more configuration modules : security / blocks / modules, but these needs the persistence stuff to work.

            Still doco to do. If someone wants to help, welcome.

            julien

            >
            >
            > Matt

            • 3. Re: Nukes DB installer
              Yanik Crépeau Newbie

              I have just checked Ant documentation version 1.5.

              There is a task names "SQL".

              To have it working no need:

              - Class name of the jdbc driver
              - Database connection url
              - Database user name
              - Database password
              - File containing SQL statements

              So, if you have in the build.xml file (at root) the following lines:







              it should do the work.

              • 4. Re: Nukes DB installer
                Yanik Crépeau Newbie

                I have just checked Ant documentation version 1.5.

                There is a task names "SQL".

                To have it working no need:

                - Class name of the jdbc driver
                - Database connection url
                - Database user name
                - Database password
                - File containing SQL statements

                So, if you have in the build.xml file (at root) the following lines:







                it should do the work.

                • 5. Re: Nukes DB installer
                  Matt Smith Newbie

                  I'll get this posted tonight. Sorry for the delay.

                  • 6. Re: Nukes DB installer
                    Viet Master

                    great.

                    • 7. Re: Nukes DB installer
                      Viet Master

                      jmatt, when will you post it ? we need this as soon as possible.

                      julien

                      • 8. Re: Nukes DB installer
                        Matt Smith Newbie

                        I've got to add comments and logging. And then test it. I 'm working on it right now. Should be real soon.

                        • 9. Re: Nukes DB installer
                          Matt Smith Newbie

                          Almost there. I am a little stuck though. I can successfully create the database from the Jndi name but I don't know how to get the other modules to see the database. Currently there is a DatabasePollerFilter filter that tries to get a connection to the database based on a init-param in the web.xml file. Any guidance would be appreciated. Let me know if you want me to post what I have now.

                          tx

                          Matt

                          • 10. Re: Nukes DB installer
                            Viet Master

                            no no, keep it simple, we can improve later

                            we have a set of named script, let's say in jar archive as resources. we hardcode in the servlet the script name like :

                            String scripts = { "org/jboss/nukes/install/script1.ddl", etc.... };

                            and the servlet enable the execution of each script.

                            julien

                            • 11. Re: Nukes DB installer
                              Viet Master

                              what I am going to do : unify datasource, always
                              use "java:NukesDS"

                              so the guy deploys its datasource.
                              run the servlet db feeder :
                              choose its database implementation, i/e the datasource installed : mysql, etc.....
                              the we get the scripts for the appropriate DB and execute them, each statement is written in the servlet GUI with a report : succesfull or not.

                              ok ?

                              julien

                              • 12. Re: Nukes DB installer
                                Matt Smith Newbie

                                > what I am going to do : unify datasource, always
                                > use "java:NukesDS"
                                >
                                are you being serious.

                                > so the guy deploys its datasource.
                                > run the servlet db feeder :
                                > choose its database implementation, i/e the
                                > datasource installed : mysql, etc.....
                                > the we get the scripts for the appropriate DB and
                                > execute them, each statement is written in the
                                > servlet GUI with a report : succesfull or not.
                                >
                                > ok ?
                                ok. Got it. ONe more day.
                                >
                                > julien

                                • 13. Re: Nukes DB installer
                                  Matt Smith Newbie

                                  Sorry for the delay.

                                  Attached is the dbinstaller.zip.

                                  It needs to be i18n and probably better error handling.

                                  It runs off of a properties file (I would like to turn this into an xml file, but that is probably a low priority). To add support for another database just add entries in the properties file like:

                                  database3.name=oracle
                                  database3.setup=/WEB-INF/oracle/setup.ddl
                                  database3.parser=org.jboss.nukes.install.parser.DefaultSQLParser

                                  I made the parser pluggable in case the default one does not handle all situations. To create a new parser just implement the org.jboss.nukes.install.parser.SQLParser interface, it has one method:

                                  public List parse(String sqlStatements, NukesInstallForm form);

                                  I started out trying to make a generic Wizard type app that just moved the app from step to step. I simplified it some and it is not so generic.

                                  Feel free to throw this away, rewrite, or use it as you wish. Again sorry for the delay.

                                  tx

                                  Matt

                                  • 14. Re: Nukes DB installer
                                    Matt Smith Newbie

                                    Sorry for the delay.

                                    Attached is the dbinstaller.zip.

                                    It needs to be i18n and probably better error handling.

                                    It runs off of a properties file (I would like to turn this into an xml file, but that is probably a low priority). To add support for another database just add entries in the properties file like:

                                    database3.name=oracle
                                    database3.setup=/WEB-INF/oracle/setup.ddl
                                    database3.parser=org.jboss.nukes.install.parser.DefaultSQLParser

                                    I made the parser pluggable in case the default one does not handle all situations. To create a new parser just implement the org.jboss.nukes.install.parser.SQLParser interface, it has one method:

                                    public List parse(String sqlStatements, NukesInstallForm form);

                                    I started out trying to make a generic Wizard type app that just moved the app from step to step. I simplified it some and it is not so generic.

                                    Feel free to throw this away, rewrite, or use it as you wish. Again sorry for the delay.

                                    tx

                                    Matt

                                    1 2 Previous Next