6 Replies Latest reply on Apr 20, 2007 9:13 AM by csouillard

    ListDescriptor wiring

    csouillard

      I have troubles with ListDescriptor wiring in ActivityBinding.

      Here is the code I use :
      in ActivityBinding.parseSatndardElements :

      protected void parseStandardElements(Element activityElement, ObjectDescriptor objectDescriptor, Parse parse) {
      ....
      Element targetsElement = XmlUtil.element(activityElement, "targets");
      if (targetsElement != null) {
      List targetElements = XmlUtil.elements(targetsElement, "target");
      addDescriptor(objectDescriptor, parseTargets(targetElements), "targets");
      }
      ....
      }

      private ListDescriptor parseTargets(List targetElements) {
      ListDescriptor descriptor = new ListDescriptor();
      List targetsValueDescriptor = null;
      if (targetElements!=null) {
      targetsValueDescriptor = new ArrayList();
      for (Element targetElement: targetElements) {
      String linkName = XmlUtil.attribute(targetElement, "linkName");
      ObjectDescriptor targetDescriptor = new ObjectDescriptor();
      targetDescriptor.setAutoWireEnabled(false);
      targetDescriptor.setClassName(Target.class.getName());
      FieldOperation fieldOperation = new FieldOperation("linkName", new StringDescriptor(linkName));
      targetDescriptor.addOperation(fieldOperation);
      targetsValueDescriptor.add(targetDescriptor);
      }
      descriptor.setValueDescriptors(targetsValueDescriptor);
      }

      return descriptor;
      }

      protected void addDescriptor(ObjectDescriptor objectDescriptor, Descriptor addedDescriptor, String fieldName) {
      FieldOperation fieldInjection = new FieldOperation();
      objectDescriptor.getOperations().add(fieldInjection);
      fieldInjection.setFieldName(fieldName);
      fieldInjection.setDescriptor(addedDescriptor);
      }

      At runTime, when I use the targets field of an activity having targets, the field is null..
      The message I get from the wiring :
      11:24:55,117 FNR [10|FieldOperation] injecting [] into targets

      Thanks for your help !
      Charles

      Then in runTime, I get null for the

        • 1. Re: ListDescriptor wiring
          csouillard

          sorry I made a mistake...
          The list is correctly injected but is empty !
          At runTime targets fiels (List) is empty but not null.
          I don't understand what I need to do to fill it in...

          • 2. Re: ListDescriptor wiring
            tom.baeyens

            for links, i'm not yet sure on how we best will model them.

            i don't think it's going to be possible to add the links to the executables themselves. because links will reference other nodes and the executables only can have a self contained object graph. (unless we start to tweak the wiring)

            we could think adding the links to the BpelProcess structure. or we could leverage the transitions as links.

            maybe we should discuss this during next week's meeting.

            • 3. Re: ListDescriptor wiring
              csouillard

              so you think it is normal to have an empty list ?

              • 4. Re: ListDescriptor wiring
                tom.baeyens

                that is something else. code seems good at a first glimpse. would require debug session to track down the real problem.

                if that is a problem, please point me to a failing test that i can look at.

                • 5. Re: ListDescriptor wiring
                  csouillard

                  Done. There is a new test (failing) in CollectionTests (wire package).
                  This test is easier than my current case but I think it could be the same kind of problem...
                  Both have problems with two levels injection...
                  In the new commited test, the list injection is good. Then we can find Target object but the linkName field was not injected (you can add traces as the first statement on the eauqals metohd of Target).

                  In my case, i want to inject a list in an activity : good, but I can not find targets object in it... There is one level difference between the unit test and my problem but in my case, the activty is injected in another object... so maybe this is the same kind of problem.

                  Please let me know !

                  Thanks

                  • 6. Re: ListDescriptor wiring
                    csouillard

                    I just added a third test which does exactly the same as my activity/links problem...

                    Waiting for your ideas/suggestions...