1 2 Previous Next 24 Replies Latest reply on May 30, 2008 7:18 AM by alesj Go to original post
      • 15. Re: Multiple parsing implementation in RARDeployer
        alesj

         

        "vickyk" wrote:

        I have managed to get RARParserDeployer working after making the changes in the MultipleVFSParsingDeployer , I commented the mappings section.

        No, you need the mappings.
        That's the info that knows how to map file with the actual metadata.
        If you had to remove that, you're probably misusing the deployer.

        "vickyk" wrote:

        However when I ran the testcases I started getting these errors
        *** DEPLOYMENTS IN ERROR: Name -> Error
        
        vfsfile:/home/vicky/eclipseworkspaces/workspace/jboss5-trunk/testsuite/output/lib/jcatest.jar -> org.jboss.deployers.spi.DeploymentException: Error during deploy: vfsfile:/home/vicky/eclipseworkspaces/workspace/jboss5-trunk/testsuite/output/lib/jcatest.jar
        
        
        *** CONTEXTS IN ERROR: Name -> Error
        
        vfsfile:/home/vicky/eclipseworkspaces/workspace/jboss5-trunk/testsuite/output/lib/jcatest.jar -> java.lang.NoSuchMethodError: org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(Lorg/jboss/virtual/VirtualFile;)Ljava/lang/Object;
        


        I am not able to see the required parse(.. ) implementation in the SchemaResolverDeployer , looks like the recent changes had remove this method .

        Yes, the method is no longer there.
        But who is depending on this method?

        If the deployers are used as they should be - as in deployers tests - that method is impl detail.

        • 16. Re: Multiple parsing implementation in RARDeployer
          vickyk

           

          "alesj" wrote:

          That's the info that knows how to map file with the actual metadata.
          If you had to remove that, you're probably misusing the deployer.


          Yes I understand that the mapping is the info of deployment descrptor to metadata , so I have the code like this

          public RARParserDeployer()
           {
           super(RARDeploymentMetaData.class, new HashMap());
           mappings = getMappings();
           mappings.put(jeeSpecRarDD, ConnectorMetaData.class);
           mappings.put(jbossRarDD, JBossRAMetaData.class);
           }
          


          Is this not right ?

          But who is depending on this method?


          EJB deployer seems to be dependent on it , all the jca test which need EJB deployment is failing .
          Can you put this method back so that I can confirm it ?




          • 17. Re: Multiple parsing implementation in RARDeployer
            alesj

             

            "vickyk" wrote:

            Yes I understand that the mapping is the info of deployment descrptor to metadata , so I have the code like this

            public RARParserDeployer()
             {
             super(RARDeploymentMetaData.class, new HashMap());
             mappings = getMappings();
             mappings.put(jeeSpecRarDD, ConnectorMetaData.class);
             mappings.put(jbossRarDD, JBossRAMetaData.class);
             }
            


            Is this not right ?

            You can do that via static code:
             private static Map<String, Class<?>> getCustomMappings()
             {
             Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
             mappings.put("rar.xml", RarMetaData.class);
             mappings.put("jboss-rar.xml", JBossRarMetaData.class);
             mappings.put("alias.xml", AliasMetaData.class);
             mappings.put("alias-ext.xml", AliasMetaData.class);
             return mappings;
             }
            
             public MultiRarDeployer()
             {
             super(RarDeploymentMetaData.class, getCustomMappings());
             }
            


            "vickyk" wrote:

            But who is depending on this method?


            EJB deployer seems to be dependent on it , all the jca test which need EJB deployment is failing .
            Can you put this method back so that I can confirm it ?

            Why is EJB deployer using that? :-)
            OK, I'll have a look, since this is not your rar issue.

            If you were able to comment mappings, I'm sure you can add that method as well. ;-)

            • 18. Re: Multiple parsing implementation in RARDeployer
              vickyk

               

              Why is EJB deployer using that? :-)

              This might be helpful to findout what is using the parse method which you have removed
              Caused by: java.lang.NoSuchMethodError: org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(Lorg/jboss/virtual/VirtualFile;)Ljava/lang/Object;
               at org.jboss.deployment.JBossEjbParsingDeployer.getStandardMetaData(JBossEjbParsingDeployer.java:211)
               at org.jboss.deployment.JBossEjbParsingDeployer.createMetaData(JBossEjbParsingDeployer.java:112)
               at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:236)
               at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:174)
               ... 64 more
              



              If you were able to comment mappings, I'm sure you can add that method as well. ;-)


              Yes I made the changes in the RARParserDeployer and it worked , I was lazy in doing so earlier ;(

              I will have to wait for the EJB deployer to work properly for running the jca tests .




              • 19. Re: Multiple parsing implementation in RARDeployer
                alesj

                 

                "vickyk" wrote:
                Why is EJB deployer using that? :-)

                This might be helpful to findout what is using the parse method which you have removed
                Caused by: java.lang.NoSuchMethodError: org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(Lorg/jboss/virtual/VirtualFile;)Ljava/lang/Object;
                 at org.jboss.deployment.JBossEjbParsingDeployer.getStandardMetaData(JBossEjbParsingDeployer.java:211)
                 at org.jboss.deployment.JBossEjbParsingDeployer.createMetaData(JBossEjbParsingDeployer.java:112)
                 at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:236)
                 at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:174)
                 ... 64 more
                


                OK, good point - backcompatibility.
                I'll put that method back.

                • 20. Re: Multiple parsing implementation in RARDeployer
                  vickyk

                   

                  "alesj" wrote:

                  OK, good point - backcompatibility.
                  I'll put that method back.


                  And here I have the passing test ;)

                  test:
                   [delete] Deleting: /tmp/test.log
                   [junit] Running org.jboss.test.jcaprops.test.GoodrarUnitTestCase
                   [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 4.101 sec
                   [junit] Running org.jboss.test.jcaprops.test.JBossRaXmlOverrideUnitTestCase
                   [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1.113 sec
                   [junit] Running org.jboss.test.jcaprops.test.UpperGoodrarUnitTestCase
                   [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 2.872 sec
                  
                  BUILD SUCCESSFUL


                  Let me run all the jca tests now .


                  • 21. Re: Multiple parsing implementation in RARDeployer
                    vickyk

                    I have noticed that the init(..) does not get called in the parse(..) implemetations of AbstractVFSParsingDeployer , here is the code

                    @Override
                     protected T parse(DeploymentUnit unit, String name, String suffix, T root) throws Exception
                     {
                     // Should we include the deployment
                     // The infrastructure will only check leafs anyway so no need to check here
                     if (name == null && isIncludeDeploymentFile())
                     name = unit.getName();
                    
                     // Try to find the metadata
                     VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
                     List<VirtualFile> files = vfsDeploymentUnit.getMetaDataFiles(name, suffix);
                    
                     if (files.size() == 0)
                     {
                     return null;
                     }
                     else if (files.size() > 1)
                     {
                     return handleMultipleFiles(vfsDeploymentUnit, root, files);
                     }
                     else
                     {
                     VirtualFile file = (VirtualFile) unit.getAttachment(getOutput().getName() + ".altDD");
                     if(file == null)
                     file = files.get(0);
                    
                     T result = parse(vfsDeploymentUnit, file, root);
                     if (result != null)
                     init(vfsDeploymentUnit, result, file);
                     return result;
                     }
                     }
                    
                     protected T parse(DeploymentUnit unit, Set<String> names, String suffix, T root) throws Exception
                     {
                     if (names == null || names.isEmpty())
                     throw new IllegalArgumentException("Null or empty names.");
                    
                     VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
                    
                     List<VirtualFile> files = new ArrayList<VirtualFile>();
                     Set<String> missingFiles = new HashSet<String>();
                    
                     for (String name : names)
                     {
                     List<VirtualFile> matched = vfsDeploymentUnit.getMetaDataFiles(name, suffix);
                     if (matched != null && matched.isEmpty() == false)
                     files.addAll(matched);
                     else
                     missingFiles.add(name);
                     }
                    
                     if (missingFiles.size() == names.size())
                     return null;
                    
                     return mergeFiles(vfsDeploymentUnit, root, files, missingFiles);
                     }
                    
                    


                    So if I am am overriding some functionality in the Deployer implementation of type MultipleObjectModelFactoryDeployer , the init(..) does not kick in .

                    I have a hack to get the MetaData processing out from the init() and place in the mergeMetaData(...) but I wanted to make sure that the flow of the parse(..) is ok .
                    Ales you need to check this .


                    Here is the hack
                    protected RARDeploymentMetaData mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>, List<Object>> metadata) throws Exception
                     {
                     RARDeploymentMetaData deployment = new RARDeploymentMetaData();
                    
                     // Getting the List of MetaData Objects
                     List<Object> cmdInstances = metadata.get(ConnectorMetaData.class);
                     if(cmdInstances != null && !cmdInstances.isEmpty())
                     deployment.setConnectorMetaData(ConnectorMetaData.class.cast(cmdInstances.get(0)));
                    
                     List<Object> jmdInstances = metadata.get(JBossRAMetaData.class);
                     if(jmdInstances != null && !jmdInstances.isEmpty())
                     deployment.setRaXmlMetaData(JBossRAMetaData.class.cast(jmdInstances.get(0)));
                    
                     // This is moved from the init() , got to verify if this in not a HACK .....
                     /*
                     VFSDeploymentUnit parent = unit.getParent();
                     String name = unit.getSimpleName();
                     if( parent != null )
                     name = parent.getSimpleName() + "#" + name;
                     System.out.println("--------> name -->"+name);
                     metaDataRepository.addConnectorMetaData(name, deployment.getConnectorMetaData());
                     */
                     // Check if this is hack.
                    
                     return deployment;
                     }


                    The actual code which was part of the init(..) is

                    @Override
                     protected void init(VFSDeploymentUnit unit, RARDeploymentMetaData rdmd, VirtualFile file) throws Exception
                     {
                     ConnectorMetaData cmd = rdmd.getConnectorMetaData();
                     cmd.setURL(file.toURL());
                     VFSDeploymentUnit parent = unit.getParent();
                     String name = unit.getSimpleName();
                     if( parent != null )
                     name = parent.getSimpleName() + "#" + name;
                     metaDataRepository.addConnectorMetaData(name, cmd);
                     }
                    


                    Right now I am not able to call cmd.setURL(file.toURL()); within the mergeMetaData(...) , I think I should be getting the VirtualFile reference from the VirtualDeploymentUnit.
                    I am look at this .

                    The URL set in the ConnectorMetaData is being used in the RARDeployment at here

                    protected void startService() throws Exception
                     {
                     URL url = cmd.getURL();
                     if (cmd.getLicense().getRequired())
                     {
                     //log.info ("Required license terms exist, view " + ServerConfigUtil.shortUrlFromServerHome(url.toString()));
                     log.debug("License terms full URL: " + url);
                     }
                     //resourceAdapter = ResourceAdapterFactory.createResourceAdapter(cmd);
                     resourceAdapter = ResourceAdapterFactory.createResourceAdapter(rdmd);
                     resourceAdapter.start(this);
                     }


                    Please note that url.toString() is yielding the NPE as it is not being set in RARParserDeployer .


                    • 22. Re: Multiple parsing implementation in RARDeployer
                      alesj

                       

                      "vickyk" wrote:
                      I have noticed that the init(..) does not get called in the parse(..) implemetations of AbstractVFSParsingDeployer , here is the code

                      For merge where you have different metadata types, the original init cannot be called - its signature only matches parser's output type.

                      • 23. Re: Multiple parsing implementation in RARDeployer
                        alesj

                         

                        "vickyk" wrote:

                        Right now I am not able to call cmd.setURL(file.toURL()); within the mergeMetaData(...) ,

                        You can override the method that still has the file information.

                        "vickyk" wrote:

                        I think I should be getting the VirtualFile reference from the VirtualDeploymentUnit.

                        Or you can use this
                        VirtualFile file = vfsDeploymentUnit.getMetaDataFile(<file-name-i'm-looking-for>);
                        


                        • 24. Re: Multiple parsing implementation in RARDeployer
                          alesj

                           

                          "vickyk" wrote:
                          The URL set in the ConnectorMetaData is being used in the RARDeployment at here

                          protected void startService() throws Exception
                           {
                           URL url = cmd.getURL();
                           if (cmd.getLicense().getRequired())
                           {
                           //log.info ("Required license terms exist, view " + ServerConfigUtil.shortUrlFromServerHome(url.toString()));
                           log.debug("License terms full URL: " + url);
                           }
                           //resourceAdapter = ResourceAdapterFactory.createResourceAdapter(cmd);
                           resourceAdapter = ResourceAdapterFactory.createResourceAdapter(rdmd);
                           resourceAdapter.start(this);
                           }


                          Please note that url.toString() is yielding the NPE as it is not being set in RARParserDeployer .

                          Doh, it's only being used in log. ;-)

                          1 2 Previous Next