예제 #1
0
  public static final MethodParams _read(XoXMLStreamReader reader, RuntimeContext context)
      throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
      return null;
    }

    if (context == null) {
      context = new RuntimeContext();
    }

    MethodParams methodParams = new MethodParams();
    context.beforeUnmarshal(methodParams, LifecycleCallback.NONE);

    List<String> methodParam = null;

    // Check xsi:type
    QName xsiType = reader.getXsiType();
    if (xsiType != null) {
      if (("method-paramsType" != xsiType.getLocalPart())
          || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
        return context.unexpectedXsiType(reader, MethodParams.class);
      }
    }

    // Read attributes
    for (Attribute attribute : reader.getAttributes()) {
      if (("id" == attribute.getLocalName())
          && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
        // ATTRIBUTE: id
        String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        context.addXmlId(reader, id, methodParams);
        methodParams.id = id;
      } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
        context.unexpectedAttribute(attribute, new QName("", "id"));
      }
    }

    // Read elements
    for (XoXMLStreamReader elementReader : reader.getChildElements()) {
      if (("method-param" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: methodParam
        String methodParamItemRaw = elementReader.getElementAsString();

        String methodParamItem;
        try {
          methodParamItem = Adapters.collapsedStringAdapterAdapter.unmarshal(methodParamItemRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        if (methodParam == null) {
          methodParam = methodParams.methodParam;
          if (methodParam != null) {
            methodParam.clear();
          } else {
            methodParam = new ArrayList<String>();
          }
        }
        methodParam.add(methodParamItem);
      } else {
        context.unexpectedElement(
            elementReader, new QName("http://java.sun.com/xml/ns/javaee", "method-param"));
      }
    }
    if (methodParam != null) {
      methodParams.methodParam = methodParam;
    }

    context.afterUnmarshal(methodParams, LifecycleCallback.NONE);

    return methodParams;
  }
예제 #2
0
  public static final Timer _read(final XoXMLStreamReader reader, RuntimeContext context)
      throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
      return null;
    }

    if (context == null) {
      context = new RuntimeContext();
    }

    final Timer timer = new Timer();
    context.beforeUnmarshal(timer, LifecycleCallback.NONE);

    ArrayList<Text> descriptions = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
      if (("timerType" != xsiType.getLocalPart())
          || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
        return context.unexpectedXsiType(reader, Timer.class);
      }
    }

    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
      if (("id" == attribute.getLocalName())
          && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
        // ATTRIBUTE: id
        final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        context.addXmlId(reader, id, timer);
        timer.id = id;
      } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
        context.unexpectedAttribute(attribute, new QName("", "id"));
      }
    }

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
      if (("description" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: descriptions
        final Text descriptionsItem = readText(elementReader, context);
        if (descriptions == null) {
          descriptions = new ArrayList<Text>();
        }
        descriptions.add(descriptionsItem);
      } else if (("schedule" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: schedule
        final TimerSchedule schedule = readTimerSchedule(elementReader, context);
        timer.schedule = schedule;
      } else if (("start" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: start
        final XMLGregorianCalendar start =
            datatypeFactory.newXMLGregorianCalendar(elementReader.getElementAsString());
        timer.start = start;
      } else if (("end" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: end
        final XMLGregorianCalendar end =
            datatypeFactory.newXMLGregorianCalendar(elementReader.getElementAsString());
        timer.end = end;
      } else if (("timeout-method" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: timeoutMethod
        final NamedMethod timeoutMethod = readNamedMethod(elementReader, context);
        timer.timeoutMethod = timeoutMethod;
      } else if (("persistent" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: persistent
        final Boolean persistent =
            ("1".equals(elementReader.getElementAsString())
                || "true".equals(elementReader.getElementAsString()));
        timer.persistent = persistent;
      } else if (("timezone" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: timezone
        final String timezoneRaw = elementReader.getElementAsString();

        final String timezone;
        try {
          timezone = Adapters.collapsedStringAdapterAdapter.unmarshal(timezoneRaw);
        } catch (final Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        timer.timezone = timezone;
      } else if (("info" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: info
        final String infoRaw = elementReader.getElementAsString();

        final String info;
        try {
          info = Adapters.collapsedStringAdapterAdapter.unmarshal(infoRaw);
        } catch (final Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        timer.info = info;
      } else {
        context.unexpectedElement(
            elementReader,
            new QName("http://java.sun.com/xml/ns/javaee", "description"),
            new QName("http://java.sun.com/xml/ns/javaee", "schedule"),
            new QName("http://java.sun.com/xml/ns/javaee", "start"),
            new QName("http://java.sun.com/xml/ns/javaee", "end"),
            new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"),
            new QName("http://java.sun.com/xml/ns/javaee", "persistent"),
            new QName("http://java.sun.com/xml/ns/javaee", "timezone"),
            new QName("http://java.sun.com/xml/ns/javaee", "info"));
      }
    }
    if (descriptions != null) {
      try {
        timer.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
      } catch (final Exception e) {
        context.setterError(reader, Timer.class, "setDescriptions", Text[].class, e);
      }
    }

    context.afterUnmarshal(timer, LifecycleCallback.NONE);

    return timer;
  }
예제 #3
0
  public static final TimerSchedule _read(XoXMLStreamReader reader, RuntimeContext context)
      throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
      return null;
    }

    if (context == null) {
      context = new RuntimeContext();
    }

    TimerSchedule timerSchedule = new TimerSchedule();
    context.beforeUnmarshal(timerSchedule, LifecycleCallback.NONE);

    // Check xsi:type
    QName xsiType = reader.getXsiType();
    if (xsiType != null) {
      if (("timer-scheduleType" != xsiType.getLocalPart())
          || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
        return context.unexpectedXsiType(reader, TimerSchedule.class);
      }
    }

    // Read attributes
    for (Attribute attribute : reader.getAttributes()) {
      if (("id" == attribute.getLocalName())
          && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
        // ATTRIBUTE: id
        String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        context.addXmlId(reader, id, timerSchedule);
        timerSchedule.id = id;
      } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
        context.unexpectedAttribute(attribute, new QName("", "id"));
      }
    }

    // Read elements
    for (XoXMLStreamReader elementReader : reader.getChildElements()) {
      if (("second" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: second
        String secondRaw = elementReader.getElementAsString();

        String second;
        try {
          second = Adapters.collapsedStringAdapterAdapter.unmarshal(secondRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        timerSchedule.second = second;
      } else if (("minute" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: minute
        String minuteRaw = elementReader.getElementAsString();

        String minute;
        try {
          minute = Adapters.collapsedStringAdapterAdapter.unmarshal(minuteRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        timerSchedule.minute = minute;
      } else if (("hour" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: hour
        String hourRaw = elementReader.getElementAsString();

        String hour;
        try {
          hour = Adapters.collapsedStringAdapterAdapter.unmarshal(hourRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        timerSchedule.hour = hour;
      } else if (("day-of-month" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: dayOfMonth
        String dayOfMonthRaw = elementReader.getElementAsString();

        String dayOfMonth;
        try {
          dayOfMonth = Adapters.collapsedStringAdapterAdapter.unmarshal(dayOfMonthRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        timerSchedule.dayOfMonth = dayOfMonth;
      } else if (("month" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: month
        String monthRaw = elementReader.getElementAsString();

        String month;
        try {
          month = Adapters.collapsedStringAdapterAdapter.unmarshal(monthRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        timerSchedule.month = month;
      } else if (("day-of-week" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: dayOfWeek
        String dayOfWeekRaw = elementReader.getElementAsString();

        String dayOfWeek;
        try {
          dayOfWeek = Adapters.collapsedStringAdapterAdapter.unmarshal(dayOfWeekRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        timerSchedule.dayOfWeek = dayOfWeek;
      } else if (("year" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: year
        String yearRaw = elementReader.getElementAsString();

        String year;
        try {
          year = Adapters.collapsedStringAdapterAdapter.unmarshal(yearRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        timerSchedule.year = year;
      } else {
        context.unexpectedElement(
            elementReader,
            new QName("http://java.sun.com/xml/ns/javaee", "second"),
            new QName("http://java.sun.com/xml/ns/javaee", "minute"),
            new QName("http://java.sun.com/xml/ns/javaee", "hour"),
            new QName("http://java.sun.com/xml/ns/javaee", "day-of-month"),
            new QName("http://java.sun.com/xml/ns/javaee", "month"),
            new QName("http://java.sun.com/xml/ns/javaee", "day-of-week"),
            new QName("http://java.sun.com/xml/ns/javaee", "year"));
      }
    }

    context.afterUnmarshal(timerSchedule, LifecycleCallback.NONE);

    return timerSchedule;
  }
예제 #4
0
  public static final MethodPermission _read(final XoXMLStreamReader reader, RuntimeContext context)
      throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
      return null;
    }

    if (context == null) {
      context = new RuntimeContext();
    }

    final MethodPermission methodPermission = new MethodPermission();
    context.beforeUnmarshal(methodPermission, LifecycleCallback.NONE);

    ArrayList<Text> descriptions = null;
    List<String> roleName = null;
    List<Method> method = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
      if (("method-permissionType" != xsiType.getLocalPart())
          || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
        return context.unexpectedXsiType(reader, MethodPermission.class);
      }
    }

    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
      if (("id" == attribute.getLocalName())
          && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
        // ATTRIBUTE: id
        final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        context.addXmlId(reader, id, methodPermission);
        methodPermission.id = id;
      } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
        context.unexpectedAttribute(attribute, new QName("", "id"));
      }
    }

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
      if (("description" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: descriptions
        final Text descriptionsItem = readText(elementReader, context);
        if (descriptions == null) {
          descriptions = new ArrayList<Text>();
        }
        descriptions.add(descriptionsItem);
      } else if (("role-name" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: roleName
        final String roleNameItemRaw = elementReader.getElementAsString();

        final String roleNameItem;
        try {
          roleNameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(roleNameItemRaw);
        } catch (final Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        if (roleName == null) {
          roleName = methodPermission.roleName;
          if (roleName != null) {
            roleName.clear();
          } else {
            roleName = new ArrayList<String>();
          }
        }
        roleName.add(roleNameItem);
      } else if (("unchecked" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: unchecked
        final Empty unchecked = readEmpty(elementReader, context);
        methodPermission.unchecked = unchecked;
      } else if (("method" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: method
        final Method methodItem = readMethod(elementReader, context);
        if (method == null) {
          method = methodPermission.method;
          if (method != null) {
            method.clear();
          } else {
            method = new ArrayList<Method>();
          }
        }
        method.add(methodItem);
      } else {
        context.unexpectedElement(
            elementReader,
            new QName("http://java.sun.com/xml/ns/javaee", "description"),
            new QName("http://java.sun.com/xml/ns/javaee", "role-name"),
            new QName("http://java.sun.com/xml/ns/javaee", "unchecked"),
            new QName("http://java.sun.com/xml/ns/javaee", "method"));
      }
    }
    if (descriptions != null) {
      try {
        methodPermission.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
      } catch (final Exception e) {
        context.setterError(reader, MethodPermission.class, "setDescriptions", Text[].class, e);
      }
    }
    if (roleName != null) {
      methodPermission.roleName = roleName;
    }
    if (method != null) {
      methodPermission.method = method;
    }

    context.afterUnmarshal(methodPermission, LifecycleCallback.NONE);

    return methodPermission;
  }
예제 #5
0
  public static final SecurityIdentity _read(final XoXMLStreamReader reader, RuntimeContext context)
      throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
      return null;
    }

    if (context == null) {
      context = new RuntimeContext();
    }

    final SecurityIdentity securityIdentity = new SecurityIdentity();
    context.beforeUnmarshal(securityIdentity, LifecycleCallback.NONE);

    ArrayList<Text> descriptions = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
      if (("security-identityType" != xsiType.getLocalPart())
          || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
        return context.unexpectedXsiType(reader, SecurityIdentity.class);
      }
    }

    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
      if (("id" == attribute.getLocalName())
          && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
        // ATTRIBUTE: id
        final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        context.addXmlId(reader, id, securityIdentity);
        securityIdentity.id = id;
      } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
        context.unexpectedAttribute(attribute, new QName("", "id"));
      }
    }

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
      if (("description" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: descriptions
        final Text descriptionsItem = readText(elementReader, context);
        if (descriptions == null) {
          descriptions = new ArrayList<Text>();
        }
        descriptions.add(descriptionsItem);
      } else if (("use-caller-identity" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: useCallerIdentity
        final Empty useCallerIdentity = readEmpty(elementReader, context);
        securityIdentity.useCallerIdentity = useCallerIdentity;
      } else if (("run-as" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: runAs
        final RunAs runAs = readRunAs(elementReader, context);
        securityIdentity.runAs = runAs;
      } else {
        context.unexpectedElement(
            elementReader,
            new QName("http://java.sun.com/xml/ns/javaee", "description"),
            new QName("http://java.sun.com/xml/ns/javaee", "use-caller-identity"),
            new QName("http://java.sun.com/xml/ns/javaee", "run-as"));
      }
    }
    if (descriptions != null) {
      try {
        securityIdentity.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
      } catch (final Exception e) {
        context.setterError(reader, SecurityIdentity.class, "setDescriptions", Text[].class, e);
      }
    }

    context.afterUnmarshal(securityIdentity, LifecycleCallback.NONE);

    return securityIdentity;
  }
  public static final ServiceEndpointMethodMapping _read(
      final XoXMLStreamReader reader, RuntimeContext context) throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
      return null;
    }

    if (context == null) {
      context = new RuntimeContext();
    }

    final ServiceEndpointMethodMapping serviceEndpointMethodMapping =
        new ServiceEndpointMethodMapping();
    context.beforeUnmarshal(serviceEndpointMethodMapping, LifecycleCallback.NONE);

    List<MethodParamPartsMapping> methodParamPartsMapping = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
      if (("service-endpoint-method-mappingType" != xsiType.getLocalPart())
          || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
        return context.unexpectedXsiType(reader, ServiceEndpointMethodMapping.class);
      }
    }

    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
      if (("id" == attribute.getLocalName())
          && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
        // ATTRIBUTE: id
        final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        context.addXmlId(reader, id, serviceEndpointMethodMapping);
        serviceEndpointMethodMapping.id = id;
      } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
        context.unexpectedAttribute(attribute, new QName("", "id"));
      }
    }

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
      if (("java-method-name" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: javaMethodName
        final String javaMethodNameRaw = elementReader.getElementAsString();

        final String javaMethodName;
        try {
          javaMethodName = Adapters.collapsedStringAdapterAdapter.unmarshal(javaMethodNameRaw);
        } catch (final Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        serviceEndpointMethodMapping.javaMethodName = javaMethodName;
      } else if (("wsdl-operation" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: wsdlOperation
        final String wsdlOperationRaw = elementReader.getElementAsString();

        final String wsdlOperation;
        try {
          wsdlOperation = Adapters.collapsedStringAdapterAdapter.unmarshal(wsdlOperationRaw);
        } catch (final Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        serviceEndpointMethodMapping.wsdlOperation = wsdlOperation;
      } else if (("wrapped-element" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: wrappedElement
        final Element wrappedElement = elementReader.getElementAsDomElement();
        serviceEndpointMethodMapping.wrappedElement = wrappedElement;
      } else if (("method-param-parts-mapping" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: methodParamPartsMapping
        final MethodParamPartsMapping methodParamPartsMappingItem =
            readMethodParamPartsMapping(elementReader, context);
        if (methodParamPartsMapping == null) {
          methodParamPartsMapping = serviceEndpointMethodMapping.methodParamPartsMapping;
          if (methodParamPartsMapping != null) {
            methodParamPartsMapping.clear();
          } else {
            methodParamPartsMapping = new ArrayList<MethodParamPartsMapping>();
          }
        }
        methodParamPartsMapping.add(methodParamPartsMappingItem);
      } else if (("wsdl-return-value-mapping" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: wsdlReturnValueMapping
        final WsdlReturnValueMapping wsdlReturnValueMapping =
            readWsdlReturnValueMapping(elementReader, context);
        serviceEndpointMethodMapping.wsdlReturnValueMapping = wsdlReturnValueMapping;
      } else {
        context.unexpectedElement(
            elementReader,
            new QName("http://java.sun.com/xml/ns/javaee", "java-method-name"),
            new QName("http://java.sun.com/xml/ns/javaee", "wsdl-operation"),
            new QName("http://java.sun.com/xml/ns/javaee", "wrapped-element"),
            new QName("http://java.sun.com/xml/ns/javaee", "method-param-parts-mapping"),
            new QName("http://java.sun.com/xml/ns/javaee", "wsdl-return-value-mapping"));
      }
    }
    if (methodParamPartsMapping != null) {
      serviceEndpointMethodMapping.methodParamPartsMapping = methodParamPartsMapping;
    }

    context.afterUnmarshal(serviceEndpointMethodMapping, LifecycleCallback.NONE);

    return serviceEndpointMethodMapping;
  }
예제 #7
0
  public static final Module _read(XoXMLStreamReader reader, RuntimeContext context)
      throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
      return null;
    }

    if (context == null) {
      context = new RuntimeContext();
    }

    Module module = new Module();
    context.beforeUnmarshal(module, LifecycleCallback.NONE);

    // Check xsi:type
    QName xsiType = reader.getXsiType();
    if (xsiType != null) {
      if (("moduleType" != xsiType.getLocalPart())
          || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
        return context.unexpectedXsiType(reader, Module.class);
      }
    }

    // Read attributes
    for (Attribute attribute : reader.getAttributes()) {
      if (("id" == attribute.getLocalName())
          && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
        // ATTRIBUTE: id
        String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        context.addXmlId(reader, id, module);
        module.id = id;
      } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
        context.unexpectedAttribute(attribute, new QName("", "id"));
      }
    }

    // Read elements
    for (XoXMLStreamReader elementReader : reader.getChildElements()) {
      if (("connector" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: connector
        String connectorRaw = elementReader.getElementAsString();

        String connector;
        try {
          connector = Adapters.collapsedStringAdapterAdapter.unmarshal(connectorRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        module.connector = connector;
      } else if (("ejb" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: ejb
        String ejbRaw = elementReader.getElementAsString();

        String ejb;
        try {
          ejb = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        module.ejb = ejb;
      } else if (("java" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: java
        String javaRaw = elementReader.getElementAsString();

        String java;
        try {
          java = Adapters.collapsedStringAdapterAdapter.unmarshal(javaRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        module.java = java;
      } else if (("web" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: web
        Web web = readWeb(elementReader, context);
        module.web = web;
      } else if (("alt-dd" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: altDd
        String altDdRaw = elementReader.getElementAsString();

        String altDd;
        try {
          altDd = Adapters.collapsedStringAdapterAdapter.unmarshal(altDdRaw);
        } catch (Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        module.altDd = altDd;
      } else {
        context.unexpectedElement(
            elementReader,
            new QName("http://java.sun.com/xml/ns/javaee", "connector"),
            new QName("http://java.sun.com/xml/ns/javaee", "ejb"),
            new QName("http://java.sun.com/xml/ns/javaee", "java"),
            new QName("http://java.sun.com/xml/ns/javaee", "web"),
            new QName("http://java.sun.com/xml/ns/javaee", "alt-dd"));
      }
    }

    context.afterUnmarshal(module, LifecycleCallback.NONE);

    return module;
  }
예제 #8
0
  public static final Application _read(final XoXMLStreamReader reader, RuntimeContext context)
      throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
      return null;
    }

    if (context == null) {
      context = new RuntimeContext();
    }

    final Application application = new Application();
    context.beforeUnmarshal(application, LifecycleCallback.NONE);

    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    List<Module> module = null;
    List<SecurityRole> securityRole = null;
    KeyedCollection<String, EnvEntry> envEntry = null;
    KeyedCollection<String, EjbRef> ejbRef = null;
    KeyedCollection<String, EjbLocalRef> ejbLocalRef = null;
    KeyedCollection<String, ServiceRef> serviceRef = null;
    KeyedCollection<String, ResourceRef> resourceRef = null;
    KeyedCollection<String, ResourceEnvRef> resourceEnvRef = null;
    KeyedCollection<String, MessageDestinationRef> messageDestinationRef = null;
    KeyedCollection<String, PersistenceContextRef> persistenceContextRef = null;
    KeyedCollection<String, PersistenceUnitRef> persistenceUnitRef = null;
    KeyedCollection<String, MessageDestination> messageDestination = null;
    KeyedCollection<String, DataSource> dataSource = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
      if (("applicationType" != xsiType.getLocalPart())
          || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
        return context.unexpectedXsiType(reader, Application.class);
      }
    }

    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
      if (("version" == attribute.getLocalName())
          && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
        // ATTRIBUTE: version
        application.version =
            Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
      } else if (("id" == attribute.getLocalName())
          && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
        // ATTRIBUTE: id
        final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        context.addXmlId(reader, id, application);
        application.id = id;
      } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
        context.unexpectedAttribute(attribute, new QName("", "version"), new QName("", "id"));
      }
    }

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
      if (("application-name" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: applicationName
        final String applicationNameRaw = elementReader.getElementAsString();

        final String applicationName;
        try {
          applicationName = Adapters.collapsedStringAdapterAdapter.unmarshal(applicationNameRaw);
        } catch (final Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        application.applicationName = applicationName;
      } else if (("description" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: descriptions
        final Text descriptionsItem = readText(elementReader, context);
        if (descriptions == null) {
          descriptions = new ArrayList<Text>();
        }
        descriptions.add(descriptionsItem);
      } else if (("display-name" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: displayNames
        final Text displayNamesItem = readText(elementReader, context);
        if (displayNames == null) {
          displayNames = new ArrayList<Text>();
        }
        displayNames.add(displayNamesItem);
      } else if (("icon" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: icon
        final Icon iconItem = readIcon(elementReader, context);
        if (icon == null) {
          icon = application.icon;
          if (icon != null) {
            icon.clear();
          } else {
            icon = new LocalCollection<Icon>();
          }
        }
        icon.add(iconItem);
      } else if (("initialize-in-order" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: initializeInOrder
        final Boolean initializeInOrder =
            ("1".equals(elementReader.getElementAsString())
                || "true".equals(elementReader.getElementAsString()));
        application.initializeInOrder = initializeInOrder;
      } else if (("module" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: module
        final Module moduleItem = readModule(elementReader, context);
        if (module == null) {
          module = application.module;
          if (module != null) {
            module.clear();
          } else {
            module = new ArrayList<Module>();
          }
        }
        module.add(moduleItem);
      } else if (("security-role" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: securityRole
        final SecurityRole securityRoleItem = readSecurityRole(elementReader, context);
        if (securityRole == null) {
          securityRole = application.securityRole;
          if (securityRole != null) {
            securityRole.clear();
          } else {
            securityRole = new ArrayList<SecurityRole>();
          }
        }
        securityRole.add(securityRoleItem);
      } else if (("library-directory" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: libraryDirectory
        final String libraryDirectoryRaw = elementReader.getElementAsString();

        final String libraryDirectory;
        try {
          libraryDirectory = Adapters.collapsedStringAdapterAdapter.unmarshal(libraryDirectoryRaw);
        } catch (final Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        application.libraryDirectory = libraryDirectory;
      } else if (("env-entry" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: envEntry
        final EnvEntry envEntryItem = readEnvEntry(elementReader, context);
        if (envEntry == null) {
          envEntry = application.envEntry;
          if (envEntry != null) {
            envEntry.clear();
          } else {
            envEntry = new KeyedCollection<String, EnvEntry>();
          }
        }
        envEntry.add(envEntryItem);
      } else if (("ejb-ref" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: ejbRef
        final EjbRef ejbRefItem = readEjbRef(elementReader, context);
        if (ejbRef == null) {
          ejbRef = application.ejbRef;
          if (ejbRef != null) {
            ejbRef.clear();
          } else {
            ejbRef = new KeyedCollection<String, EjbRef>();
          }
        }
        ejbRef.add(ejbRefItem);
      } else if (("ejb-local-ref" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: ejbLocalRef
        final EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context);
        if (ejbLocalRef == null) {
          ejbLocalRef = application.ejbLocalRef;
          if (ejbLocalRef != null) {
            ejbLocalRef.clear();
          } else {
            ejbLocalRef = new KeyedCollection<String, EjbLocalRef>();
          }
        }
        ejbLocalRef.add(ejbLocalRefItem);
      } else if (("service-ref" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: serviceRef
        final ServiceRef serviceRefItem = readServiceRef(elementReader, context);
        if (serviceRef == null) {
          serviceRef = application.serviceRef;
          if (serviceRef != null) {
            serviceRef.clear();
          } else {
            serviceRef = new KeyedCollection<String, ServiceRef>();
          }
        }
        serviceRef.add(serviceRefItem);
      } else if (("resource-ref" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: resourceRef
        final ResourceRef resourceRefItem = readResourceRef(elementReader, context);
        if (resourceRef == null) {
          resourceRef = application.resourceRef;
          if (resourceRef != null) {
            resourceRef.clear();
          } else {
            resourceRef = new KeyedCollection<String, ResourceRef>();
          }
        }
        resourceRef.add(resourceRefItem);
      } else if (("resource-env-ref" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: resourceEnvRef
        final ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context);
        if (resourceEnvRef == null) {
          resourceEnvRef = application.resourceEnvRef;
          if (resourceEnvRef != null) {
            resourceEnvRef.clear();
          } else {
            resourceEnvRef = new KeyedCollection<String, ResourceEnvRef>();
          }
        }
        resourceEnvRef.add(resourceEnvRefItem);
      } else if (("message-destination-ref" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: messageDestinationRef
        final MessageDestinationRef messageDestinationRefItem =
            readMessageDestinationRef(elementReader, context);
        if (messageDestinationRef == null) {
          messageDestinationRef = application.messageDestinationRef;
          if (messageDestinationRef != null) {
            messageDestinationRef.clear();
          } else {
            messageDestinationRef = new KeyedCollection<String, MessageDestinationRef>();
          }
        }
        messageDestinationRef.add(messageDestinationRefItem);
      } else if (("persistence-context-ref" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: persistenceContextRef
        final PersistenceContextRef persistenceContextRefItem =
            readPersistenceContextRef(elementReader, context);
        if (persistenceContextRef == null) {
          persistenceContextRef = application.persistenceContextRef;
          if (persistenceContextRef != null) {
            persistenceContextRef.clear();
          } else {
            persistenceContextRef = new KeyedCollection<String, PersistenceContextRef>();
          }
        }
        persistenceContextRef.add(persistenceContextRefItem);
      } else if (("persistence-unit-ref" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: persistenceUnitRef
        final PersistenceUnitRef persistenceUnitRefItem =
            readPersistenceUnitRef(elementReader, context);
        if (persistenceUnitRef == null) {
          persistenceUnitRef = application.persistenceUnitRef;
          if (persistenceUnitRef != null) {
            persistenceUnitRef.clear();
          } else {
            persistenceUnitRef = new KeyedCollection<String, PersistenceUnitRef>();
          }
        }
        persistenceUnitRef.add(persistenceUnitRefItem);
      } else if (("message-destination" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: messageDestination
        final MessageDestination messageDestinationItem =
            readMessageDestination(elementReader, context);
        if (messageDestination == null) {
          messageDestination = application.messageDestination;
          if (messageDestination != null) {
            messageDestination.clear();
          } else {
            messageDestination = new KeyedCollection<String, MessageDestination>();
          }
        }
        messageDestination.add(messageDestinationItem);
      } else if (("data-source" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: dataSource
        final DataSource dataSourceItem = readDataSource(elementReader, context);
        if (dataSource == null) {
          dataSource = application.dataSource;
          if (dataSource != null) {
            dataSource.clear();
          } else {
            dataSource = new KeyedCollection<String, DataSource>();
          }
        }
        dataSource.add(dataSourceItem);
      } else {
        context.unexpectedElement(
            elementReader,
            new QName("http://java.sun.com/xml/ns/javaee", "application-name"),
            new QName("http://java.sun.com/xml/ns/javaee", "description"),
            new QName("http://java.sun.com/xml/ns/javaee", "display-name"),
            new QName("http://java.sun.com/xml/ns/javaee", "icon"),
            new QName("http://java.sun.com/xml/ns/javaee", "initialize-in-order"),
            new QName("http://java.sun.com/xml/ns/javaee", "module"),
            new QName("http://java.sun.com/xml/ns/javaee", "security-role"),
            new QName("http://java.sun.com/xml/ns/javaee", "library-directory"),
            new QName("http://java.sun.com/xml/ns/javaee", "env-entry"),
            new QName("http://java.sun.com/xml/ns/javaee", "ejb-ref"),
            new QName("http://java.sun.com/xml/ns/javaee", "ejb-local-ref"),
            new QName("http://java.sun.com/xml/ns/javaee", "service-ref"),
            new QName("http://java.sun.com/xml/ns/javaee", "resource-ref"),
            new QName("http://java.sun.com/xml/ns/javaee", "resource-env-ref"),
            new QName("http://java.sun.com/xml/ns/javaee", "message-destination-ref"),
            new QName("http://java.sun.com/xml/ns/javaee", "persistence-context-ref"),
            new QName("http://java.sun.com/xml/ns/javaee", "persistence-unit-ref"),
            new QName("http://java.sun.com/xml/ns/javaee", "message-destination"),
            new QName("http://java.sun.com/xml/ns/javaee", "data-source"));
      }
    }
    if (descriptions != null) {
      try {
        application.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
      } catch (final Exception e) {
        context.setterError(reader, Application.class, "setDescriptions", Text[].class, e);
      }
    }
    if (displayNames != null) {
      try {
        application.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
      } catch (final Exception e) {
        context.setterError(reader, Application.class, "setDisplayNames", Text[].class, e);
      }
    }
    if (icon != null) {
      application.icon = icon;
    }
    if (module != null) {
      application.module = module;
    }
    if (securityRole != null) {
      application.securityRole = securityRole;
    }
    if (envEntry != null) {
      application.envEntry = envEntry;
    }
    if (ejbRef != null) {
      application.ejbRef = ejbRef;
    }
    if (ejbLocalRef != null) {
      application.ejbLocalRef = ejbLocalRef;
    }
    if (serviceRef != null) {
      application.serviceRef = serviceRef;
    }
    if (resourceRef != null) {
      application.resourceRef = resourceRef;
    }
    if (resourceEnvRef != null) {
      application.resourceEnvRef = resourceEnvRef;
    }
    if (messageDestinationRef != null) {
      application.messageDestinationRef = messageDestinationRef;
    }
    if (persistenceContextRef != null) {
      application.persistenceContextRef = persistenceContextRef;
    }
    if (persistenceUnitRef != null) {
      application.persistenceUnitRef = persistenceUnitRef;
    }
    if (messageDestination != null) {
      application.messageDestination = messageDestination;
    }
    if (dataSource != null) {
      application.dataSource = dataSource;
    }

    context.afterUnmarshal(application, LifecycleCallback.NONE);

    return application;
  }
예제 #9
0
  public static final Listener _read(final XoXMLStreamReader reader, RuntimeContext context)
      throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
      return null;
    }

    if (context == null) {
      context = new RuntimeContext();
    }

    final Listener listener = new Listener();
    context.beforeUnmarshal(listener, LifecycleCallback.NONE);

    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
      if (("listenerType" != xsiType.getLocalPart())
          || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
        return context.unexpectedXsiType(reader, Listener.class);
      }
    }

    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
      if (("id" == attribute.getLocalName())
          && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
        // ATTRIBUTE: id
        final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        context.addXmlId(reader, id, listener);
        listener.id = id;
      } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
        context.unexpectedAttribute(attribute, new QName("", "id"));
      }
    }

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
      if (("description" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: descriptions
        final Text descriptionsItem = readText(elementReader, context);
        if (descriptions == null) {
          descriptions = new ArrayList<Text>();
        }
        descriptions.add(descriptionsItem);
      } else if (("display-name" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: displayNames
        final Text displayNamesItem = readText(elementReader, context);
        if (displayNames == null) {
          displayNames = new ArrayList<Text>();
        }
        displayNames.add(displayNamesItem);
      } else if (("icon" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: icon
        final Icon iconItem = readIcon(elementReader, context);
        if (icon == null) {
          icon = listener.icon;
          if (icon != null) {
            icon.clear();
          } else {
            icon = new LocalCollection<Icon>();
          }
        }
        icon.add(iconItem);
      } else if (("listener-class" == elementReader.getLocalName())
          && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
        // ELEMENT: listenerClass
        final String listenerClassRaw = elementReader.getElementAsString();

        final String listenerClass;
        try {
          listenerClass = Adapters.collapsedStringAdapterAdapter.unmarshal(listenerClassRaw);
        } catch (final Exception e) {
          context.xmlAdapterError(
              elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
          continue;
        }

        listener.listenerClass = listenerClass;
      } else {
        context.unexpectedElement(
            elementReader,
            new QName("http://java.sun.com/xml/ns/javaee", "description"),
            new QName("http://java.sun.com/xml/ns/javaee", "display-name"),
            new QName("http://java.sun.com/xml/ns/javaee", "icon"),
            new QName("http://java.sun.com/xml/ns/javaee", "listener-class"));
      }
    }
    if (descriptions != null) {
      try {
        listener.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
      } catch (final Exception e) {
        context.setterError(reader, Listener.class, "setDescriptions", Text[].class, e);
      }
    }
    if (displayNames != null) {
      try {
        listener.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
      } catch (final Exception e) {
        context.setterError(reader, Listener.class, "setDisplayNames", Text[].class, e);
      }
    }
    if (icon != null) {
      listener.icon = icon;
    }

    context.afterUnmarshal(listener, LifecycleCallback.NONE);

    return listener;
  }