3 Replies Latest reply on Dec 9, 2009 2:50 PM by Ales Justin

    Running a deployer on resource in classpath

    Ramesh Reddy Master

      Hi,

      Do you have any suggestion on running a deployer on resource currently exists inside a JAR file? I guess I am looking for a way to explicitly invoke a deployer on a given resource identified by a URL rather than from the scanning the disk.

      Thank you.

      Ramesh..

        • 1. Re: Running a deployer on resource in classpath
          Ales Justin Master

          That should be simple - extend AbstractSimpleVFSRealDeployer.
          And use its VFSDeploymentUnit to find the resource you're looking for.
          If it exists, do whatever ...

          • 2. Re: Running a deployer on resource in classpath
            Ramesh Reddy Master

            I extended the my deployer using the AbstractSimpleVFSRealDeployer as below

            public class SystemVDBDeployer extends AbstractSimpleVFSRealDeployer<SystemVDBMetadata> {
            
             public SystemVDBDeployer() {
             super(SystemVDBMetadata.class);
             }
            
             @Override
             public void deploy(VFSDeploymentUnit unit, SystemVDBMetadata deployment)
             throws DeploymentException {
             System.out.println("My deployer invoked");
             }
            }
            


            added the "-jboss-beans.xml" file to the "deployers" directory, but "deploy" call never invoked by the container.

            Then I thought there is no "deployment unit" available for this to be invoked, so added "@ManagementDeployment" and "@ManagementObject" annotations to my metadata object "SystemVDBMetadata" class and deployed that object, this object is available as input to the deployer by adding "setInput", still the deployer never invoked.

            @ManagementObject
            @ManagementDeployment(types = {"vdb"})
            public class SystemVDBMetadata implements Serializable {
            }
            


            What I am confused is what will be my deployment unit in this case, as the resource I want to load is inside a JAR in "lib" directory. My intention was use the above code and once I am in the "deploy" call use the technique mentioned above to load resource.

            Any suggestions as what I may be doing wrong?

            Thank you.

            • 3. Re: Running a deployer on resource in classpath
              Ales Justin Master

               

              "rareddy" wrote:

              Then I thought there is no "deployment unit" available for this to be invoked, so added "@ManagementDeployment" and "@ManagementObject" annotations to my metadata object "SystemVDBMetadata" class and deployed that object, this object is available as input to the deployer by adding "setInput", still the deployer never invoked.

              @ManagementObject
              @ManagementDeployment(types = {"vdb"})
              public class SystemVDBMetadata implements Serializable {
              }
              


              There is no need for this -- this is just for management features, ProfileService etc.

              "rareddy" wrote:

              What I am confused is what will be my deployment unit in this case, as the resource I want to load is inside a JAR in "lib" directory. My intention was use the above code and once I am in the "deploy" call use the technique mentioned above to load resource.

              Who creates and attaches this SystemVDBMetadata to DeploymentUnit?

              Parsing deployers only look into metadata locations.
              For spec defined deployments these are:
              * META-INF for .jar and .ear
              * WEB-INF for .war
              (see StructureDeployer(s) for more details)
              So, jar's lib directory won't be checked unless you explicitly configure it.

              The DeploymentUnit == (Sub)Deployment == .ear or .war or .jar
              (.jar which is not just lib, but real (sub)deployment)