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); }
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; }
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; }
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; }
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 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 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; }
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; }
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 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; }
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); }
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); }
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); }
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; }
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); }
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 org.apache.openejb.jee.LifecycleCallback _read( final XoXMLStreamReader reader, RuntimeContext context) throws Exception { // Check for xsi:nil if (reader.isXsiNil()) { return null; } if (context == null) { context = new RuntimeContext(); } final org.apache.openejb.jee.LifecycleCallback lifecycleCallback = new org.apache.openejb.jee.LifecycleCallback(); context.beforeUnmarshal(lifecycleCallback, org.metatype.sxc.jaxb.LifecycleCallback.NONE); // Check xsi:type final QName xsiType = reader.getXsiType(); if (xsiType != null) { if (("lifecycle-callbackType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, org.apache.openejb.jee.LifecycleCallback.class); } } // Read attributes for (final Attribute attribute : reader.getAttributes()) { if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { context.unexpectedAttribute(attribute); } } // Read elements for (final XoXMLStreamReader elementReader : reader.getChildElements()) { if (("lifecycle-callback-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lifecycleCallbackClass final String lifecycleCallbackClassRaw = elementReader.getElementAsString(); final String lifecycleCallbackClass; try { lifecycleCallbackClass = Adapters.collapsedStringAdapterAdapter.unmarshal(lifecycleCallbackClassRaw); } catch (final Exception e) { context.xmlAdapterError( elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } lifecycleCallback.lifecycleCallbackClass = lifecycleCallbackClass; } else if (("lifecycle-callback-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lifecycleCallbackMethod final String lifecycleCallbackMethodRaw = elementReader.getElementAsString(); final String lifecycleCallbackMethod; try { lifecycleCallbackMethod = Adapters.collapsedStringAdapterAdapter.unmarshal(lifecycleCallbackMethodRaw); } catch (final Exception e) { context.xmlAdapterError( elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } lifecycleCallback.lifecycleCallbackMethod = lifecycleCallbackMethod; } else { context.unexpectedElement( elementReader, new QName("http://java.sun.com/xml/ns/javaee", "lifecycle-callback-class"), new QName("http://java.sun.com/xml/ns/javaee", "lifecycle-callback-method")); } } context.afterUnmarshal(lifecycleCallback, org.metatype.sxc.jaxb.LifecycleCallback.NONE); return lifecycleCallback; }
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 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; }
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); }