use of org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget in project tomee by apache.
the class ResourceEnvRef$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final ResourceEnvRef resourceEnvRef, RuntimeContext context) throws Exception {
if (resourceEnvRef == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (ResourceEnvRef.class != resourceEnvRef.getClass()) {
context.unexpectedSubclass(writer, resourceEnvRef, ResourceEnvRef.class);
return;
}
context.beforeMarshal(resourceEnvRef, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = resourceEnvRef.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(resourceEnvRef, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = resourceEnvRef.getDescriptions();
} catch (final Exception e) {
context.getterError(resourceEnvRef, "descriptions", ResourceEnvRef.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(resourceEnvRef, "descriptions");
}
}
}
// ELEMENT: resourceEnvRefName
final String resourceEnvRefNameRaw = resourceEnvRef.resourceEnvRefName;
String resourceEnvRefName = null;
try {
resourceEnvRefName = Adapters.collapsedStringAdapterAdapter.marshal(resourceEnvRefNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(resourceEnvRef, "resourceEnvRefName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (resourceEnvRefName != null) {
writer.writeStartElement(prefix, "resource-env-ref-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(resourceEnvRefName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(resourceEnvRef, "resourceEnvRefName");
}
// ELEMENT: resourceEnvRefType
final String resourceEnvRefTypeRaw = resourceEnvRef.resourceEnvRefType;
String resourceEnvRefType = null;
try {
resourceEnvRefType = Adapters.collapsedStringAdapterAdapter.marshal(resourceEnvRefTypeRaw);
} catch (final Exception e) {
context.xmlAdapterError(resourceEnvRef, "resourceEnvRefType", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (resourceEnvRefType != null) {
writer.writeStartElement(prefix, "resource-env-ref-type", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(resourceEnvRefType);
writer.writeEndElement();
}
// ELEMENT: mappedName
final String mappedNameRaw = resourceEnvRef.mappedName;
String mappedName = null;
try {
mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(resourceEnvRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (mappedName != null) {
writer.writeStartElement(prefix, "mapped-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(mappedName);
writer.writeEndElement();
}
// ELEMENT: injectionTarget
final Set<InjectionTarget> injectionTarget = resourceEnvRef.injectionTarget;
if (injectionTarget != null) {
for (final InjectionTarget injectionTargetItem : injectionTarget) {
if (injectionTargetItem != null) {
writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee");
writeInjectionTarget(writer, injectionTargetItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(resourceEnvRef, "injectionTarget");
}
}
}
// ELEMENT: lookupName
final String lookupNameRaw = resourceEnvRef.lookupName;
String lookupName = null;
try {
lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(resourceEnvRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (lookupName != null) {
writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(lookupName);
writer.writeEndElement();
}
context.afterMarshal(resourceEnvRef, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget in project tomee by apache.
the class ResourceRef$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final ResourceRef resourceRef, RuntimeContext context) throws Exception {
if (resourceRef == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (ResourceRef.class != resourceRef.getClass()) {
context.unexpectedSubclass(writer, resourceRef, ResourceRef.class);
return;
}
context.beforeMarshal(resourceRef, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = resourceRef.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(resourceRef, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = resourceRef.getDescriptions();
} catch (final Exception e) {
context.getterError(resourceRef, "descriptions", ResourceRef.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(resourceRef, "descriptions");
}
}
}
// ELEMENT: resRefName
final String resRefNameRaw = resourceRef.resRefName;
String resRefName = null;
try {
resRefName = Adapters.collapsedStringAdapterAdapter.marshal(resRefNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(resourceRef, "resRefName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (resRefName != null) {
writer.writeStartElement(prefix, "res-ref-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(resRefName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(resourceRef, "resRefName");
}
// ELEMENT: resType
final String resTypeRaw = resourceRef.resType;
String resType = null;
try {
resType = Adapters.collapsedStringAdapterAdapter.marshal(resTypeRaw);
} catch (final Exception e) {
context.xmlAdapterError(resourceRef, "resType", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (resType != null) {
writer.writeStartElement(prefix, "res-type", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(resType);
writer.writeEndElement();
}
// ELEMENT: resAuth
final ResAuth resAuth = resourceRef.resAuth;
if (resAuth != null) {
writer.writeStartElement(prefix, "res-auth", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(toStringResAuth(resourceRef, null, context, resAuth));
writer.writeEndElement();
}
// ELEMENT: resSharingScope
final ResSharingScope resSharingScope = resourceRef.resSharingScope;
if (resSharingScope != null) {
writer.writeStartElement(prefix, "res-sharing-scope", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(toStringResSharingScope(resourceRef, null, context, resSharingScope));
writer.writeEndElement();
}
// ELEMENT: mappedName
final String mappedNameRaw = resourceRef.mappedName;
String mappedName = null;
try {
mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(resourceRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (mappedName != null) {
writer.writeStartElement(prefix, "mapped-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(mappedName);
writer.writeEndElement();
}
// ELEMENT: injectionTarget
final Set<InjectionTarget> injectionTarget = resourceRef.injectionTarget;
if (injectionTarget != null) {
for (final InjectionTarget injectionTargetItem : injectionTarget) {
if (injectionTargetItem != null) {
writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee");
writeInjectionTarget(writer, injectionTargetItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(resourceRef, "injectionTarget");
}
}
}
// ELEMENT: lookupName
final String lookupNameRaw = resourceRef.lookupName;
String lookupName = null;
try {
lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(resourceRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (lookupName != null) {
writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(lookupName);
writer.writeEndElement();
}
context.afterMarshal(resourceRef, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget in project tomee by apache.
the class ServiceRef$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final ServiceRef serviceRef, RuntimeContext context) throws Exception {
if (serviceRef == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (ServiceRef.class != serviceRef.getClass()) {
context.unexpectedSubclass(writer, serviceRef, ServiceRef.class);
return;
}
context.beforeMarshal(serviceRef, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = serviceRef.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = serviceRef.getDescriptions();
} catch (final Exception e) {
context.getterError(serviceRef, "descriptions", ServiceRef.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(serviceRef, "descriptions");
}
}
}
// ELEMENT: displayNames
Text[] displayNames = null;
try {
displayNames = serviceRef.getDisplayNames();
} catch (final Exception e) {
context.getterError(serviceRef, "displayNames", ServiceRef.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(serviceRef, "displayNames");
}
}
}
// ELEMENT: icon
final LocalCollection<Icon> icon = serviceRef.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(serviceRef, "icon");
}
}
}
// ELEMENT: serviceRefName
final String serviceRefNameRaw = serviceRef.serviceRefName;
String serviceRefName = null;
try {
serviceRefName = Adapters.collapsedStringAdapterAdapter.marshal(serviceRefNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "serviceRefName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (serviceRefName != null) {
writer.writeStartElement(prefix, "service-ref-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(serviceRefName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(serviceRef, "serviceRefName");
}
// ELEMENT: serviceInterface
final String serviceInterfaceRaw = serviceRef.serviceInterface;
String serviceInterface = null;
try {
serviceInterface = Adapters.collapsedStringAdapterAdapter.marshal(serviceInterfaceRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "serviceInterface", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (serviceInterface != null) {
writer.writeStartElement(prefix, "service-interface", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(serviceInterface);
writer.writeEndElement();
} else {
context.unexpectedNullValue(serviceRef, "serviceInterface");
}
// ELEMENT: serviceRefType
final String serviceRefTypeRaw = serviceRef.serviceRefType;
String serviceRefType = null;
try {
serviceRefType = Adapters.collapsedStringAdapterAdapter.marshal(serviceRefTypeRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "serviceRefType", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (serviceRefType != null) {
writer.writeStartElement(prefix, "service-ref-type", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(serviceRefType);
writer.writeEndElement();
}
// ELEMENT: wsdlFile
final String wsdlFileRaw = serviceRef.wsdlFile;
String wsdlFile = null;
try {
wsdlFile = Adapters.collapsedStringAdapterAdapter.marshal(wsdlFileRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "wsdlFile", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (wsdlFile != null) {
writer.writeStartElement(prefix, "wsdl-file", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(wsdlFile);
writer.writeEndElement();
}
// ELEMENT: jaxrpcMappingFile
final String jaxrpcMappingFileRaw = serviceRef.jaxrpcMappingFile;
String jaxrpcMappingFile = null;
try {
jaxrpcMappingFile = Adapters.collapsedStringAdapterAdapter.marshal(jaxrpcMappingFileRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "jaxrpcMappingFile", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (jaxrpcMappingFile != null) {
writer.writeStartElement(prefix, "jaxrpc-mapping-file", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(jaxrpcMappingFile);
writer.writeEndElement();
}
// ELEMENT: serviceQname
final QName serviceQname = serviceRef.serviceQname;
if (serviceQname != null) {
writer.writeStartElement(prefix, "service-qname", "http://java.sun.com/xml/ns/javaee");
writer.writeQName(serviceQname);
writer.writeEndElement();
}
// ELEMENT: portComponentRef
final List<PortComponentRef> portComponentRef = serviceRef.portComponentRef;
if (portComponentRef != null) {
for (final PortComponentRef portComponentRefItem : portComponentRef) {
if (portComponentRefItem != null) {
writer.writeStartElement(prefix, "port-component-ref", "http://java.sun.com/xml/ns/javaee");
writePortComponentRef(writer, portComponentRefItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(serviceRef, "portComponentRef");
}
}
}
// ELEMENT: handler
final List<Handler> handler = serviceRef.handler;
if (handler != null) {
for (final Handler handlerItem : handler) {
if (handlerItem != null) {
writer.writeStartElement(prefix, "handler", "http://java.sun.com/xml/ns/javaee");
writeHandler(writer, handlerItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(serviceRef, "handler");
}
}
}
// ELEMENT: handlerChains
final HandlerChains handlerChains = serviceRef.handlerChains;
if (handlerChains != null) {
writer.writeStartElement(prefix, "handler-chains", "http://java.sun.com/xml/ns/javaee");
writeHandlerChains(writer, handlerChains, context);
writer.writeEndElement();
}
// ELEMENT: mappedName
final String mappedNameRaw = serviceRef.mappedName;
String mappedName = null;
try {
mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (mappedName != null) {
writer.writeStartElement(prefix, "mapped-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(mappedName);
writer.writeEndElement();
}
// ELEMENT: injectionTarget
final Set<InjectionTarget> injectionTarget = serviceRef.injectionTarget;
if (injectionTarget != null) {
for (final InjectionTarget injectionTargetItem : injectionTarget) {
if (injectionTargetItem != null) {
writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee");
writeInjectionTarget(writer, injectionTargetItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(serviceRef, "injectionTarget");
}
}
}
// ELEMENT: lookupName
final String lookupNameRaw = serviceRef.lookupName;
String lookupName = null;
try {
lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (lookupName != null) {
writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(lookupName);
writer.writeEndElement();
}
context.afterMarshal(serviceRef, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget in project tomee by apache.
the class InjectionTest method setUp.
protected void setUp() throws Exception {
super.setUp();
System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
// containers
final StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class);
statelessContainerInfo.properties.setProperty("TimeOut", "10");
statelessContainerInfo.properties.setProperty("MaxSize", "0");
statelessContainerInfo.properties.setProperty("StrictPooling", "false");
assembler.createContainer(statelessContainerInfo);
// Setup the descriptor information
final StatelessBean bean = new StatelessBean(WidgetBean.class);
bean.addBusinessLocal(Widget.class.getName());
bean.addBusinessRemote(RemoteWidget.class.getName());
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(bean);
bean.getEnvEntry().add(new EnvEntry(name("myString"), "java.lang.String", "2"));
bean.getEnvEntry().add(new EnvEntry(name("myDouble"), "java.lang.Double", "3.0"));
bean.getEnvEntry().add(new EnvEntry(name("myLong"), "java.lang.Long", "4"));
bean.getEnvEntry().add(new EnvEntry(name("myFloat"), "java.lang.Float", "5"));
bean.getEnvEntry().add(new EnvEntry(name("myInteger"), "java.lang.Integer", "6"));
bean.getEnvEntry().add(new EnvEntry(name("myShort"), "java.lang.Short", "7"));
bean.getEnvEntry().add(new EnvEntry(name("myBoolean"), "java.lang.Boolean", "false"));
bean.getEnvEntry().add(new EnvEntry(name("myByte"), "java.lang.Byte", "8"));
bean.getEnvEntry().add(new EnvEntry(name("myCharacter"), "java.lang.Character", "9"));
bean.getEnvEntry().add(new EnvEntry(name("myClass"), "java.lang.Class", Widget.class.getName()));
bean.getEnvEntry().add(new EnvEntry(name("myTimeUnit"), TimeUnit.class.getName(), "HOURS"));
final EnvEntry entry = new EnvEntry("injectedBoolean", (String) null, "true");
entry.getInjectionTarget().add((new InjectionTarget(WidgetBean.class.getName(), "injectedBoolean")));
bean.getEnvEntry().add(entry);
final ResourceEnvRef resourceEnvRef = new ResourceEnvRef("injectedContext", (String) null);
resourceEnvRef.getInjectionTarget().add((new InjectionTarget(WidgetBean.class.getName(), "injectedContext")));
bean.getResourceEnvRef().add(resourceEnvRef);
assembler.createApplication(config.configureApplication(ejbJar));
}
use of org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget in project tomee by apache.
the class EjbLocalRef$JAXB method _read.
public static final EjbLocalRef _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final EjbLocalRef ejbLocalRef = new EjbLocalRef();
context.beforeUnmarshal(ejbLocalRef, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
Set<InjectionTarget> injectionTarget = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("ejb-local-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, EjbLocalRef.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, ejbLocalRef);
ejbLocalRef.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 (("ejb-ref-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: ejbRefName
final String ejbRefNameRaw = elementReader.getElementAsString();
final String ejbRefName;
try {
ejbRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbRefNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
ejbLocalRef.ejbRefName = ejbRefName;
} else if (("ejb-ref-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: ejbRefType
final EjbRefType ejbRefType = parseEjbRefType(elementReader, context, elementReader.getElementAsString());
if (ejbRefType != null) {
ejbLocalRef.ejbRefType = ejbRefType;
}
} else if (("local-home" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: localHome
final String localHomeRaw = elementReader.getElementAsString();
final String localHome;
try {
localHome = Adapters.collapsedStringAdapterAdapter.unmarshal(localHomeRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
ejbLocalRef.localHome = localHome;
} else if (("local" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: local
final String localRaw = elementReader.getElementAsString();
final String local;
try {
local = Adapters.collapsedStringAdapterAdapter.unmarshal(localRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
ejbLocalRef.local = local;
} else if (("ejb-link" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: ejbLink
final String ejbLinkRaw = elementReader.getElementAsString();
final String ejbLink;
try {
ejbLink = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbLinkRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
ejbLocalRef.ejbLink = ejbLink;
} else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: mappedName
final String mappedNameRaw = elementReader.getElementAsString();
final String mappedName;
try {
mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
ejbLocalRef.mappedName = mappedName;
} else if (("injection-target" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: injectionTarget
final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context);
if (injectionTarget == null) {
injectionTarget = ejbLocalRef.injectionTarget;
if (injectionTarget != null) {
injectionTarget.clear();
} else {
injectionTarget = new LinkedHashSet<InjectionTarget>();
}
}
injectionTarget.add(injectionTargetItem);
} else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: lookupName
final String lookupNameRaw = elementReader.getElementAsString();
final String lookupName;
try {
lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
ejbLocalRef.lookupName = lookupName;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-ref-name"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-ref-type"), new QName("http://java.sun.com/xml/ns/javaee", "local-home"), new QName("http://java.sun.com/xml/ns/javaee", "local"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-link"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "injection-target"), new QName("http://java.sun.com/xml/ns/javaee", "lookup-name"));
}
}
if (descriptions != null) {
try {
ejbLocalRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, EjbLocalRef.class, "setDescriptions", Text[].class, e);
}
}
if (injectionTarget != null) {
ejbLocalRef.injectionTarget = injectionTarget;
}
context.afterUnmarshal(ejbLocalRef, LifecycleCallback.NONE);
return ejbLocalRef;
}
Aggregations