Example #1
0
  public static final void _write(
      XoXMLStreamWriter writer, MethodParams methodParams, RuntimeContext context)
      throws Exception {
    if (methodParams == null) {
      writer.writeXsiNil();
      return;
    }

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

    if (MethodParams.class != methodParams.getClass()) {
      context.unexpectedSubclass(writer, methodParams, MethodParams.class);
      return;
    }

    context.beforeMarshal(methodParams, LifecycleCallback.NONE);

    // ATTRIBUTE: id
    String idRaw = methodParams.id;
    if (idRaw != null) {
      String id = null;
      try {
        id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
      } catch (Exception e) {
        context.xmlAdapterError(
            methodParams, "id", CollapsedStringAdapter.class, String.class, String.class, e);
      }
      writer.writeAttribute("", "", "id", id);
    }

    // ELEMENT: methodParam
    List<String> methodParamRaw = methodParams.methodParam;
    if (methodParamRaw != null) {
      for (String methodParamItem : methodParamRaw) {
        String methodParam = null;
        try {
          methodParam = Adapters.collapsedStringAdapterAdapter.marshal(methodParamItem);
        } catch (Exception e) {
          context.xmlAdapterError(
              methodParams, "methodParam", CollapsedStringAdapter.class, List.class, List.class, e);
        }
        if (methodParam != null) {
          writer.writeStartElementWithAutoPrefix(
              "http://java.sun.com/xml/ns/javaee", "method-param");
          writer.writeCharacters(methodParam);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(methodParams, "methodParam");
        }
      }
    }

    context.afterMarshal(methodParams, LifecycleCallback.NONE);
  }
Example #2
0
  public static final void _write(
      final XoXMLStreamWriter writer, final Timer timer, RuntimeContext context) throws Exception {
    if (timer == null) {
      writer.writeXsiNil();
      return;
    }

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

    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Timer.class != timer.getClass()) {
      context.unexpectedSubclass(writer, timer, Timer.class);
      return;
    }

    context.beforeMarshal(timer, LifecycleCallback.NONE);

    // ATTRIBUTE: id
    final String idRaw = timer.id;
    if (idRaw != null) {
      String id = null;
      try {
        id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
      } catch (final Exception e) {
        context.xmlAdapterError(
            timer, "id", CollapsedStringAdapter.class, String.class, String.class, e);
      }
      writer.writeAttribute("", "", "id", id);
    }

    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
      descriptions = timer.getDescriptions();
    } catch (final Exception e) {
      context.getterError(timer, "descriptions", Timer.class, "getDescriptions", e);
    }
    if (descriptions != null) {
      for (final Text descriptionsItem : descriptions) {
        if (descriptionsItem != null) {
          writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
          writeText(writer, descriptionsItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(timer, "descriptions");
        }
      }
    }

    // ELEMENT: schedule
    final TimerSchedule schedule = timer.schedule;
    if (schedule != null) {
      writer.writeStartElement(prefix, "schedule", "http://java.sun.com/xml/ns/javaee");
      writeTimerSchedule(writer, schedule, context);
      writer.writeEndElement();
    } else {
      context.unexpectedNullValue(timer, "schedule");
    }

    // ELEMENT: start
    final XMLGregorianCalendar start = timer.start;
    if (start != null) {
      writer.writeStartElement(prefix, "start", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(start.toXMLFormat());
      writer.writeEndElement();
    }

    // ELEMENT: end
    final XMLGregorianCalendar end = timer.end;
    if (end != null) {
      writer.writeStartElement(prefix, "end", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(end.toXMLFormat());
      writer.writeEndElement();
    }

    // ELEMENT: timeoutMethod
    final NamedMethod timeoutMethod = timer.timeoutMethod;
    if (timeoutMethod != null) {
      writer.writeStartElement(prefix, "timeout-method", "http://java.sun.com/xml/ns/javaee");
      writeNamedMethod(writer, timeoutMethod, context);
      writer.writeEndElement();
    } else {
      context.unexpectedNullValue(timer, "timeoutMethod");
    }

    // ELEMENT: persistent
    final Boolean persistent = timer.persistent;
    if (persistent != null) {
      writer.writeStartElement(prefix, "persistent", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(Boolean.toString(persistent));
      writer.writeEndElement();
    }

    // ELEMENT: timezone
    final String timezoneRaw = timer.timezone;
    String timezone = null;
    try {
      timezone = Adapters.collapsedStringAdapterAdapter.marshal(timezoneRaw);
    } catch (final Exception e) {
      context.xmlAdapterError(
          timer, "timezone", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (timezone != null) {
      writer.writeStartElement(prefix, "timezone", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(timezone);
      writer.writeEndElement();
    }

    // ELEMENT: info
    final String infoRaw = timer.info;
    String info = null;
    try {
      info = Adapters.collapsedStringAdapterAdapter.marshal(infoRaw);
    } catch (final Exception e) {
      context.xmlAdapterError(
          timer, "info", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (info != null) {
      writer.writeStartElement(prefix, "info", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(info);
      writer.writeEndElement();
    }

    context.afterMarshal(timer, LifecycleCallback.NONE);
  }
  public static final void _write(
      final XoXMLStreamWriter writer,
      final org.apache.openejb.jee.LifecycleCallback lifecycleCallback,
      RuntimeContext context)
      throws Exception {
    if (lifecycleCallback == null) {
      writer.writeXsiNil();
      return;
    }

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

    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (org.apache.openejb.jee.LifecycleCallback.class != lifecycleCallback.getClass()) {
      context.unexpectedSubclass(
          writer, lifecycleCallback, org.apache.openejb.jee.LifecycleCallback.class);
      return;
    }

    context.beforeMarshal(lifecycleCallback, org.metatype.sxc.jaxb.LifecycleCallback.NONE);

    // ELEMENT: lifecycleCallbackClass
    final String lifecycleCallbackClassRaw = lifecycleCallback.lifecycleCallbackClass;
    String lifecycleCallbackClass = null;
    try {
      lifecycleCallbackClass =
          Adapters.collapsedStringAdapterAdapter.marshal(lifecycleCallbackClassRaw);
    } catch (final Exception e) {
      context.xmlAdapterError(
          lifecycleCallback,
          "lifecycleCallbackClass",
          CollapsedStringAdapter.class,
          String.class,
          String.class,
          e);
    }
    if (lifecycleCallbackClass != null) {
      writer.writeStartElement(
          prefix, "lifecycle-callback-class", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(lifecycleCallbackClass);
      writer.writeEndElement();
    }

    // ELEMENT: lifecycleCallbackMethod
    final String lifecycleCallbackMethodRaw = lifecycleCallback.lifecycleCallbackMethod;
    String lifecycleCallbackMethod = null;
    try {
      lifecycleCallbackMethod =
          Adapters.collapsedStringAdapterAdapter.marshal(lifecycleCallbackMethodRaw);
    } catch (final Exception e) {
      context.xmlAdapterError(
          lifecycleCallback,
          "lifecycleCallbackMethod",
          CollapsedStringAdapter.class,
          String.class,
          String.class,
          e);
    }
    if (lifecycleCallbackMethod != null) {
      writer.writeStartElement(
          prefix, "lifecycle-callback-method", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(lifecycleCallbackMethod);
      writer.writeEndElement();
    } else {
      context.unexpectedNullValue(lifecycleCallback, "lifecycleCallbackMethod");
    }

    context.afterMarshal(lifecycleCallback, org.metatype.sxc.jaxb.LifecycleCallback.NONE);
  }
Example #4
0
  public static final void _write(
      XoXMLStreamWriter writer, TimerSchedule timerSchedule, RuntimeContext context)
      throws Exception {
    if (timerSchedule == null) {
      writer.writeXsiNil();
      return;
    }

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

    String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (TimerSchedule.class != timerSchedule.getClass()) {
      context.unexpectedSubclass(writer, timerSchedule, TimerSchedule.class);
      return;
    }

    context.beforeMarshal(timerSchedule, LifecycleCallback.NONE);

    // ATTRIBUTE: id
    String idRaw = timerSchedule.id;
    if (idRaw != null) {
      String id = null;
      try {
        id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
      } catch (Exception e) {
        context.xmlAdapterError(
            timerSchedule, "id", CollapsedStringAdapter.class, String.class, String.class, e);
      }
      writer.writeAttribute("", "", "id", id);
    }

    // ELEMENT: second
    String secondRaw = timerSchedule.second;
    String second = null;
    try {
      second = Adapters.collapsedStringAdapterAdapter.marshal(secondRaw);
    } catch (Exception e) {
      context.xmlAdapterError(
          timerSchedule, "second", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (second != null) {
      writer.writeStartElement(prefix, "second", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(second);
      writer.writeEndElement();
    }

    // ELEMENT: minute
    String minuteRaw = timerSchedule.minute;
    String minute = null;
    try {
      minute = Adapters.collapsedStringAdapterAdapter.marshal(minuteRaw);
    } catch (Exception e) {
      context.xmlAdapterError(
          timerSchedule, "minute", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (minute != null) {
      writer.writeStartElement(prefix, "minute", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(minute);
      writer.writeEndElement();
    }

    // ELEMENT: hour
    String hourRaw = timerSchedule.hour;
    String hour = null;
    try {
      hour = Adapters.collapsedStringAdapterAdapter.marshal(hourRaw);
    } catch (Exception e) {
      context.xmlAdapterError(
          timerSchedule, "hour", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (hour != null) {
      writer.writeStartElement(prefix, "hour", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(hour);
      writer.writeEndElement();
    }

    // ELEMENT: dayOfMonth
    String dayOfMonthRaw = timerSchedule.dayOfMonth;
    String dayOfMonth = null;
    try {
      dayOfMonth = Adapters.collapsedStringAdapterAdapter.marshal(dayOfMonthRaw);
    } catch (Exception e) {
      context.xmlAdapterError(
          timerSchedule, "dayOfMonth", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (dayOfMonth != null) {
      writer.writeStartElement(prefix, "day-of-month", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(dayOfMonth);
      writer.writeEndElement();
    }

    // ELEMENT: month
    String monthRaw = timerSchedule.month;
    String month = null;
    try {
      month = Adapters.collapsedStringAdapterAdapter.marshal(monthRaw);
    } catch (Exception e) {
      context.xmlAdapterError(
          timerSchedule, "month", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (month != null) {
      writer.writeStartElement(prefix, "month", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(month);
      writer.writeEndElement();
    }

    // ELEMENT: dayOfWeek
    String dayOfWeekRaw = timerSchedule.dayOfWeek;
    String dayOfWeek = null;
    try {
      dayOfWeek = Adapters.collapsedStringAdapterAdapter.marshal(dayOfWeekRaw);
    } catch (Exception e) {
      context.xmlAdapterError(
          timerSchedule, "dayOfWeek", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (dayOfWeek != null) {
      writer.writeStartElement(prefix, "day-of-week", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(dayOfWeek);
      writer.writeEndElement();
    }

    // ELEMENT: year
    String yearRaw = timerSchedule.year;
    String year = null;
    try {
      year = Adapters.collapsedStringAdapterAdapter.marshal(yearRaw);
    } catch (Exception e) {
      context.xmlAdapterError(
          timerSchedule, "year", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (year != null) {
      writer.writeStartElement(prefix, "year", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(year);
      writer.writeEndElement();
    }

    context.afterMarshal(timerSchedule, LifecycleCallback.NONE);
  }
  public static final void _write(
      final XoXMLStreamWriter writer,
      final MethodPermission methodPermission,
      RuntimeContext context)
      throws Exception {
    if (methodPermission == null) {
      writer.writeXsiNil();
      return;
    }

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

    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (MethodPermission.class != methodPermission.getClass()) {
      context.unexpectedSubclass(writer, methodPermission, MethodPermission.class);
      return;
    }

    context.beforeMarshal(methodPermission, LifecycleCallback.NONE);

    // ATTRIBUTE: id
    final String idRaw = methodPermission.id;
    if (idRaw != null) {
      String id = null;
      try {
        id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
      } catch (final Exception e) {
        context.xmlAdapterError(
            methodPermission, "id", CollapsedStringAdapter.class, String.class, String.class, e);
      }
      writer.writeAttribute("", "", "id", id);
    }

    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
      descriptions = methodPermission.getDescriptions();
    } catch (final Exception e) {
      context.getterError(
          methodPermission, "descriptions", MethodPermission.class, "getDescriptions", e);
    }
    if (descriptions != null) {
      for (final Text descriptionsItem : descriptions) {
        if (descriptionsItem != null) {
          writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
          writeText(writer, descriptionsItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(methodPermission, "descriptions");
        }
      }
    }

    // ELEMENT: roleName
    final List<String> roleNameRaw = methodPermission.roleName;
    if (roleNameRaw != null) {
      for (final String roleNameItem : roleNameRaw) {
        String roleName = null;
        try {
          roleName = Adapters.collapsedStringAdapterAdapter.marshal(roleNameItem);
        } catch (final Exception e) {
          context.xmlAdapterError(
              methodPermission,
              "roleName",
              CollapsedStringAdapter.class,
              List.class,
              List.class,
              e);
        }
        if (roleName != null) {
          writer.writeStartElement(prefix, "role-name", "http://java.sun.com/xml/ns/javaee");
          writer.writeCharacters(roleName);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(methodPermission, "roleName");
        }
      }
    }

    // ELEMENT: unchecked
    final Empty unchecked = methodPermission.unchecked;
    if (unchecked != null) {
      writer.writeStartElement(prefix, "unchecked", "http://java.sun.com/xml/ns/javaee");
      writeEmpty(writer, unchecked, context);
      writer.writeEndElement();
    }

    // ELEMENT: method
    final List<Method> method = methodPermission.method;
    if (method != null) {
      for (final Method methodItem : method) {
        if (methodItem != null) {
          writer.writeStartElement(prefix, "method", "http://java.sun.com/xml/ns/javaee");
          writeMethod(writer, methodItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(methodPermission, "method");
        }
      }
    }

    context.afterMarshal(methodPermission, LifecycleCallback.NONE);
  }
  public static final void _write(
      final XoXMLStreamWriter writer,
      final SecurityIdentity securityIdentity,
      RuntimeContext context)
      throws Exception {
    if (securityIdentity == null) {
      writer.writeXsiNil();
      return;
    }

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

    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (SecurityIdentity.class != securityIdentity.getClass()) {
      context.unexpectedSubclass(writer, securityIdentity, SecurityIdentity.class);
      return;
    }

    context.beforeMarshal(securityIdentity, LifecycleCallback.NONE);

    // ATTRIBUTE: id
    final String idRaw = securityIdentity.id;
    if (idRaw != null) {
      String id = null;
      try {
        id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
      } catch (final Exception e) {
        context.xmlAdapterError(
            securityIdentity, "id", CollapsedStringAdapter.class, String.class, String.class, e);
      }
      writer.writeAttribute("", "", "id", id);
    }

    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
      descriptions = securityIdentity.getDescriptions();
    } catch (final Exception e) {
      context.getterError(
          securityIdentity, "descriptions", SecurityIdentity.class, "getDescriptions", e);
    }
    if (descriptions != null) {
      for (final Text descriptionsItem : descriptions) {
        if (descriptionsItem != null) {
          writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
          writeText(writer, descriptionsItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(securityIdentity, "descriptions");
        }
      }
    }

    // ELEMENT: useCallerIdentity
    final Empty useCallerIdentity = securityIdentity.useCallerIdentity;
    if (useCallerIdentity != null) {
      writer.writeStartElement(prefix, "use-caller-identity", "http://java.sun.com/xml/ns/javaee");
      writeEmpty(writer, useCallerIdentity, context);
      writer.writeEndElement();
    }

    // ELEMENT: runAs
    final RunAs runAs = securityIdentity.runAs;
    if (runAs != null) {
      writer.writeStartElement(prefix, "run-as", "http://java.sun.com/xml/ns/javaee");
      writeRunAs(writer, runAs, context);
      writer.writeEndElement();
    }

    context.afterMarshal(securityIdentity, LifecycleCallback.NONE);
  }
  public static final void _write(
      final XoXMLStreamWriter writer,
      final ServiceEndpointMethodMapping serviceEndpointMethodMapping,
      RuntimeContext context)
      throws Exception {
    if (serviceEndpointMethodMapping == null) {
      writer.writeXsiNil();
      return;
    }

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

    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (ServiceEndpointMethodMapping.class != serviceEndpointMethodMapping.getClass()) {
      context.unexpectedSubclass(
          writer, serviceEndpointMethodMapping, ServiceEndpointMethodMapping.class);
      return;
    }

    context.beforeMarshal(serviceEndpointMethodMapping, LifecycleCallback.NONE);

    // ATTRIBUTE: id
    final String idRaw = serviceEndpointMethodMapping.id;
    if (idRaw != null) {
      String id = null;
      try {
        id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
      } catch (final Exception e) {
        context.xmlAdapterError(
            serviceEndpointMethodMapping,
            "id",
            CollapsedStringAdapter.class,
            String.class,
            String.class,
            e);
      }
      writer.writeAttribute("", "", "id", id);
    }

    // ELEMENT: javaMethodName
    final String javaMethodNameRaw = serviceEndpointMethodMapping.javaMethodName;
    String javaMethodName = null;
    try {
      javaMethodName = Adapters.collapsedStringAdapterAdapter.marshal(javaMethodNameRaw);
    } catch (final Exception e) {
      context.xmlAdapterError(
          serviceEndpointMethodMapping,
          "javaMethodName",
          CollapsedStringAdapter.class,
          String.class,
          String.class,
          e);
    }
    if (javaMethodName != null) {
      writer.writeStartElement(prefix, "java-method-name", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(javaMethodName);
      writer.writeEndElement();
    } else {
      context.unexpectedNullValue(serviceEndpointMethodMapping, "javaMethodName");
    }

    // ELEMENT: wsdlOperation
    final String wsdlOperationRaw = serviceEndpointMethodMapping.wsdlOperation;
    String wsdlOperation = null;
    try {
      wsdlOperation = Adapters.collapsedStringAdapterAdapter.marshal(wsdlOperationRaw);
    } catch (final Exception e) {
      context.xmlAdapterError(
          serviceEndpointMethodMapping,
          "wsdlOperation",
          CollapsedStringAdapter.class,
          String.class,
          String.class,
          e);
    }
    if (wsdlOperation != null) {
      writer.writeStartElement(prefix, "wsdl-operation", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(wsdlOperation);
      writer.writeEndElement();
    } else {
      context.unexpectedNullValue(serviceEndpointMethodMapping, "wsdlOperation");
    }

    // ELEMENT: wrappedElement
    final Object wrappedElement = serviceEndpointMethodMapping.wrappedElement;
    if (wrappedElement != null) {
      writer.writeStartElement(prefix, "wrapped-element", "http://java.sun.com/xml/ns/javaee");
      writer.writeDomElement(((Element) wrappedElement), false);
      writer.writeEndElement();
    }

    // ELEMENT: methodParamPartsMapping
    final List<MethodParamPartsMapping> methodParamPartsMapping =
        serviceEndpointMethodMapping.methodParamPartsMapping;
    if (methodParamPartsMapping != null) {
      for (final MethodParamPartsMapping methodParamPartsMappingItem : methodParamPartsMapping) {
        if (methodParamPartsMappingItem != null) {
          writer.writeStartElement(
              prefix, "method-param-parts-mapping", "http://java.sun.com/xml/ns/javaee");
          writeMethodParamPartsMapping(writer, methodParamPartsMappingItem, context);
          writer.writeEndElement();
        }
      }
    }

    // ELEMENT: wsdlReturnValueMapping
    final WsdlReturnValueMapping wsdlReturnValueMapping =
        serviceEndpointMethodMapping.wsdlReturnValueMapping;
    if (wsdlReturnValueMapping != null) {
      writer.writeStartElement(
          prefix, "wsdl-return-value-mapping", "http://java.sun.com/xml/ns/javaee");
      writeWsdlReturnValueMapping(writer, wsdlReturnValueMapping, context);
      writer.writeEndElement();
    }

    context.afterMarshal(serviceEndpointMethodMapping, LifecycleCallback.NONE);
  }
Example #8
0
  public static final void _write(XoXMLStreamWriter writer, Module module, RuntimeContext context)
      throws Exception {
    if (module == null) {
      writer.writeXsiNil();
      return;
    }

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

    String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Module.class != module.getClass()) {
      context.unexpectedSubclass(writer, module, Module.class);
      return;
    }

    context.beforeMarshal(module, LifecycleCallback.NONE);

    // ATTRIBUTE: id
    String idRaw = module.id;
    if (idRaw != null) {
      String id = null;
      try {
        id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
      } catch (Exception e) {
        context.xmlAdapterError(
            module, "id", CollapsedStringAdapter.class, String.class, String.class, e);
      }
      writer.writeAttribute("", "", "id", id);
    }

    // ELEMENT: connector
    String connectorRaw = module.connector;
    String connector = null;
    try {
      connector = Adapters.collapsedStringAdapterAdapter.marshal(connectorRaw);
    } catch (Exception e) {
      context.xmlAdapterError(
          module, "connector", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (connector != null) {
      writer.writeStartElement(prefix, "connector", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(connector);
      writer.writeEndElement();
    }

    // ELEMENT: ejb
    String ejbRaw = module.ejb;
    String ejb = null;
    try {
      ejb = Adapters.collapsedStringAdapterAdapter.marshal(ejbRaw);
    } catch (Exception e) {
      context.xmlAdapterError(
          module, "ejb", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (ejb != null) {
      writer.writeStartElement(prefix, "ejb", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(ejb);
      writer.writeEndElement();
    }

    // ELEMENT: java
    String javaRaw = module.java;
    String java = null;
    try {
      java = Adapters.collapsedStringAdapterAdapter.marshal(javaRaw);
    } catch (Exception e) {
      context.xmlAdapterError(
          module, "java", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (java != null) {
      writer.writeStartElement(prefix, "java", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(java);
      writer.writeEndElement();
    }

    // ELEMENT: web
    Web web = module.web;
    if (web != null) {
      writer.writeStartElement(prefix, "web", "http://java.sun.com/xml/ns/javaee");
      writeWeb(writer, web, context);
      writer.writeEndElement();
    }

    // ELEMENT: altDd
    String altDdRaw = module.altDd;
    String altDd = null;
    try {
      altDd = Adapters.collapsedStringAdapterAdapter.marshal(altDdRaw);
    } catch (Exception e) {
      context.xmlAdapterError(
          module, "altDd", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (altDd != null) {
      writer.writeStartElement(prefix, "alt-dd", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(altDd);
      writer.writeEndElement();
    }

    context.afterMarshal(module, LifecycleCallback.NONE);
  }
Example #9
0
  public static final void _write(
      final XoXMLStreamWriter writer, final Application application, RuntimeContext context)
      throws Exception {
    if (application == null) {
      writer.writeXsiNil();
      return;
    }

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

    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Application.class != application.getClass()) {
      context.unexpectedSubclass(writer, application, Application.class);
      return;
    }

    context.beforeMarshal(application, LifecycleCallback.NONE);

    // ATTRIBUTE: version
    final String versionRaw = application.version;
    if (versionRaw != null) {
      String version = null;
      try {
        version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw);
      } catch (final Exception e) {
        context.xmlAdapterError(
            application, "version", CollapsedStringAdapter.class, String.class, String.class, e);
      }
      writer.writeAttribute("", "", "version", version);
    }

    // ATTRIBUTE: id
    final String idRaw = application.id;
    if (idRaw != null) {
      String id = null;
      try {
        id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
      } catch (final Exception e) {
        context.xmlAdapterError(
            application, "id", CollapsedStringAdapter.class, String.class, String.class, e);
      }
      writer.writeAttribute("", "", "id", id);
    }

    // ELEMENT: applicationName
    final String applicationNameRaw = application.applicationName;
    String applicationName = null;
    try {
      applicationName = Adapters.collapsedStringAdapterAdapter.marshal(applicationNameRaw);
    } catch (final Exception e) {
      context.xmlAdapterError(
          application,
          "applicationName",
          CollapsedStringAdapter.class,
          String.class,
          String.class,
          e);
    }
    if (applicationName != null) {
      writer.writeStartElement(prefix, "application-name", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(applicationName);
      writer.writeEndElement();
    }

    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
      descriptions = application.getDescriptions();
    } catch (final Exception e) {
      context.getterError(application, "descriptions", Application.class, "getDescriptions", e);
    }
    if (descriptions != null) {
      for (final Text descriptionsItem : descriptions) {
        if (descriptionsItem != null) {
          writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
          writeText(writer, descriptionsItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "descriptions");
        }
      }
    }

    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
      displayNames = application.getDisplayNames();
    } catch (final Exception e) {
      context.getterError(application, "displayNames", Application.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
      for (final Text displayNamesItem : displayNames) {
        if (displayNamesItem != null) {
          writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
          writeText(writer, displayNamesItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "displayNames");
        }
      }
    }

    // ELEMENT: icon
    final LocalCollection<Icon> icon = application.icon;
    if (icon != null) {
      for (final Icon iconItem : icon) {
        if (iconItem != null) {
          writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
          writeIcon(writer, iconItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "icon");
        }
      }
    }

    // ELEMENT: initializeInOrder
    final Boolean initializeInOrder = application.initializeInOrder;
    if (initializeInOrder != null) {
      writer.writeStartElement(prefix, "initialize-in-order", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(Boolean.toString(initializeInOrder));
      writer.writeEndElement();
    }

    // ELEMENT: module
    final List<Module> module = application.module;
    if (module != null) {
      for (final Module moduleItem : module) {
        if (moduleItem != null) {
          writer.writeStartElement(prefix, "module", "http://java.sun.com/xml/ns/javaee");
          writeModule(writer, moduleItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "module");
        }
      }
    }

    // ELEMENT: securityRole
    final List<SecurityRole> securityRole = application.securityRole;
    if (securityRole != null) {
      for (final SecurityRole securityRoleItem : securityRole) {
        if (securityRoleItem != null) {
          writer.writeStartElement(prefix, "security-role", "http://java.sun.com/xml/ns/javaee");
          writeSecurityRole(writer, securityRoleItem, context);
          writer.writeEndElement();
        }
      }
    }

    // ELEMENT: libraryDirectory
    final String libraryDirectoryRaw = application.libraryDirectory;
    String libraryDirectory = null;
    try {
      libraryDirectory = Adapters.collapsedStringAdapterAdapter.marshal(libraryDirectoryRaw);
    } catch (final Exception e) {
      context.xmlAdapterError(
          application,
          "libraryDirectory",
          CollapsedStringAdapter.class,
          String.class,
          String.class,
          e);
    }
    if (libraryDirectory != null) {
      writer.writeStartElement(prefix, "library-directory", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(libraryDirectory);
      writer.writeEndElement();
    }

    // ELEMENT: envEntry
    final KeyedCollection<String, EnvEntry> envEntry = application.envEntry;
    if (envEntry != null) {
      for (final EnvEntry envEntryItem : envEntry) {
        if (envEntryItem != null) {
          writer.writeStartElement(prefix, "env-entry", "http://java.sun.com/xml/ns/javaee");
          writeEnvEntry(writer, envEntryItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "envEntry");
        }
      }
    }

    // ELEMENT: ejbRef
    final KeyedCollection<String, EjbRef> ejbRef = application.ejbRef;
    if (ejbRef != null) {
      for (final EjbRef ejbRefItem : ejbRef) {
        if (ejbRefItem != null) {
          writer.writeStartElement(prefix, "ejb-ref", "http://java.sun.com/xml/ns/javaee");
          writeEjbRef(writer, ejbRefItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "ejbRef");
        }
      }
    }

    // ELEMENT: ejbLocalRef
    final KeyedCollection<String, EjbLocalRef> ejbLocalRef = application.ejbLocalRef;
    if (ejbLocalRef != null) {
      for (final EjbLocalRef ejbLocalRefItem : ejbLocalRef) {
        if (ejbLocalRefItem != null) {
          writer.writeStartElement(prefix, "ejb-local-ref", "http://java.sun.com/xml/ns/javaee");
          writeEjbLocalRef(writer, ejbLocalRefItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "ejbLocalRef");
        }
      }
    }

    // ELEMENT: serviceRef
    final KeyedCollection<String, ServiceRef> serviceRef = application.serviceRef;
    if (serviceRef != null) {
      for (final ServiceRef serviceRefItem : serviceRef) {
        if (serviceRefItem != null) {
          writer.writeStartElement(prefix, "service-ref", "http://java.sun.com/xml/ns/javaee");
          writeServiceRef(writer, serviceRefItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "serviceRef");
        }
      }
    }

    // ELEMENT: resourceRef
    final KeyedCollection<String, ResourceRef> resourceRef = application.resourceRef;
    if (resourceRef != null) {
      for (final ResourceRef resourceRefItem : resourceRef) {
        if (resourceRefItem != null) {
          writer.writeStartElement(prefix, "resource-ref", "http://java.sun.com/xml/ns/javaee");
          writeResourceRef(writer, resourceRefItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "resourceRef");
        }
      }
    }

    // ELEMENT: resourceEnvRef
    final KeyedCollection<String, ResourceEnvRef> resourceEnvRef = application.resourceEnvRef;
    if (resourceEnvRef != null) {
      for (final ResourceEnvRef resourceEnvRefItem : resourceEnvRef) {
        if (resourceEnvRefItem != null) {
          writer.writeStartElement(prefix, "resource-env-ref", "http://java.sun.com/xml/ns/javaee");
          writeResourceEnvRef(writer, resourceEnvRefItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "resourceEnvRef");
        }
      }
    }

    // ELEMENT: messageDestinationRef
    final KeyedCollection<String, MessageDestinationRef> messageDestinationRef =
        application.messageDestinationRef;
    if (messageDestinationRef != null) {
      for (final MessageDestinationRef messageDestinationRefItem : messageDestinationRef) {
        if (messageDestinationRefItem != null) {
          writer.writeStartElement(
              prefix, "message-destination-ref", "http://java.sun.com/xml/ns/javaee");
          writeMessageDestinationRef(writer, messageDestinationRefItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "messageDestinationRef");
        }
      }
    }

    // ELEMENT: persistenceContextRef
    final KeyedCollection<String, PersistenceContextRef> persistenceContextRef =
        application.persistenceContextRef;
    if (persistenceContextRef != null) {
      for (final PersistenceContextRef persistenceContextRefItem : persistenceContextRef) {
        if (persistenceContextRefItem != null) {
          writer.writeStartElement(
              prefix, "persistence-context-ref", "http://java.sun.com/xml/ns/javaee");
          writePersistenceContextRef(writer, persistenceContextRefItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "persistenceContextRef");
        }
      }
    }

    // ELEMENT: persistenceUnitRef
    final KeyedCollection<String, PersistenceUnitRef> persistenceUnitRef =
        application.persistenceUnitRef;
    if (persistenceUnitRef != null) {
      for (final PersistenceUnitRef persistenceUnitRefItem : persistenceUnitRef) {
        if (persistenceUnitRefItem != null) {
          writer.writeStartElement(
              prefix, "persistence-unit-ref", "http://java.sun.com/xml/ns/javaee");
          writePersistenceUnitRef(writer, persistenceUnitRefItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "persistenceUnitRef");
        }
      }
    }

    // ELEMENT: messageDestination
    final KeyedCollection<String, MessageDestination> messageDestination =
        application.messageDestination;
    if (messageDestination != null) {
      for (final MessageDestination messageDestinationItem : messageDestination) {
        if (messageDestinationItem != null) {
          writer.writeStartElement(
              prefix, "message-destination", "http://java.sun.com/xml/ns/javaee");
          writeMessageDestination(writer, messageDestinationItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(application, "messageDestination");
        }
      }
    }

    // ELEMENT: dataSource
    final KeyedCollection<String, DataSource> dataSource = application.dataSource;
    if (dataSource != null) {
      for (final DataSource dataSourceItem : dataSource) {
        if (dataSourceItem != null) {
          writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee");
          writeDataSource(writer, dataSourceItem, context);
          writer.writeEndElement();
        }
      }
    }

    context.afterMarshal(application, LifecycleCallback.NONE);
  }
Example #10
0
  public static final void _write(
      final XoXMLStreamWriter writer, final Listener listener, RuntimeContext context)
      throws Exception {
    if (listener == null) {
      writer.writeXsiNil();
      return;
    }

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

    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Listener.class != listener.getClass()) {
      context.unexpectedSubclass(writer, listener, Listener.class);
      return;
    }

    context.beforeMarshal(listener, LifecycleCallback.NONE);

    // ATTRIBUTE: id
    final String idRaw = listener.id;
    if (idRaw != null) {
      String id = null;
      try {
        id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
      } catch (final Exception e) {
        context.xmlAdapterError(
            listener, "id", CollapsedStringAdapter.class, String.class, String.class, e);
      }
      writer.writeAttribute("", "", "id", id);
    }

    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
      descriptions = listener.getDescriptions();
    } catch (final Exception e) {
      context.getterError(listener, "descriptions", Listener.class, "getDescriptions", e);
    }
    if (descriptions != null) {
      for (final Text descriptionsItem : descriptions) {
        if (descriptionsItem != null) {
          writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
          writeText(writer, descriptionsItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(listener, "descriptions");
        }
      }
    }

    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
      displayNames = listener.getDisplayNames();
    } catch (final Exception e) {
      context.getterError(listener, "displayNames", Listener.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
      for (final Text displayNamesItem : displayNames) {
        if (displayNamesItem != null) {
          writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
          writeText(writer, displayNamesItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(listener, "displayNames");
        }
      }
    }

    // ELEMENT: icon
    final LocalCollection<Icon> icon = listener.icon;
    if (icon != null) {
      for (final Icon iconItem : icon) {
        if (iconItem != null) {
          writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
          writeIcon(writer, iconItem, context);
          writer.writeEndElement();
        } else {
          context.unexpectedNullValue(listener, "icon");
        }
      }
    }

    // ELEMENT: listenerClass
    final String listenerClassRaw = listener.listenerClass;
    String listenerClass = null;
    try {
      listenerClass = Adapters.collapsedStringAdapterAdapter.marshal(listenerClassRaw);
    } catch (final Exception e) {
      context.xmlAdapterError(
          listener, "listenerClass", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (listenerClass != null) {
      writer.writeStartElement(prefix, "listener-class", "http://java.sun.com/xml/ns/javaee");
      writer.writeCharacters(listenerClass);
      writer.writeEndElement();
    } else {
      context.unexpectedNullValue(listener, "listenerClass");
    }

    context.afterMarshal(listener, LifecycleCallback.NONE);
  }