7 Replies Latest reply on Jan 6, 2004 5:57 PM by andrewboyd

    another deployer

    aleke

      I am trying developer a deployer for JIni, could someone help me ?
      I' d like to see deployer examples, i 've tried ejbdeployer and so on, but all of them are too much complicated and specific. I' d like some easy and small example.
      The docs doesnt have anything about!

      tks,

      Carlos Queiroz

        • 1. Re: another deployer

          Have you looked at the SubDeployerSupport class? At minimum you need to extend it and provide an implementation of the accepts() method IIRC.

          This gives you the default support for nested deployments, integrating and automatically registering with MainDeployer, etc. For Jini specific configuration files you need to provide your own parser.

          • 2. Re: another deployer

            Have you looked at the SubDeployerSupport class? At minimum you need to extend it and provide an implementation of the accepts() method IIRC.

            This gives you the default support for nested deployments, integrating and automatically registering with MainDeployer, etc. For Jini specific configuration files you need to provide your own parser.

            • 3. Re: another deployer
              andrewboyd

              First of I'd like to thank Juhda & Adrian for all the answers they provide.

              I'm also trying to have my own deployer. Currently my deployer
              extends MainDeployer. I'll change it to extending SubDeployerSupport.
              I do have a question though. Currently my service.xml looks like this:

               <mbean code="com.digitalreasoning.kafe.service.LocalAgentLoader"
               name="drs.kafe:type=Service,service=LocalAgentLoader">
               <depends>drs.kafe:type=Host,name=Host</depends>
               </mbean>
               <!-- ==================================================================== -->
               <!-- Deployment Scanning Keep an eye on the localAgent dir -->
               <!-- ==================================================================== -->
              
               <!-- An mbean for hot deployment/undeployment of LocalAgents.
               -->
               <mbean code="org.jboss.deployment.scanner.URLDeploymentScanner"
               name="drs.kafe.deployment:type=DeploymentScanner,flavor=URL">
              
               <depends optional-attribute-name="Deployer">drs.kafe:type=Service,service=LocalAgentLoader</depends>
              
              
              ... snip ...
              

              How do I tell JBoss to deploy using my SubDeployer? Above I copied the
              normal behavior for the MainDeployer. I could not find any examples where the Deployment scanner is told about any SubDeployers.

              Thanks,

              Andrew

              • 4. Re: another deployer

                The deployment scanner is not aware of sub deployers. It always passes the package it finds during scan to the MainDeployer.

                All sub deployers register themselves with the MainDeployer (this is automatic when you extend the SubDeployerSupport class). When the MainDeployer receives a new package from the scanner it asks each of its sub deployers if they recognize the package type (via DeploymentInfo instance).

                This is done via the accepts() method I mentioned in the previous post. In your accepts() implementation you examine the DeploymentInfo and determine if your sub deployer is capable of handling that deployment type.

                JavaDoc from SubDeployer interface:

                /**
                 * The <code>accepts</code> method is called by MainDeployer to
                 * determine which deployer is suitable for a DeploymentInfo.
                 *
                 * @param sdi a <code>DeploymentInfo</code> value
                 * @return a <code>boolean</code> value
                 *
                 * @jmx:managed-operation
                 */
                 boolean accepts(DeploymentInfo sdi);
                


                HTH


                • 5. Re: another deployer
                  andrewboyd

                  Thanks for the quick reply. What I really want to do is scan a dir that
                  is different from the deploy dir and process an xml file that is an extension
                  of the jboss-service.xml file. Which I'll use to add AOP method interceptors
                  for classes that must extend one of our BaseClasses

                  So I really want JBoss deployers to do most of the work
                  such as:
                  creating tmp dirs
                  creating classLoaders and loading classes & jars
                  deploying/redeploying/undeploying
                  implementation of the depends tag

                  Should I extend the SubDeployerSupport or some other class?
                  Maybe extending SARDeployer as well as ServiceControler?

                  Thanks

                  Andrew

                  • 6. Re: another deployer

                    You should extend SubDeployerSupport

                    • 7. Re: another deployer
                      andrewboyd

                      One thing I just figgured out is you should also tell jboss the
                      extention of your files such as:

                      public static final String[] DEFAULT_SUFFIX_ORDER = {
                      "sar", "rar", "ds.xml", "service.xml", "jar", "war", "wsr",
                      "ear", "zip", "last"
                      };

                      If you have something different you probably want to add it here.

                      Andrew