Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-695

JavaComponentTypeLoader.load() returns PojoComponentType which isn't a ModelObject

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Java-SCA-M2
    • Java-SCA-0.90
    • SCA Java Runtime
    • None
    • r440401

    Description

      When I tried using a componentType file along w/ my Java impl I got:

      org.apache.tuscany.spi.loader.UnrecognizedElementException :

      {http://www.osoa.org/xmlns/sca/1.0}

      componentType [

      {http://www.osoa.org/xmlns/sca/1.0}

      componentType ]
      ........
      at org.apache.tuscany.core.loader.LoaderRegistryImpl.load(LoaderRegistryImpl.java:113)
      at org.apache.tuscany.core.implementation.java.JavaComponentTypeLoader.loadFromSidefile(JavaComponentTypeLoader.java )
      at org.apache.tuscany.core.implementation.java.JavaComponentTypeLoader.load(JavaComponentTypeLoader.java:71)
      at org.apache.tuscany.core.implementation.java.JavaComponentTypeLoader.load(JavaComponentTypeLoader.java :47)
      at org.apache.tuscany.core.loader.LoaderRegistryImpl.loadComponentType(LoaderRegistryImpl.java:159)
      at org.apache.tuscany.core.implementation.java.JavaImplementationLoader.load(JavaImplementationLoader.java :57)
      at org.apache.tuscany.core.loader.LoaderRegistryImpl.load(LoaderRegistryImpl.java:92)
      at org.apache.tuscany.core.loader.ComponentLoader.loadImplementation(ComponentLoader.java:133)
      at org.apache.tuscany.core.loader.ComponentLoader.load (ComponentLoader.java:84)
      at org.apache.tuscany.core.loader.ComponentLoader.load(ComponentLoader.java:57)
      at org.apache.tuscany.core.loader.LoaderRegistryImpl.load(LoaderRegistryImpl.java:92)
      at org.apache.tuscany.core.implementation.composite.CompositeLoader.load (CompositeLoader.java:77)
      at org.apache.tuscany.core.implementation.composite.CompositeLoader.load(CompositeLoader.java:52)
      at org.apache.tuscany.core.loader.LoaderRegistryImpl.load(LoaderRegistryImpl.java:92)
      at org.apache.tuscany.core.loader.LoaderRegistryImpl.load(LoaderRegistryImpl.java:109)
      at org.apache.tuscany.core.implementation.composite.CompositeComponentTypeLoader.loadFromSidefile(CompositeComponentTypeLoader.java :64)
      at org.apache.tuscany.core.implementation.composite.CompositeComponentTypeLoader.load(CompositeComponentTypeLoader.java:56)
      at org.apache.tuscany.core.implementation.composite.CompositeComponentTypeLoader.load (CompositeComponentTypeLoader.java:38)
      at org.apache.tuscany.core.loader.LoaderRegistryImpl.loadComponentType(LoaderRegistryImpl.java:159)
      at org.apache.tuscany.core.deployer.DeployerImpl.load(DeployerImpl.java :118)
      at org.apache.tuscany.core.deployer.DeployerImpl.deploy(DeployerImpl.java:93)
      at org.apache.tuscany.core.launcher.LauncherImpl.bootApplication(LauncherImpl.java:193)

      The problem wasn't the lack of a loader to load <componentType> elems.....rather, it was this line in JavaComponentTypeLoader:

      protected PojoComponentType loadFromSidefile(URL url, DeploymentContext deploymentContext) throws LoaderException

      { return loaderRegistry.load(null, url, PojoComponentType.class, deploymentContext); }

      Thie use of 'PojoComponentType.class' as argument is a problem. In LoaderRegistryImpl.load, we do (line 109):

      ModelObject mo = load(parent, reader, ctx);
      if (type.isInstance(mo)) {

      So we're loading into a ModelObject, (more specifically, org.apache.tuscany.spi.model.ComponentType), but the 'type' here is :
      PojoComponentType.class
      which is in pkg org.apache.tuscany.core.implementation.java and passed into the load(..) call.

      On the dev list, Raymond Feng answered my email describing the problem with this:

      The ComponentTypeElementLoader creates a generic ComponentType from
      the XML file but the code expects an instance of PojoComponentType. Now the
      question is how to map the generic ComponentType into the PojoComponentType
      if it's required. Jim, do you have ideas?

      Jim Marino replied:

      We should probably have the implementation loader handle creation of
      the particular component type class and populate it by recursing back
      into the loader since it is minimal code
      (ComponentTypeElementLoader). This would be a nice patch for someone
      to work on
      Jim

      Attachments

        Activity

          People

            jboynes Jeremy Boynes
            scottkurz Scott Kurz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: