6 Replies Latest reply on Jun 16, 2009 4:39 AM by gurkanerdogdu

    Implement a New Deployer

    gurkanerdogdu

      Hi;

      I am trying to implement a new deployer for my application but I confused because of MC project having a lots of interfaces, abstract classes, etc. related with deployers.

      Is there any clean tutorial that explains step by step to write simple deployer?

      Thanks;

      --Gurkan

        • 1. Re: Implement a New Deployer
          beve

          Hi,

          not sure if you've seen it already but this blog by Bob McWhirter really help me:
          http://oddthesis.org/posts/2008-09-deployers-in-jboss-microcontainer

          Regards,

          /Daniel

          • 2. Re: Implement a New Deployer
            alesj

            There are many abstract/helper deployers.
            You just need to choose the right one, the rest is then easy + just your own custom logic.

            So, I recommend you check the existing ones + those from TorqueBox (as recommended by beve),
            and I'm sure you'll be able to find useful info.

            But if you still have issues/problems, simply post more info here, and we'll see what we can do. ;-)

            • 3. Re: Implement a New Deployer
              gurkanerdogdu

              Hey,

              Thanks a lot for answers, I have just read the aforementioned link. Actually I want to do is that whenever I add jar file with ending ".msar" to the JBoss deploy directory, my deployer will take the responsibility.

              So I write a structure deployer that extends AbstractVFSStructureDeployer. In its determineStructure(...) method, I am looking for the correct suffix. If it is ".msar", creating context info with createContext() method and returning true. I am also adding attachment object MSarMetaData to the context.

              For deployer, I extends the class AbstractOptionalRealDeployer. Then package the full project into JBoss deployers sub-folder with name "msar.deployer". After adding a application jar with ending ".msar" into the JBoss "deploy", structure class is called and returns true(actually it is called at bootstrap), but deployer has never been called.

              I am so new to the MC framework. Absolutely catching something :)

              Thanks for help;

              • 4. Re: Implement a New Deployer
                alesj

                You don't need a new structure deployer to be able to handle .msar.
                All you need to do is update suffixes in JarUtils, so JarStructureDeployer recognizes your .msar as a jar.

                And then have a real deployer (not structure) to add your MSarMetaData based on .msar suffix.

                What is your deployer (the one that's not picked up) supposed to do?

                • 5. Re: Implement a New Deployer
                  gurkanerdogdu

                  Thanks Ales.

                  But if there is no structure class, how do I create a meta data attachment?

                  After the structure "determineStructure" returns true, how MC decides to call which deployer is responsible for? Does it look for the attached meta data class that is set on the Deployer constructor using setInput(clazz).

                  Deployer will read the service list from the "META-INF" folder of the "msar" and and do some JMX related stuff whenever a user put "msar" archives to deploy directory.

                  • 6. Re: Implement a New Deployer
                    gurkanerdogdu

                    Ok. I got it.

                    I add ".msar" suffix to JARStructure, then implement ParseDeployer and RealDeployer. Now everything works fine :)

                    Thanks;

                    --Gurkan