4 Replies Latest reply on Oct 4, 2007 5:31 AM by Alexei none

    How to initialize List of custom object by means of componen

    Alexei none Apprentice

      I have a stateful bean with a list of custom objects inside.


      @Local
      public interface Toolbar {

      public List<ProcessDefinition> getAvailableProcesses();
      public void create();
      public void destroy();

      }

      and implementation

      @Stateful
      @Name("toolbarImpl")
      @Scope(ScopeType.SESSION)
      public class ToolbarImpl implements Toolbar {

      private List<ProcessDefinition> availableProcesses = new ArrayList<ProcessDefinition>();


      @DataModel
      public List<ProcessDefinition> getAvailableProcesses() {
      return availableProcesses;
      }

      public void setAvailableProcesses(List<ProcessDefinition> processes) {
      availableProcesses = processes;
      }

      @Create
      public void create() {

      }

      }

      then I defined a schema in component_types.xsd


      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      elementFormDefault="qualified"
      targetNamespace="http://my"
      attributeFormDefault="unqualified">

      <xs:element name="toolbarImpl">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="availableProcesses" minOccurs="0" maxOccurs="unbounded" type="processDefinition"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>

      <xs:complexType name="processDefinition">
      <xs:attribute name="processName"/>
      <xs:attribute name="description"/>
      <xs:attribute name="processIcon"/>
      </xs:complexType>

      </xs:schema>

      and included that schema in my components.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
      .........................
      xmlns:my="http://my" xsi:schemaLocation="
      ........................
      http://my component_types.xsd ">

      ...................................

      <my:toolbarImpl>
      <my:availableProcesses>
      <my:processDefinition my:processName="enrolment"
      my:description="enrolment"
      my:processIcon="img/icons/Text_Document.png"/>
      </my:availableProcesses>
      </my:toolbarImpl>

      </components>


      So, I've got no errors and empty availableProcesses. Why?

      P.S. Server log


      2007-10-03 18:58:19,781 DEBUG [org.jboss.ejb3.Ejb3DescriptorHandler] adding class annotation org.jboss.annotation.internal.DefaultInterceptorMarker to my.ToolbarImpl org.jboss.annotation.internal.DefaultInterceptorMarkerImpl@193b604
      2007-10-03 18:58:19,781 DEBUG [org.jboss.ejb3.Ejb3DescriptorHandler] adding class annotation org.jboss.annotation.internal.DefaultInterceptorMarker to my.ToolbarImpl org.jboss.annotation.internal.DefaultInterceptorMarkerImpl@193b604
      2007-10-03 18:58:19,781 DEBUG [org.jboss.ejb3.Ejb3AnnotationHandler] found EJB3: ejbName=ToolbarImpl, class=my.ToolbarImpl, type=STATEFUL
      2007-10-03 18:58:19,781 DEBUG [org.jboss.ejb3.ProxyDeployer] no declared remote bindings for : ToolbarImpl


      2007-10-03 18:58:20,843 DEBUG [org.jboss.ejb3.EJBContainer] Initialising interceptors for ToolbarImpl...
      2007-10-03 18:58:20,843 DEBUG [org.jboss.ejb3.EJBContainer] Default interceptors: [InterceptorInfo{class=class org.jboss.seam.ejb.SeamInterceptor}]