use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class SecurityIdentity$JAXB method _read.
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;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class SecurityPermission$JAXB method _read.
public static final SecurityPermission _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final SecurityPermission securityPermission = new SecurityPermission();
context.beforeUnmarshal(securityPermission, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("security-permissionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, SecurityPermission.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, securityPermission);
securityPermission.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 (("security-permission-spec" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: securityPermissionSpec
final String securityPermissionSpecRaw = elementReader.getElementAsString();
final String securityPermissionSpec;
try {
securityPermissionSpec = Adapters.collapsedStringAdapterAdapter.unmarshal(securityPermissionSpecRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
securityPermission.securityPermissionSpec = securityPermissionSpec;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "security-permission-spec"));
}
}
if (descriptions != null) {
try {
securityPermission.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, SecurityPermission.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(securityPermission, LifecycleCallback.NONE);
return securityPermission;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class SecurityRoleRef$JAXB method _read.
public static final SecurityRoleRef _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final SecurityRoleRef securityRoleRef = new SecurityRoleRef();
context.beforeUnmarshal(securityRoleRef, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("security-role-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, SecurityRoleRef.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, securityRoleRef);
securityRoleRef.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 roleNameRaw = elementReader.getElementAsString();
final String roleName;
try {
roleName = Adapters.collapsedStringAdapterAdapter.unmarshal(roleNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
securityRoleRef.roleName = roleName;
} else if (("role-link" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: roleLink
final String roleLinkRaw = elementReader.getElementAsString();
final String roleLink;
try {
roleLink = Adapters.collapsedStringAdapterAdapter.unmarshal(roleLinkRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
securityRoleRef.roleLink = roleLink;
} 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", "role-link"));
}
}
if (descriptions != null) {
try {
securityRoleRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, SecurityRoleRef.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(securityRoleRef, LifecycleCallback.NONE);
return securityRoleRef;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class ServiceEndpointInterfaceMapping$JAXB method _read.
public static final ServiceEndpointInterfaceMapping _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping = new ServiceEndpointInterfaceMapping();
context.beforeUnmarshal(serviceEndpointInterfaceMapping, LifecycleCallback.NONE);
List<ServiceEndpointMethodMapping> serviceEndpointMethodMapping = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("service-endpoint-interface-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, ServiceEndpointInterfaceMapping.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, serviceEndpointInterfaceMapping);
serviceEndpointInterfaceMapping.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 (("service-endpoint-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: serviceEndpointInterface
final String serviceEndpointInterfaceRaw = elementReader.getElementAsString();
final String serviceEndpointInterface;
try {
serviceEndpointInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceEndpointInterfaceRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
serviceEndpointInterfaceMapping.serviceEndpointInterface = serviceEndpointInterface;
} else if (("wsdl-port-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: wsdlPortType
final QName wsdlPortType = elementReader.getElementAsQName();
serviceEndpointInterfaceMapping.wsdlPortType = wsdlPortType;
} else if (("wsdl-binding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: wsdlBinding
final QName wsdlBinding = elementReader.getElementAsQName();
serviceEndpointInterfaceMapping.wsdlBinding = wsdlBinding;
} else if (("service-endpoint-method-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: serviceEndpointMethodMapping
final ServiceEndpointMethodMapping serviceEndpointMethodMappingItem = readServiceEndpointMethodMapping(elementReader, context);
if (serviceEndpointMethodMapping == null) {
serviceEndpointMethodMapping = serviceEndpointInterfaceMapping.serviceEndpointMethodMapping;
if (serviceEndpointMethodMapping != null) {
serviceEndpointMethodMapping.clear();
} else {
serviceEndpointMethodMapping = new ArrayList<ServiceEndpointMethodMapping>();
}
}
serviceEndpointMethodMapping.add(serviceEndpointMethodMappingItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint-interface"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-port-type"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-binding"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint-method-mapping"));
}
}
if (serviceEndpointMethodMapping != null) {
serviceEndpointInterfaceMapping.serviceEndpointMethodMapping = serviceEndpointMethodMapping;
}
context.afterUnmarshal(serviceEndpointInterfaceMapping, LifecycleCallback.NONE);
return serviceEndpointInterfaceMapping;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class ServiceEndpointMethodMapping$JAXB method _read.
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;
}
Aggregations