4 Replies Latest reply on Jun 12, 2007 4:09 PM by luizruiz

    (Still) More flexible structure for components.xml

    luizruiz

      Hi,

      We are planning to use the JBoss Seam in a project with strong XML orientation, using components.xml for the definition. Some artifacts to be implemented are data forms and data tables, that will be generated by seam-gen. We opt to the creation of .component.xml, to prevent very extensive files.

      The question is that the definition classes of these components would be in a jar file, and the .components.xml files must be open, to be able to be modified by the developer. Would be possible a way to indicating where have component files to be loaded?

      Thanks,
      Ruiz

        • 1. Re: (Still) More flexible structure for components.xml
          pmuir

          Sorry, I'm not really sure what you are asking...

          You can put components.xml in

          WEB-INF/
          META-INF/
          /any/java/package/

          and .component.xml in

          /any/java/package/

          • 2. Re: (Still) More flexible structure for components.xml
            luizruiz

            I think that the components.xml files can be very large with all the components definitions, then I thought separating by ClassName.component.xml. The ClassName.component.xml is only loaded when exists a ClassName class in the package, but the class will be in jar and the archives open will not be loaded.

            It would be great if the components loader loaded all the *.components.xml files of the directories that you cited in your reply. Is this is possible?

            • 3. Re: (Still) More flexible structure for components.xml
              gavin.king

              There is an existing request for this in JIRA:

              http://jira.jboss.org/jira/browse/JBSEAM-669

              It is scheduled to be fixed in 1.3 BETA.

              • 4. Re: (Still) More flexible structure for components.xml
                luizruiz

                Thank you Gavin,

                I'm trying to do this with a little modification in Initialization.scanForHotDeployableComponents, adding this code, that load all .component.xml in META-INF from the redeploy classloader:

                try {
                 URL[] urls = Classpath.search(redeployStrategy.getClassLoader(),
                 "META-INF/", ".component.xml");
                 for (URL url : urls) {
                 try {
                 log.info("reading " + url);
                 installComponentsFromXmlElements(XML.getRootElement(url
                 .openStream()), getReplacements());
                 } catch (Exception e) {
                 throw new RuntimeException("error while reading " + url, e);
                 }
                 }
                } catch (IOException e1) {
                }


                Classpath is a Facelets utility class that I'm using for convenience.