From a825892c8cd30f58d2c2587dd728319d3084e4b5 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Wed, 28 Aug 2024 13:58:39 +0200 Subject: [PATCH 01/13] drop sxc runtime shade --- boms/tomee-microprofile/pom.xml | 11 --- boms/tomee-plume/pom.xml | 11 --- boms/tomee-plus/pom.xml | 11 --- boms/tomee-webprofile/pom.xml | 11 --- container/openejb-jee-accessors/pom.xml | 11 +-- deps/pom.xml | 1 - deps/sxc-shade/pom.xml | 118 ------------------------ pom.xml | 9 +- 8 files changed, 7 insertions(+), 176 deletions(-) delete mode 100644 deps/sxc-shade/pom.xml diff --git a/boms/tomee-microprofile/pom.xml b/boms/tomee-microprofile/pom.xml index fdc6a3562ed..41f360e271a 100644 --- a/boms/tomee-microprofile/pom.xml +++ b/boms/tomee-microprofile/pom.xml @@ -1530,17 +1530,6 @@ - - org.apache.tomee - sxc-shade - 10.0.0-M3-SNAPSHOT - - - * - * - - - org.apache.tomee taglibs-shade diff --git a/boms/tomee-plume/pom.xml b/boms/tomee-plume/pom.xml index 145ffca02d8..bfb6bf5afbd 100644 --- a/boms/tomee-plume/pom.xml +++ b/boms/tomee-plume/pom.xml @@ -1640,17 +1640,6 @@ - - org.apache.tomee - sxc-shade - 10.0.0-M3-SNAPSHOT - - - * - * - - - org.apache.tomee taglibs-shade diff --git a/boms/tomee-plus/pom.xml b/boms/tomee-plus/pom.xml index 0b8f912555a..56325ce1fc8 100644 --- a/boms/tomee-plus/pom.xml +++ b/boms/tomee-plus/pom.xml @@ -1651,17 +1651,6 @@ - - org.apache.tomee - sxc-shade - 10.0.0-M3-SNAPSHOT - - - * - * - - - org.apache.tomee taglibs-shade diff --git a/boms/tomee-webprofile/pom.xml b/boms/tomee-webprofile/pom.xml index f0b576eed51..e3c6620c19d 100644 --- a/boms/tomee-webprofile/pom.xml +++ b/boms/tomee-webprofile/pom.xml @@ -1079,17 +1079,6 @@ - - org.apache.tomee - sxc-shade - 10.0.0-M3-SNAPSHOT - - - * - * - - - org.apache.tomee taglibs-shade diff --git a/container/openejb-jee-accessors/pom.xml b/container/openejb-jee-accessors/pom.xml index 591d2fff000..893fc09462b 100644 --- a/container/openejb-jee-accessors/pom.xml +++ b/container/openejb-jee-accessors/pom.xml @@ -67,15 +67,8 @@ - ${project.groupId} - sxc-shade - ${project.version} - - - * - * - - + org.metatype.sxc + sxc-jaxb-core diff --git a/deps/pom.xml b/deps/pom.xml index 2e118cedbd1..b6718ff7c69 100644 --- a/deps/pom.xml +++ b/deps/pom.xml @@ -29,7 +29,6 @@ taglibs-shade - sxc-shade commons-dbcp2-shade servicemix-bcel-shade diff --git a/deps/sxc-shade/pom.xml b/deps/sxc-shade/pom.xml deleted file mode 100644 index 6073a5e091e..00000000000 --- a/deps/sxc-shade/pom.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - deps - org.apache.tomee - 10.0.0-M3-SNAPSHOT - - 4.0.0 - - sxc-shade - TomEE :: Deps :: SXC Shade - - - 0.8 - - - - - org.metatype.sxc - sxc-jaxb-core - ${dependency.version.sxc} - - - org.metatype.sxc - sxc-runtime - ${dependency.version.sxc} - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.6.0 - - - package - - shade - - - true - true - false - - - org.metatype.sxc:* - - - - - - - - javax.xml.bind - jakarta.xml.bind - - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.6.0 - - - workaround-makeItVisibleOnIntellij - none - - attach-artifact - - - - - ${project.build.directory}/sxc-shade-10.0.0-M3-SNAPSHOT.jar - jar - optional - - - - - - - - - diff --git a/pom.xml b/pom.xml index 03b83f77d5f..6fa4df67ec4 100644 --- a/pom.xml +++ b/pom.xml @@ -234,6 +234,7 @@ 1.0-alpha-1 2.0.2 0.9.6 + 0.9-SNAPSHOT 10.15.2.0 @@ -333,7 +334,7 @@ org.metatype.sxc sxc-jaxb-maven-plugin - 0.8 + ${version.sxc} org.apache.maven.plugins @@ -1858,9 +1859,9 @@ ${version.groovy} - ${project.groupId} - sxc-shade - ${project.version} + org.metatype.sxc + sxc-jaxb-core + ${version.sxc} org.hibernate.orm From 4b9a2cafc9bf5775210b6d6d32b6f6faef1a0751 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Wed, 28 Aug 2024 13:59:42 +0200 Subject: [PATCH 02/13] fix jms-destinationType --- .../src/main/java/org/apache/openejb/jee/JMSDestination.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/JMSDestination.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/JMSDestination.java index a84fc929850..8eedfae2655 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/JMSDestination.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/JMSDestination.java @@ -30,7 +30,7 @@ import java.util.List; @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "jms-destination-factoryType", propOrder = { +@XmlType(name = "jms-destinationType", propOrder = { "name", "descriptions", "className", @@ -48,7 +48,7 @@ public class JMSDestination implements Keyable { protected String className; @XmlElement(name = "interface-name") protected String interfaceName; - @XmlElement(name = "interface-name") + @XmlElement(name = "destination-name") protected String destinationName; @XmlElement(name = "resource-adapter-name") protected String resourceAdapter; From e482913b64a4b5b81e211d8225d02f7a4095afa6 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Wed, 28 Aug 2024 14:13:52 +0200 Subject: [PATCH 03/13] regenerate accessors --- .../openejb/jee/AbsoluteOrdering$JAXB.java | 102 +- .../openejb/jee/ActivationConfig$JAXB.java | 124 +- .../jee/ActivationConfigProperty$JAXB.java | 111 +- .../openejb/jee/ActivationSpec$JAXB.java | 136 +- .../java/org/apache/openejb/jee/Adapters.java | 25 +- .../apache/openejb/jee/Addressing$JAXB.java | 98 +- .../openejb/jee/AddressingResponses$JAXB.java | 37 +- .../apache/openejb/jee/AdminObject$JAXB.java | 132 +- .../apache/openejb/jee/Application$JAXB.java | 518 ++++--- .../openejb/jee/ApplicationClient$JAXB.java | 520 ++++--- .../jee/ApplicationException$JAXB.java | 113 +- .../apache/openejb/jee/AroundInvoke$JAXB.java | 101 +- .../openejb/jee/AroundTimeout$JAXB.java | 101 +- .../openejb/jee/AssemblyDescriptor$JAXB.java | 220 +-- .../apache/openejb/jee/AsyncMethod$JAXB.java | 104 +- .../openejb/jee/AuthConstraint$JAXB.java | 130 +- .../jee/AuthenticationMechanism$JAXB.java | 132 +- .../apache/openejb/jee/BodyContent$JAXB.java | 45 +- .../org/apache/openejb/jee/CmpField$JAXB.java | 118 +- .../apache/openejb/jee/CmpVersion$JAXB.java | 37 +- .../org/apache/openejb/jee/CmrField$JAXB.java | 128 +- .../apache/openejb/jee/CmrFieldType$JAXB.java | 37 +- .../jee/ConcurrencyManagementType$JAXB.java | 37 +- .../openejb/jee/ConcurrentLockType$JAXB.java | 37 +- .../openejb/jee/ConcurrentMethod$JAXB.java | 108 +- .../openejb/jee/ConfigProperty$JAXB.java | 170 ++- .../jee/ConnectionDefinition$JAXB.java | 174 +-- .../apache/openejb/jee/Connector$JAXB.java | 256 ++-- .../jee/ConstructorParameterOrder$JAXB.java | 109 +- .../jee/ContainerConcurrency$JAXB.java | 134 +- .../jee/ContainerTransaction$JAXB.java | 134 +- .../openejb/jee/ContextService$JAXB.java | 346 +++++ .../apache/openejb/jee/CookieConfig$JAXB.java | 163 +- .../apache/openejb/jee/DataSource$JAXB.java | 296 ++-- .../apache/openejb/jee/Description$JAXB.java | 185 +++ .../openejb/jee/DestinationType$JAXB.java | 85 +- .../apache/openejb/jee/Dispatcher$JAXB.java | 37 +- .../apache/openejb/jee/DisplayName$JAXB.java | 185 +++ .../org/apache/openejb/jee/EjbJar$JAXB.java | 255 ++-- .../apache/openejb/jee/EjbLocalRef$JAXB.java | 220 +-- .../org/apache/openejb/jee/EjbRef$JAXB.java | 220 +-- .../apache/openejb/jee/EjbRefType$JAXB.java | 37 +- .../apache/openejb/jee/EjbRelation$JAXB.java | 138 +- .../openejb/jee/EjbRelationshipRole$JAXB.java | 152 +- .../org/apache/openejb/jee/Empty$JAXB.java | 81 +- .../apache/openejb/jee/EntityBean$JAXB.java | 694 +++++---- .../org/apache/openejb/jee/EnvEntry$JAXB.java | 196 +-- .../apache/openejb/jee/ErrorPage$JAXB.java | 121 +- .../openejb/jee/ExceptionMapping$JAXB.java | 126 +- .../apache/openejb/jee/ExcludeList$JAXB.java | 124 +- .../jee/FacesAbsoluteOrdering$JAXB.java | 106 +- .../openejb/jee/FacesApplication$JAXB.java | 410 ++--- .../jee/FacesApplicationExtension$JAXB.java | 97 +- .../FacesApplicationResourceBundle$JAXB.java | 170 ++- .../openejb/jee/FacesAttribute$JAXB.java | 218 +-- .../jee/FacesAttributeExtension$JAXB.java | 97 +- .../openejb/jee/FacesBehavior$JAXB.java | 220 +-- .../jee/FacesBehaviorExtension$JAXB.java | 97 +- .../jee/FacesClientBehaviorRenderer$JAXB.java | 101 +- .../openejb/jee/FacesComponent$JAXB.java | 248 ++-- .../jee/FacesComponentExtension$JAXB.java | 97 +- .../apache/openejb/jee/FacesConfig$JAXB.java | 445 +++--- .../jee/FacesConfigFlowDefinition$JAXB.java | 503 +++++++ ...figFlowDefinitionFacesMethodCall$JAXB.java | 215 +++ ...wDefinitionFacesMethodCallMethod$JAXB.java | 170 +++ ...cesConfigFlowDefinitionFinalizer$JAXB.java | 170 +++ ...acesConfigFlowDefinitionFlowCall$JAXB.java | 201 +++ ...wDefinitionFlowCallFlowReference$JAXB.java | 163 ++ ...initionFlowCallOutboundParameter$JAXB.java | 167 +++ ...gFlowDefinitionFlowCallParameter$JAXB.java | 179 +++ ...esConfigFlowDefinitionFlowReturn$JAXB.java | 168 +++ ...igFlowDefinitionInboundParameter$JAXB.java | 167 +++ ...sConfigFlowDefinitionInitializer$JAXB.java | 170 +++ ...nfigFlowDefinitionParameterValue$JAXB.java | 170 +++ .../FacesConfigFlowDefinitionSwitch$JAXB.java | 199 +++ ...esConfigFlowDefinitionSwitchCase$JAXB.java | 277 ++++ .../FacesConfigFlowDefinitionView$JAXB.java | 168 +++ .../openejb/jee/FacesConfigIf$JAXB.java | 170 +++ .../jee/FacesConfigProtectedViews$JAXB.java | 168 +++ .../openejb/jee/FacesConverter$JAXB.java | 244 +-- .../jee/FacesConverterExtension$JAXB.java | 97 +- .../openejb/jee/FacesDefaultLocale$JAXB.java | 81 +- .../openejb/jee/FacesELExpression$JAXB.java | 77 +- .../openejb/jee/FacesExtension$JAXB.java | 97 +- .../apache/openejb/jee/FacesFacet$JAXB.java | 176 +-- .../openejb/jee/FacesFacetExtension$JAXB.java | 97 +- .../apache/openejb/jee/FacesFactory$JAXB.java | 348 ++--- .../jee/FacesFactoryExtension$JAXB.java | 97 +- .../openejb/jee/FacesFromAction$JAXB.java | 81 +- .../openejb/jee/FacesLifecycle$JAXB.java | 132 +- .../jee/FacesLifecycleExtension$JAXB.java | 97 +- .../openejb/jee/FacesListEntries$JAXB.java | 128 +- .../apache/openejb/jee/FacesLocale$JAXB.java | 77 +- .../openejb/jee/FacesLocaleConfig$JAXB.java | 112 +- .../openejb/jee/FacesManagedBean$JAXB.java | 238 +-- .../jee/FacesManagedBeanExtension$JAXB.java | 97 +- .../jee/FacesManagedProperty$JAXB.java | 208 +-- .../openejb/jee/FacesMapEntries$JAXB.java | 132 +- .../openejb/jee/FacesMapEntry$JAXB.java | 118 +- .../openejb/jee/FacesNavigationCase$JAXB.java | 200 +-- .../openejb/jee/FacesNavigationRule$JAXB.java | 198 +-- .../FacesNavigationRuleExtension$JAXB.java | 97 +- .../openejb/jee/FacesNullValue$JAXB.java | 81 +- .../openejb/jee/FacesOrdering$JAXB.java | 90 +- .../jee/FacesOrderingOrdering$JAXB.java | 108 +- .../openejb/jee/FacesOrderingOthers$JAXB.java | 81 +- .../openejb/jee/FacesProperty$JAXB.java | 218 +-- .../jee/FacesPropertyExtension$JAXB.java | 97 +- .../openejb/jee/FacesRedirect$JAXB.java | 110 +- .../jee/FacesRedirectViewParam$JAXB.java | 111 +- .../openejb/jee/FacesReferencedBean$JAXB.java | 174 +-- .../openejb/jee/FacesRenderKit$JAXB.java | 230 +-- .../jee/FacesRenderKitExtension$JAXB.java | 97 +- .../openejb/jee/FacesRenderer$JAXB.java | 240 +-- .../jee/FacesRendererExtension$JAXB.java | 97 +- .../jee/FacesSupportedLocale$JAXB.java | 81 +- .../jee/FacesSystemEventListener$JAXB.java | 125 +- .../openejb/jee/FacesValidator$JAXB.java | 230 +-- .../jee/FacesValidatorExtension$JAXB.java | 97 +- .../org/apache/openejb/jee/Filter$JAXB.java | 196 +-- .../openejb/jee/FilterMapping$JAXB.java | 166 ++- .../openejb/jee/FormLoginConfig$JAXB.java | 111 +- .../org/apache/openejb/jee/Function$JAXB.java | 218 +-- .../org/apache/openejb/jee/Handler$JAXB.java | 256 ++-- .../apache/openejb/jee/HandlerChain$JAXB.java | 156 +- .../openejb/jee/HandlerChains$JAXB.java | 104 +- .../org/apache/openejb/jee/Icon$JAXB.java | 119 +- .../jee/InboundResourceadapter$JAXB.java | 88 +- .../apache/openejb/jee/InitMethod$JAXB.java | 98 +- .../openejb/jee/InjectionTarget$JAXB.java | 101 +- .../apache/openejb/jee/Interceptor$JAXB.java | 590 +++++--- .../openejb/jee/InterceptorBinding$JAXB.java | 172 ++- .../openejb/jee/InterceptorOrder$JAXB.java | 109 +- .../apache/openejb/jee/Interceptors$JAXB.java | 124 +- .../openejb/jee/IsolationLevel$JAXB.java | 37 +- .../jee/JMSConnectionFactory$JAXB.java | 409 +++-- .../openejb/jee/JMSDestination$JAXB.java | 351 +++++ .../openejb/jee/JavaIdentifier$JAXB.java | 170 +++ .../openejb/jee/JavaWsdlMapping$JAXB.java | 184 +-- .../openejb/jee/JavaXmlTypeMapping$JAXB.java | 154 +- .../apache/openejb/jee/JspConfig$JAXB.java | 122 +- .../openejb/jee/JspPropertyGroup$JAXB.java | 306 ++-- .../org/apache/openejb/jee/License$JAXB.java | 110 +- .../openejb/jee/LifecycleCallback$JAXB.java | 101 +- .../org/apache/openejb/jee/Listener$JAXB.java | 156 +- .../jee/LocaleEncodingMapping$JAXB.java | 111 +- .../jee/LocaleEncodingMappingList$JAXB.java | 102 +- .../apache/openejb/jee/LoginConfig$JAXB.java | 118 +- .../openejb/jee/MessageAdapter$JAXB.java | 102 +- .../openejb/jee/MessageDestination$JAXB.java | 184 +-- .../jee/MessageDestinationRef$JAXB.java | 206 +-- .../jee/MessageDestinationUsage$JAXB.java | 37 +- .../openejb/jee/MessageDrivenBean$JAXB.java | 690 +++++---- .../jee/MessageDrivenDestination$JAXB.java | 96 +- .../openejb/jee/MessageListener$JAXB.java | 104 +- .../org/apache/openejb/jee/Method$JAXB.java | 150 +- .../apache/openejb/jee/MethodIntf$JAXB.java | 37 +- .../jee/MethodParamPartsMapping$JAXB.java | 114 +- .../apache/openejb/jee/MethodParams$JAXB.java | 109 +- .../openejb/jee/MethodPermission$JAXB.java | 156 +- .../apache/openejb/jee/MimeMapping$JAXB.java | 111 +- .../org/apache/openejb/jee/Module$JAXB.java | 146 +- .../openejb/jee/MultipartConfig$JAXB.java | 105 +- .../apache/openejb/jee/Multiplicity$JAXB.java | 37 +- .../apache/openejb/jee/NamedMethod$JAXB.java | 104 +- .../openejb/jee/ObjectFactory$JAXB.java | 30 +- .../org/apache/openejb/jee/Ordering$JAXB.java | 161 ++ .../openejb/jee/OrderingOrdering$JAXB.java | 200 +++ .../openejb/jee/OrderingOthers$JAXB.java | 81 +- .../jee/OutboundResourceAdapter$JAXB.java | 140 +- .../openejb/jee/PackageMapping$JAXB.java | 111 +- .../apache/openejb/jee/ParamValue$JAXB.java | 130 +- .../jee/PersistenceContextRef$JAXB.java | 247 +-- ...ersistenceContextSynchronization$JAXB.java | 72 + .../jee/PersistenceContextType$JAXB.java | 37 +- .../openejb/jee/PersistenceType$JAXB.java | 37 +- .../openejb/jee/PersistenceUnitRef$JAXB.java | 182 +-- .../openejb/jee/PortComponent$JAXB.java | 246 +-- .../openejb/jee/PortComponentRef$JAXB.java | 142 +- .../apache/openejb/jee/PortMapping$JAXB.java | 111 +- .../org/apache/openejb/jee/Property$JAXB.java | 111 +- .../org/apache/openejb/jee/Query$JAXB.java | 122 +- .../apache/openejb/jee/QueryMethod$JAXB.java | 104 +- .../jee/RelationshipRoleSource$JAXB.java | 118 +- .../openejb/jee/Relationships$JAXB.java | 124 +- .../apache/openejb/jee/RemoveMethod$JAXB.java | 98 +- .../jee/RequiredConfigProperty$JAXB.java | 118 +- .../org/apache/openejb/jee/ResAuth$JAXB.java | 37 +- .../openejb/jee/ResSharingScope$JAXB.java | 37 +- .../openejb/jee/ResourceAdapter$JAXB.java | 170 ++- .../openejb/jee/ResourceEnvRef$JAXB.java | 182 +-- .../apache/openejb/jee/ResourceRef$JAXB.java | 202 +-- .../openejb/jee/RespectBinding$JAXB.java | 77 +- .../openejb/jee/ResultTypeMapping$JAXB.java | 37 +- .../org/apache/openejb/jee/RunAs$JAXB.java | 118 +- .../openejb/jee/SecurityConstraint$JAXB.java | 144 +- .../openejb/jee/SecurityIdentity$JAXB.java | 120 +- .../openejb/jee/SecurityPermission$JAXB.java | 118 +- .../apache/openejb/jee/SecurityRole$JAXB.java | 118 +- .../openejb/jee/SecurityRoleRef$JAXB.java | 132 +- .../ServiceEndpointInterfaceMapping$JAXB.java | 134 +- .../ServiceEndpointMethodMapping$JAXB.java | 148 +- .../openejb/jee/ServiceImplBean$JAXB.java | 111 +- .../jee/ServiceInterfaceMapping$JAXB.java | 126 +- .../apache/openejb/jee/ServiceRef$JAXB.java | 316 ++-- .../org/apache/openejb/jee/Servlet$JAXB.java | 268 ++-- .../openejb/jee/ServletMapping$JAXB.java | 125 +- .../apache/openejb/jee/SessionBean$JAXB.java | 965 ++++++------ .../openejb/jee/SessionConfig$JAXB.java | 120 +- .../apache/openejb/jee/SessionType$JAXB.java | 37 +- .../jee/SubscriptionDurability$JAXB.java | 85 +- .../java/org/apache/openejb/jee/Tag$JAXB.java | 278 ++-- .../org/apache/openejb/jee/TagFile$JAXB.java | 204 +-- .../org/apache/openejb/jee/Taglib$JAXB.java | 111 +- .../org/apache/openejb/jee/Text$JAXB.java | 95 +- .../org/apache/openejb/jee/Timeout$JAXB.java | 107 +- .../org/apache/openejb/jee/Timer$JAXB.java | 182 +-- .../openejb/jee/TimerSchedule$JAXB.java | 181 +-- .../apache/openejb/jee/TldAttribute$JAXB.java | 190 +-- .../openejb/jee/TldDeferredMethod$JAXB.java | 95 +- .../openejb/jee/TldDeferredValue$JAXB.java | 95 +- .../apache/openejb/jee/TldExtension$JAXB.java | 117 +- .../apache/openejb/jee/TldTaglib$JAXB.java | 310 ++-- .../apache/openejb/jee/TrackingMode$JAXB.java | 37 +- .../openejb/jee/TransAttribute$JAXB.java | 37 +- .../jee/TransactionSupportType$JAXB.java | 37 +- .../openejb/jee/TransactionType$JAXB.java | 37 +- .../openejb/jee/TransportGuarantee$JAXB.java | 37 +- .../apache/openejb/jee/UrlPattern$JAXB.java | 153 ++ .../openejb/jee/UserDataConstraint$JAXB.java | 114 +- .../apache/openejb/jee/Validator$JAXB.java | 138 +- .../org/apache/openejb/jee/Variable$JAXB.java | 174 +-- .../openejb/jee/VariableMapping$JAXB.java | 141 +- .../java/org/apache/openejb/jee/Web$JAXB.java | 111 +- .../org/apache/openejb/jee/WebApp$JAXB.java | 850 ++++++----- .../apache/openejb/jee/WebFragment$JAXB.java | 1318 +++++++++++++++++ .../jee/WebResourceCollection$JAXB.java | 192 +-- .../jee/WebserviceDescription$JAXB.java | 178 +-- .../apache/openejb/jee/Webservices$JAXB.java | 168 ++- .../openejb/jee/WelcomeFileList$JAXB.java | 109 +- .../openejb/jee/WsdlMessageMapping$JAXB.java | 127 +- .../jee/WsdlReturnValueMapping$JAXB.java | 119 +- .../apache/openejb/jee/XmlString$JAXB.java | 192 +++ .../apache/openejb/jee/XsdString$JAXB.java | 184 +++ .../apache/openejb/jee/jba/JndiName$JAXB.java | 130 ++ .../apache/openejb/jee/oejb3/Adapters.java | 27 + .../openejb/jee/oejb3/EjbDeployment$JAXB.java | 371 +++++ .../openejb/jee/oejb3/EjbLink$JAXB.java | 159 ++ .../apache/openejb/jee/oejb3/Jndi$JAXB.java | 159 ++ .../openejb/jee/oejb3/MethodParams$JAXB.java | 197 +++ .../openejb/jee/oejb3/ObjectFactory$JAXB.java | 45 + .../openejb/jee/oejb3/OpenejbJar$JAXB.java | 255 ++++ .../jee/oejb3/PojoDeployment$JAXB.java | 178 +++ .../apache/openejb/jee/oejb3/Query$JAXB.java | 206 +++ .../openejb/jee/oejb3/QueryMethod$JAXB.java | 181 +++ .../openejb/jee/oejb3/ResourceLink$JAXB.java | 159 ++ .../openejb/jee/oejb3/RoleMapping$JAXB.java | 190 +++ 257 files changed, 26823 insertions(+), 15144 deletions(-) create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContextService$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Description$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DisplayName$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinition$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFacesMethodCall$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFacesMethodCallMethod$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFinalizer$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCall$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallFlowReference$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallOutboundParameter$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallParameter$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowReturn$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionInboundParameter$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionInitializer$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionParameterValue$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionSwitch$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionSwitchCase$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionView$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigIf$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigProtectedViews$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JMSDestination$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaIdentifier$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Ordering$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OrderingOrdering$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextSynchronization$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/UrlPattern$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebFragment$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/XmlString$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/XsdString$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/jba/JndiName$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Adapters.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/EjbDeployment$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/EjbLink$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Jndi$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/MethodParams$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/ObjectFactory$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/OpenejbJar$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/PojoDeployment$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Query$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/QueryMethod$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/ResourceLink$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/RoleMapping$JAXB.java diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AbsoluteOrdering$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AbsoluteOrdering$JAXB.java index 13fb9d2fa41..badcde6a5d9 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AbsoluteOrdering$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AbsoluteOrdering$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.OrderingOthers$JAXB.readOrderingOthers; import static org.apache.openejb.jee.OrderingOthers$JAXB.writeOrderingOthers; @@ -35,30 +36,35 @@ "StringEquality" }) public class AbsoluteOrdering$JAXB - extends JAXBObject { + extends JAXBObject +{ public AbsoluteOrdering$JAXB() { super(AbsoluteOrdering.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "absoluteOrderingType".intern()), OrderingOthers$JAXB.class); } - public static AbsoluteOrdering readAbsoluteOrdering(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static AbsoluteOrdering readAbsoluteOrdering(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeAbsoluteOrdering(final XoXMLStreamWriter writer, final AbsoluteOrdering absoluteOrdering, final RuntimeContext context) - throws Exception { + public static void writeAbsoluteOrdering(XoXMLStreamWriter writer, AbsoluteOrdering absoluteOrdering, RuntimeContext context) + throws Exception + { _write(writer, absoluteOrdering, context); } - public void write(final XoXMLStreamWriter writer, final AbsoluteOrdering absoluteOrdering, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, AbsoluteOrdering absoluteOrdering, RuntimeContext context) + throws Exception + { _write(writer, absoluteOrdering, context); } - public final static AbsoluteOrdering _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final AbsoluteOrdering _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,49 +75,49 @@ public final static AbsoluteOrdering _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final AbsoluteOrdering absoluteOrdering = new AbsoluteOrdering(); + AbsoluteOrdering absoluteOrdering = new AbsoluteOrdering(); context.beforeUnmarshal(absoluteOrdering, LifecycleCallback.NONE); List nameOrOthers = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("absoluteOrderingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("absoluteOrderingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, AbsoluteOrdering.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: nameOrOthers - final java.lang.String nameOrOthersItem = elementReader.getElementAsString(); + java.lang.String nameOrOthersItem = elementReader.getElementText(); if (nameOrOthers == null) { nameOrOthers = absoluteOrdering.nameOrOthers; - if (nameOrOthers != null) { + if (nameOrOthers!= null) { nameOrOthers.clear(); } else { - nameOrOthers = new ArrayList(); + nameOrOthers = new ArrayList<>(); } } nameOrOthers.add(nameOrOthersItem); - } else if (("others" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("others" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: nameOrOthers - final org.apache.openejb.jee.OrderingOthers nameOrOthersItem1 = readOrderingOthers(elementReader, context); + org.apache.openejb.jee.OrderingOthers nameOrOthersItem1 = readOrderingOthers(elementReader, context); if (nameOrOthers == null) { nameOrOthers = absoluteOrdering.nameOrOthers; - if (nameOrOthers != null) { + if (nameOrOthers!= null) { nameOrOthers.clear(); } else { - nameOrOthers = new ArrayList(); + nameOrOthers = new ArrayList<>(); } } nameOrOthers.add(nameOrOthersItem1); @@ -119,7 +125,7 @@ public final static AbsoluteOrdering _read(final XoXMLStreamReader reader, Runti context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "others")); } } - if (nameOrOthers != null) { + if (nameOrOthers!= null) { absoluteOrdering.nameOrOthers = nameOrOthers; } @@ -128,42 +134,44 @@ public final static AbsoluteOrdering _read(final XoXMLStreamReader reader, Runti return absoluteOrdering; } - public final AbsoluteOrdering read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final AbsoluteOrdering read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final AbsoluteOrdering absoluteOrdering, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, AbsoluteOrdering absoluteOrdering, RuntimeContext context) + throws Exception + { if (absoluteOrdering == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final java.lang.String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (AbsoluteOrdering.class != absoluteOrdering.getClass()) { + java.lang.String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (AbsoluteOrdering.class!= absoluteOrdering.getClass()) { context.unexpectedSubclass(writer, absoluteOrdering, AbsoluteOrdering.class); - return; + return ; } context.beforeMarshal(absoluteOrdering, LifecycleCallback.NONE); // ELEMENT: nameOrOthers - final List nameOrOthers = absoluteOrdering.nameOrOthers; - if (nameOrOthers != null) { - for (final Object nameOrOthersItem : nameOrOthers) { + List nameOrOthers = absoluteOrdering.nameOrOthers; + if (nameOrOthers!= null) { + for (Object nameOrOthersItem: nameOrOthers) { if (nameOrOthersItem instanceof org.apache.openejb.jee.OrderingOthers) { - final org.apache.openejb.jee.OrderingOthers OrderingOthers = ((org.apache.openejb.jee.OrderingOthers) nameOrOthersItem); + org.apache.openejb.jee.OrderingOthers OrderingOthers = ((org.apache.openejb.jee.OrderingOthers) nameOrOthersItem); writer.writeStartElement(prefix, "others", "http://java.sun.com/xml/ns/javaee"); writeOrderingOthers(writer, OrderingOthers, context); writer.writeEndElement(); } else if (nameOrOthersItem instanceof java.lang.String) { - final java.lang.String String = ((java.lang.String) nameOrOthersItem); + java.lang.String String = ((java.lang.String) nameOrOthersItem); writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(String); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationConfig$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationConfig$JAXB.java index 6f8bd80f0a7..dc8adeb12ee 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationConfig$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationConfig$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.ActivationConfigProperty$JAXB.readActivationConfigProperty; import static org.apache.openejb.jee.ActivationConfigProperty$JAXB.writeActivationConfigProperty; @@ -38,30 +39,35 @@ "StringEquality" }) public class ActivationConfig$JAXB - extends JAXBObject { + extends JAXBObject +{ public ActivationConfig$JAXB() { super(ActivationConfig.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "activation-configType".intern()), Text$JAXB.class, ActivationConfigProperty$JAXB.class); } - public static ActivationConfig readActivationConfig(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ActivationConfig readActivationConfig(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeActivationConfig(final XoXMLStreamWriter writer, final ActivationConfig activationConfig, final RuntimeContext context) - throws Exception { + public static void writeActivationConfig(XoXMLStreamWriter writer, ActivationConfig activationConfig, RuntimeContext context) + throws Exception + { _write(writer, activationConfig, context); } - public void write(final XoXMLStreamWriter writer, final ActivationConfig activationConfig, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ActivationConfig activationConfig, RuntimeContext context) + throws Exception + { _write(writer, activationConfig, context); } - public final static ActivationConfig _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ActivationConfig _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,50 +78,50 @@ public final static ActivationConfig _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final ActivationConfig activationConfig = new ActivationConfig(); + ActivationConfig activationConfig = new ActivationConfig(); context.beforeUnmarshal(activationConfig, LifecycleCallback.NONE); ArrayList descriptions = null; List activationConfigProperty = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("activation-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("activation-configType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ActivationConfig.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, activationConfig); activationConfig.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("activation-config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("activation-config-property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: activationConfigProperty - final ActivationConfigProperty activationConfigPropertyItem = readActivationConfigProperty(elementReader, context); + ActivationConfigProperty activationConfigPropertyItem = readActivationConfigProperty(elementReader, context); if (activationConfigProperty == null) { activationConfigProperty = activationConfig.activationConfigProperty; - if (activationConfigProperty != null) { + if (activationConfigProperty!= null) { activationConfigProperty.clear(); } else { - activationConfigProperty = new ArrayList(); + activationConfigProperty = new ArrayList<>(); } } activationConfigProperty.add(activationConfigPropertyItem); @@ -123,14 +129,14 @@ public final static ActivationConfig _read(final XoXMLStreamReader reader, Runti context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "activation-config-property")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - activationConfig.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + activationConfig.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, ActivationConfig.class, "setDescriptions", Text[].class, e); } } - if (activationConfigProperty != null) { + if (activationConfigProperty!= null) { activationConfig.activationConfigProperty = activationConfigProperty; } @@ -139,38 +145,40 @@ public final static ActivationConfig _read(final XoXMLStreamReader reader, Runti return activationConfig; } - public final ActivationConfig read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ActivationConfig read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ActivationConfig activationConfig, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ActivationConfig activationConfig, RuntimeContext context) + throws Exception + { if (activationConfig == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ActivationConfig.class != activationConfig.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ActivationConfig.class!= activationConfig.getClass()) { context.unexpectedSubclass(writer, activationConfig, ActivationConfig.class); - return; + return ; } context.beforeMarshal(activationConfig, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = activationConfig.id; - if (idRaw != null) { + String idRaw = activationConfig.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(activationConfig, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -180,12 +188,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Activation Text[] descriptions = null; try { descriptions = activationConfig.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(activationConfig, "descriptions", ActivationConfig.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -196,10 +204,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Activation } // ELEMENT: activationConfigProperty - final List activationConfigProperty = activationConfig.activationConfigProperty; - if (activationConfigProperty != null) { - for (final ActivationConfigProperty activationConfigPropertyItem : activationConfigProperty) { - if (activationConfigPropertyItem != null) { + List activationConfigProperty = activationConfig.activationConfigProperty; + if (activationConfigProperty!= null) { + for (ActivationConfigProperty activationConfigPropertyItem: activationConfigProperty) { + if (activationConfigPropertyItem!= null) { writer.writeStartElement(prefix, "activation-config-property", "http://java.sun.com/xml/ns/javaee"); writeActivationConfigProperty(writer, activationConfigPropertyItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationConfigProperty$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationConfigProperty$JAXB.java index 347d368c13d..8e93b27a652 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationConfigProperty$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationConfigProperty$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class ActivationConfigProperty$JAXB - extends JAXBObject { + extends JAXBObject +{ public ActivationConfigProperty$JAXB() { super(ActivationConfigProperty.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "activation-config-propertyType".intern())); } - public static ActivationConfigProperty readActivationConfigProperty(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ActivationConfigProperty readActivationConfigProperty(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeActivationConfigProperty(final XoXMLStreamWriter writer, final ActivationConfigProperty activationConfigProperty, final RuntimeContext context) - throws Exception { + public static void writeActivationConfigProperty(XoXMLStreamWriter writer, ActivationConfigProperty activationConfigProperty, RuntimeContext context) + throws Exception + { _write(writer, activationConfigProperty, context); } - public void write(final XoXMLStreamWriter writer, final ActivationConfigProperty activationConfigProperty, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ActivationConfigProperty activationConfigProperty, RuntimeContext context) + throws Exception + { _write(writer, activationConfigProperty, context); } - public final static ActivationConfigProperty _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ActivationConfigProperty _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,53 +70,53 @@ public final static ActivationConfigProperty _read(final XoXMLStreamReader reade context = new RuntimeContext(); } - final ActivationConfigProperty activationConfigProperty = new ActivationConfigProperty(); + ActivationConfigProperty activationConfigProperty = new ActivationConfigProperty(); context.beforeUnmarshal(activationConfigProperty, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("activation-config-propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("activation-config-propertyType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ActivationConfigProperty.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, activationConfigProperty); activationConfigProperty.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("activation-config-property-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("activation-config-property-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: activationConfigPropertyName - final String activationConfigPropertyNameRaw = elementReader.getElementAsString(); + String activationConfigPropertyNameRaw = elementReader.getElementText(); - final String activationConfigPropertyName; + String activationConfigPropertyName; try { activationConfigPropertyName = Adapters.collapsedStringAdapterAdapter.unmarshal(activationConfigPropertyNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } activationConfigProperty.activationConfigPropertyName = activationConfigPropertyName; - } else if (("activation-config-property-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("activation-config-property-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: activationConfigPropertyValue - final String activationConfigPropertyValueRaw = elementReader.getElementAsString(); + String activationConfigPropertyValueRaw = elementReader.getElementText(); - final String activationConfigPropertyValue; + String activationConfigPropertyValue; try { activationConfigPropertyValue = Adapters.collapsedStringAdapterAdapter.unmarshal(activationConfigPropertyValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -127,52 +132,54 @@ public final static ActivationConfigProperty _read(final XoXMLStreamReader reade return activationConfigProperty; } - public final ActivationConfigProperty read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ActivationConfigProperty read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ActivationConfigProperty activationConfigProperty, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ActivationConfigProperty activationConfigProperty, RuntimeContext context) + throws Exception + { if (activationConfigProperty == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ActivationConfigProperty.class != activationConfigProperty.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ActivationConfigProperty.class!= activationConfigProperty.getClass()) { context.unexpectedSubclass(writer, activationConfigProperty, ActivationConfigProperty.class); - return; + return ; } context.beforeMarshal(activationConfigProperty, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = activationConfigProperty.id; - if (idRaw != null) { + String idRaw = activationConfigProperty.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(activationConfigProperty, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: activationConfigPropertyName - final String activationConfigPropertyNameRaw = activationConfigProperty.activationConfigPropertyName; + String activationConfigPropertyNameRaw = activationConfigProperty.activationConfigPropertyName; String activationConfigPropertyName = null; try { activationConfigPropertyName = Adapters.collapsedStringAdapterAdapter.marshal(activationConfigPropertyNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(activationConfigProperty, "activationConfigPropertyName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (activationConfigPropertyName != null) { + if (activationConfigPropertyName!= null) { writer.writeStartElement(prefix, "activation-config-property-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(activationConfigPropertyName); writer.writeEndElement(); @@ -181,14 +188,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Activation } // ELEMENT: activationConfigPropertyValue - final String activationConfigPropertyValueRaw = activationConfigProperty.activationConfigPropertyValue; + String activationConfigPropertyValueRaw = activationConfigProperty.activationConfigPropertyValue; String activationConfigPropertyValue = null; try { activationConfigPropertyValue = Adapters.collapsedStringAdapterAdapter.marshal(activationConfigPropertyValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(activationConfigProperty, "activationConfigPropertyValue", CollapsedStringAdapter.class, String.class, String.class, e); } - if (activationConfigPropertyValue != null) { + if (activationConfigPropertyValue!= null) { writer.writeStartElement(prefix, "activation-config-property-value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(activationConfigPropertyValue); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationSpec$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationSpec$JAXB.java index 78d568417fe..ce45c8c93a1 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationSpec$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ActivationSpec$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.ConfigProperty$JAXB.readConfigProperty; import static org.apache.openejb.jee.ConfigProperty$JAXB.writeConfigProperty; @@ -38,30 +39,35 @@ "StringEquality" }) public class ActivationSpec$JAXB - extends JAXBObject { + extends JAXBObject +{ public ActivationSpec$JAXB() { super(ActivationSpec.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "activationspecType".intern()), RequiredConfigProperty$JAXB.class, ConfigProperty$JAXB.class); } - public static ActivationSpec readActivationSpec(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ActivationSpec readActivationSpec(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeActivationSpec(final XoXMLStreamWriter writer, final ActivationSpec activationSpec, final RuntimeContext context) - throws Exception { + public static void writeActivationSpec(XoXMLStreamWriter writer, ActivationSpec activationSpec, RuntimeContext context) + throws Exception + { _write(writer, activationSpec, context); } - public void write(final XoXMLStreamWriter writer, final ActivationSpec activationSpec, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ActivationSpec activationSpec, RuntimeContext context) + throws Exception + { _write(writer, activationSpec, context); } - public final static ActivationSpec _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ActivationSpec _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,68 +78,68 @@ public final static ActivationSpec _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final ActivationSpec activationSpec = new ActivationSpec(); + ActivationSpec activationSpec = new ActivationSpec(); context.beforeUnmarshal(activationSpec, LifecycleCallback.NONE); List requiredConfigProperty = null; List configProperty = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("activationspecType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("activationspecType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ActivationSpec.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, activationSpec); activationSpec.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("activationspec-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("activationspec-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: activationSpecClass - final String activationSpecClassRaw = elementReader.getElementAsString(); + String activationSpecClassRaw = elementReader.getElementText(); - final String activationSpecClass; + String activationSpecClass; try { activationSpecClass = Adapters.collapsedStringAdapterAdapter.unmarshal(activationSpecClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } activationSpec.activationSpecClass = activationSpecClass; - } else if (("required-config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("required-config-property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: requiredConfigProperty - final RequiredConfigProperty requiredConfigPropertyItem = readRequiredConfigProperty(elementReader, context); + RequiredConfigProperty requiredConfigPropertyItem = readRequiredConfigProperty(elementReader, context); if (requiredConfigProperty == null) { requiredConfigProperty = activationSpec.requiredConfigProperty; - if (requiredConfigProperty != null) { + if (requiredConfigProperty!= null) { requiredConfigProperty.clear(); } else { - requiredConfigProperty = new ArrayList(); + requiredConfigProperty = new ArrayList<>(); } } requiredConfigProperty.add(requiredConfigPropertyItem); - } else if (("config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("config-property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: configProperty - final ConfigProperty configPropertyItem = readConfigProperty(elementReader, context); + ConfigProperty configPropertyItem = readConfigProperty(elementReader, context); if (configProperty == null) { configProperty = activationSpec.configProperty; - if (configProperty != null) { + if (configProperty!= null) { configProperty.clear(); } else { - configProperty = new ArrayList(); + configProperty = new ArrayList<>(); } } configProperty.add(configPropertyItem); @@ -141,10 +147,10 @@ public final static ActivationSpec _read(final XoXMLStreamReader reader, Runtime context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "activationspec-class"), new QName("http://java.sun.com/xml/ns/javaee", "required-config-property"), new QName("http://java.sun.com/xml/ns/javaee", "config-property")); } } - if (requiredConfigProperty != null) { + if (requiredConfigProperty!= null) { activationSpec.requiredConfigProperty = requiredConfigProperty; } - if (configProperty != null) { + if (configProperty!= null) { activationSpec.configProperty = configProperty; } @@ -153,52 +159,54 @@ public final static ActivationSpec _read(final XoXMLStreamReader reader, Runtime return activationSpec; } - public final ActivationSpec read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ActivationSpec read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ActivationSpec activationSpec, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ActivationSpec activationSpec, RuntimeContext context) + throws Exception + { if (activationSpec == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ActivationSpec.class != activationSpec.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ActivationSpec.class!= activationSpec.getClass()) { context.unexpectedSubclass(writer, activationSpec, ActivationSpec.class); - return; + return ; } context.beforeMarshal(activationSpec, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = activationSpec.id; - if (idRaw != null) { + String idRaw = activationSpec.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(activationSpec, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: activationSpecClass - final String activationSpecClassRaw = activationSpec.activationSpecClass; + String activationSpecClassRaw = activationSpec.activationSpecClass; String activationSpecClass = null; try { activationSpecClass = Adapters.collapsedStringAdapterAdapter.marshal(activationSpecClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(activationSpec, "activationSpecClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (activationSpecClass != null) { + if (activationSpecClass!= null) { writer.writeStartElement(prefix, "activationspec-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(activationSpecClass); writer.writeEndElement(); @@ -207,10 +215,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Activation } // ELEMENT: requiredConfigProperty - final List requiredConfigProperty = activationSpec.requiredConfigProperty; - if (requiredConfigProperty != null) { - for (final RequiredConfigProperty requiredConfigPropertyItem : requiredConfigProperty) { - if (requiredConfigPropertyItem != null) { + List requiredConfigProperty = activationSpec.requiredConfigProperty; + if (requiredConfigProperty!= null) { + for (RequiredConfigProperty requiredConfigPropertyItem: requiredConfigProperty) { + if (requiredConfigPropertyItem!= null) { writer.writeStartElement(prefix, "required-config-property", "http://java.sun.com/xml/ns/javaee"); writeRequiredConfigProperty(writer, requiredConfigPropertyItem, context); writer.writeEndElement(); @@ -219,10 +227,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Activation } // ELEMENT: configProperty - final List configProperty = activationSpec.configProperty; - if (configProperty != null) { - for (final ConfigProperty configPropertyItem : configProperty) { - if (configPropertyItem != null) { + List configProperty = activationSpec.configProperty; + if (configProperty!= null) { + for (ConfigProperty configPropertyItem: configProperty) { + if (configPropertyItem!= null) { writer.writeStartElement(prefix, "config-property", "http://java.sun.com/xml/ns/javaee"); writeConfigProperty(writer, configPropertyItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Adapters.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Adapters.java index cc8ea2116f4..6faf92789e5 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Adapters.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Adapters.java @@ -1,31 +1,32 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; public class Adapters { - public final static CollapsedStringAdapter collapsedStringAdapterAdapter = new CollapsedStringAdapter(); - public final static StringAdapter stringAdapterAdapter = new StringAdapter(); - public final static HandlerChainsStringQNameAdapter handlerChainsStringQNameAdapterAdapter = new HandlerChainsStringQNameAdapter(); - public final static TimeUnitAdapter timeUnitAdapterAdapter = new TimeUnitAdapter(); - public final static BooleanAdapter booleanAdapterAdapter = new BooleanAdapter(); - public final static TrimStringAdapter trimStringAdapterAdapter = new TrimStringAdapter(); - public final static LoadOnStartupAdapter loadOnStartupAdapterAdapter = new LoadOnStartupAdapter(); + public static final CollapsedStringAdapter collapsedStringAdapterAdapter = new CollapsedStringAdapter(); + public static final StringAdapter stringAdapterAdapter = new StringAdapter(); + public static final HandlerChainsStringQNameAdapter handlerChainsStringQNameAdapterAdapter = new HandlerChainsStringQNameAdapter(); + public static final TimeUnitAdapter timeUnitAdapterAdapter = new TimeUnitAdapter(); + public static final BooleanAdapter booleanAdapterAdapter = new BooleanAdapter(); + public static final TrimStringAdapter trimStringAdapterAdapter = new TrimStringAdapter(); + public static final LoadOnStartupAdapter loadOnStartupAdapterAdapter = new LoadOnStartupAdapter(); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Addressing$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Addressing$JAXB.java index f2b0f2b71b5..41b8f3afa51 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Addressing$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Addressing$JAXB.java @@ -1,21 +1,24 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,8 +26,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.AddressingResponses$JAXB.parseAddressingResponses; import static org.apache.openejb.jee.AddressingResponses$JAXB.toStringAddressingResponses; @@ -33,30 +34,35 @@ "StringEquality" }) public class Addressing$JAXB - extends JAXBObject { + extends JAXBObject +{ public Addressing$JAXB() { super(Addressing.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "addressingType".intern()), AddressingResponses$JAXB.class); } - public static Addressing readAddressing(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Addressing readAddressing(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeAddressing(final XoXMLStreamWriter writer, final Addressing addressing, final RuntimeContext context) - throws Exception { + public static void writeAddressing(XoXMLStreamWriter writer, Addressing addressing, RuntimeContext context) + throws Exception + { _write(writer, addressing, context); } - public void write(final XoXMLStreamWriter writer, final Addressing addressing, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Addressing addressing, RuntimeContext context) + throws Exception + { _write(writer, addressing, context); } - public final static Addressing _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Addressing _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,37 +73,39 @@ public final static Addressing _read(final XoXMLStreamReader reader, RuntimeCont context = new RuntimeContext(); } - final Addressing addressing = new Addressing(); + Addressing addressing = new Addressing(); context.beforeUnmarshal(addressing, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("addressingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("addressingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Addressing.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("enabled" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("enabled" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: enabled - addressing.enabled = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); - } else if (("required" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + Boolean enabled = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + addressing.enabled = enabled; + } else if (("required" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: required - addressing.required = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); - } else if (("responses" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + Boolean required = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + addressing.required = required; + } else if (("responses" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: responses - final AddressingResponses responses = parseAddressingResponses(elementReader, context, elementReader.getElementAsString()); - if (responses != null) { + AddressingResponses responses = parseAddressingResponses(elementReader, context, elementReader.getElementText()); + if (responses!= null) { addressing.responses = responses; } } else { @@ -110,50 +118,52 @@ public final static Addressing _read(final XoXMLStreamReader reader, RuntimeCont return addressing; } - public final Addressing read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Addressing read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Addressing addressing, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Addressing addressing, RuntimeContext context) + throws Exception + { if (addressing == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Addressing.class != addressing.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Addressing.class!= addressing.getClass()) { context.unexpectedSubclass(writer, addressing, Addressing.class); - return; + return ; } context.beforeMarshal(addressing, LifecycleCallback.NONE); // ELEMENT: enabled - final Boolean enabled = addressing.enabled; - if (enabled != null) { + Boolean enabled = addressing.enabled; + if (enabled!= null) { writer.writeStartElement(prefix, "enabled", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(enabled)); writer.writeEndElement(); } // ELEMENT: required - final Boolean required = addressing.required; - if (required != null) { + Boolean required = addressing.required; + if (required!= null) { writer.writeStartElement(prefix, "required", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(required)); writer.writeEndElement(); } // ELEMENT: responses - final AddressingResponses responses = addressing.responses; - if (responses != null) { + AddressingResponses responses = addressing.responses; + if (responses!= null) { writer.writeStartElement(prefix, "responses", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringAddressingResponses(addressing, null, context, responses)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AddressingResponses$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AddressingResponses$JAXB.java index 116eaea5c53..f262e92455d 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AddressingResponses$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AddressingResponses$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class AddressingResponses$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public AddressingResponses$JAXB() { super(AddressingResponses.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "addressing-responsesType".intern())); } - public AddressingResponses parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public AddressingResponses parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseAddressingResponses(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final AddressingResponses addressingResponses) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, AddressingResponses addressingResponses) + throws Exception + { return toStringAddressingResponses(bean, parameterName, context, addressingResponses); } - public static AddressingResponses parseAddressingResponses(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static AddressingResponses parseAddressingResponses(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("ANONYMOUS".equals(value)) { return AddressingResponses.ANONYMOUS; } else if ("NON_ANONYMOUS".equals(value)) { @@ -54,8 +58,9 @@ public static AddressingResponses parseAddressingResponses(final XoXMLStreamRead } } - public static String toStringAddressingResponses(final Object bean, final String parameterName, final RuntimeContext context, final AddressingResponses addressingResponses) - throws Exception { + public static String toStringAddressingResponses(Object bean, String parameterName, RuntimeContext context, AddressingResponses addressingResponses) + throws Exception + { if (AddressingResponses.ANONYMOUS == addressingResponses) { return "ANONYMOUS"; } else if (AddressingResponses.NON_ANONYMOUS == addressingResponses) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AdminObject$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AdminObject$JAXB.java index 8a4fc6b3e38..28698e1db71 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AdminObject$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AdminObject$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.ConfigProperty$JAXB.readConfigProperty; import static org.apache.openejb.jee.ConfigProperty$JAXB.writeConfigProperty; @@ -36,30 +37,35 @@ "StringEquality" }) public class AdminObject$JAXB - extends JAXBObject { + extends JAXBObject +{ public AdminObject$JAXB() { super(AdminObject.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "adminobjectType".intern()), ConfigProperty$JAXB.class); } - public static AdminObject readAdminObject(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static AdminObject readAdminObject(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeAdminObject(final XoXMLStreamWriter writer, final AdminObject adminObject, final RuntimeContext context) - throws Exception { + public static void writeAdminObject(XoXMLStreamWriter writer, AdminObject adminObject, RuntimeContext context) + throws Exception + { _write(writer, adminObject, context); } - public void write(final XoXMLStreamWriter writer, final AdminObject adminObject, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, AdminObject adminObject, RuntimeContext context) + throws Exception + { _write(writer, adminObject, context); } - public final static AdminObject _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final AdminObject _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,68 +76,68 @@ public final static AdminObject _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final AdminObject adminObject = new AdminObject(); + AdminObject adminObject = new AdminObject(); context.beforeUnmarshal(adminObject, LifecycleCallback.NONE); List configProperty = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("adminobjectType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("adminobjectType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, AdminObject.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, adminObject); adminObject.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("adminobject-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("adminobject-interface" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: adminObjectInterface - final String adminObjectInterfaceRaw = elementReader.getElementAsString(); + String adminObjectInterfaceRaw = elementReader.getElementText(); - final String adminObjectInterface; + String adminObjectInterface; try { adminObjectInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(adminObjectInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } adminObject.adminObjectInterface = adminObjectInterface; - } else if (("adminobject-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("adminobject-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: adminObjectClass - final String adminObjectClassRaw = elementReader.getElementAsString(); + String adminObjectClassRaw = elementReader.getElementText(); - final String adminObjectClass; + String adminObjectClass; try { adminObjectClass = Adapters.collapsedStringAdapterAdapter.unmarshal(adminObjectClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } adminObject.adminObjectClass = adminObjectClass; - } else if (("config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("config-property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: configProperty - final ConfigProperty configPropertyItem = readConfigProperty(elementReader, context); + ConfigProperty configPropertyItem = readConfigProperty(elementReader, context); if (configProperty == null) { configProperty = adminObject.configProperty; - if (configProperty != null) { + if (configProperty!= null) { configProperty.clear(); } else { - configProperty = new ArrayList(); + configProperty = new ArrayList<>(); } } configProperty.add(configPropertyItem); @@ -139,7 +145,7 @@ public final static AdminObject _read(final XoXMLStreamReader reader, RuntimeCon context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "adminobject-interface"), new QName("http://java.sun.com/xml/ns/javaee", "adminobject-class"), new QName("http://java.sun.com/xml/ns/javaee", "config-property")); } } - if (configProperty != null) { + if (configProperty!= null) { adminObject.configProperty = configProperty; } @@ -148,52 +154,54 @@ public final static AdminObject _read(final XoXMLStreamReader reader, RuntimeCon return adminObject; } - public final AdminObject read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final AdminObject read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final AdminObject adminObject, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, AdminObject adminObject, RuntimeContext context) + throws Exception + { if (adminObject == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (AdminObject.class != adminObject.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (AdminObject.class!= adminObject.getClass()) { context.unexpectedSubclass(writer, adminObject, AdminObject.class); - return; + return ; } context.beforeMarshal(adminObject, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = adminObject.id; - if (idRaw != null) { + String idRaw = adminObject.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(adminObject, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: adminObjectInterface - final String adminObjectInterfaceRaw = adminObject.adminObjectInterface; + String adminObjectInterfaceRaw = adminObject.adminObjectInterface; String adminObjectInterface = null; try { adminObjectInterface = Adapters.collapsedStringAdapterAdapter.marshal(adminObjectInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(adminObject, "adminObjectInterface", CollapsedStringAdapter.class, String.class, String.class, e); } - if (adminObjectInterface != null) { + if (adminObjectInterface!= null) { writer.writeStartElement(prefix, "adminobject-interface", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(adminObjectInterface); writer.writeEndElement(); @@ -202,14 +210,14 @@ public final static void _write(final XoXMLStreamWriter writer, final AdminObjec } // ELEMENT: adminObjectClass - final String adminObjectClassRaw = adminObject.adminObjectClass; + String adminObjectClassRaw = adminObject.adminObjectClass; String adminObjectClass = null; try { adminObjectClass = Adapters.collapsedStringAdapterAdapter.marshal(adminObjectClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(adminObject, "adminObjectClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (adminObjectClass != null) { + if (adminObjectClass!= null) { writer.writeStartElement(prefix, "adminobject-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(adminObjectClass); writer.writeEndElement(); @@ -218,10 +226,10 @@ public final static void _write(final XoXMLStreamWriter writer, final AdminObjec } // ELEMENT: configProperty - final List configProperty = adminObject.configProperty; - if (configProperty != null) { - for (final ConfigProperty configPropertyItem : configProperty) { - if (configPropertyItem != null) { + List configProperty = adminObject.configProperty; + if (configProperty!= null) { + for (ConfigProperty configPropertyItem: configProperty) { + if (configPropertyItem!= null) { writer.writeStartElement(prefix, "config-property", "http://java.sun.com/xml/ns/javaee"); writeConfigProperty(writer, configPropertyItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Application$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Application$JAXB.java index bd8acc0d48f..bd5e27321f1 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Application$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Application$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,12 +29,9 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; @@ -39,6 +42,10 @@ import static org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; import static org.apache.openejb.jee.MessageDestination$JAXB.readMessageDestination; import static org.apache.openejb.jee.MessageDestination$JAXB.writeMessageDestination; import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef; @@ -64,30 +71,35 @@ "StringEquality" }) public class Application$JAXB - extends JAXBObject { + extends JAXBObject +{ public Application$JAXB() { - super(Application.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "application".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "applicationType".intern()), Text$JAXB.class, Icon$JAXB.class, Module$JAXB.class, SecurityRole$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, MessageDestination$JAXB.class, DataSource$JAXB.class); + super(Application.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "application".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "applicationType".intern()), Text$JAXB.class, Icon$JAXB.class, Module$JAXB.class, SecurityRole$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, MessageDestination$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, ContextService$JAXB.class); } - public static Application readApplication(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Application readApplication(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeApplication(final XoXMLStreamWriter writer, final Application application, final RuntimeContext context) - throws Exception { + public static void writeApplication(XoXMLStreamWriter writer, Application application, RuntimeContext context) + throws Exception + { _write(writer, application, context); } - public void write(final XoXMLStreamWriter writer, final Application application, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Application application, RuntimeContext context) + throws Exception + { _write(writer, application, context); } - public final static Application _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Application _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -98,7 +110,7 @@ public final static Application _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final Application application = new Application(); + Application application = new Application(); context.beforeUnmarshal(application, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -117,368 +129,418 @@ public final static Application _read(final XoXMLStreamReader reader, RuntimeCon KeyedCollection persistenceUnitRef = null; KeyedCollection messageDestination = null; KeyedCollection dataSource = null; + KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; + KeyedCollection contextService = 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())) { + 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))) { + for (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))) { + } else if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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())) { + for (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(); + String applicationNameRaw = elementReader.getElementText(); - final String applicationName; + String applicationName; try { applicationName = Adapters.collapsedStringAdapterAdapter.unmarshal(applicationNameRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: descriptions - final Text descriptionsItem = readText(elementReader, context); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = application.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("initialize-in-order" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } 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())); + Boolean initializeInOrder = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); application.initializeInOrder = initializeInOrder; - } else if (("module" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("module" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: module - final Module moduleItem = readModule(elementReader, context); + Module moduleItem = readModule(elementReader, context); if (module == null) { module = application.module; - if (module != null) { + if (module!= null) { module.clear(); } else { - module = new ArrayList(); + module = new ArrayList<>(); } } module.add(moduleItem); - } else if (("security-role" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("security-role" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityRole - final SecurityRole securityRoleItem = readSecurityRole(elementReader, context); + SecurityRole securityRoleItem = readSecurityRole(elementReader, context); if (securityRole == null) { securityRole = application.securityRole; - if (securityRole != null) { + if (securityRole!= null) { securityRole.clear(); } else { - securityRole = new ArrayList(); + securityRole = new ArrayList<>(); } } securityRole.add(securityRoleItem); - } else if (("library-directory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("library-directory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: libraryDirectory - final String libraryDirectoryRaw = elementReader.getElementAsString(); + String libraryDirectoryRaw = elementReader.getElementText(); - final String libraryDirectory; + String libraryDirectory; try { libraryDirectory = Adapters.collapsedStringAdapterAdapter.unmarshal(libraryDirectoryRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: envEntry - final EnvEntry envEntryItem = readEnvEntry(elementReader, context); + EnvEntry envEntryItem = readEnvEntry(elementReader, context); if (envEntry == null) { envEntry = application.envEntry; - if (envEntry != null) { + if (envEntry!= null) { envEntry.clear(); } else { - envEntry = new KeyedCollection(); + envEntry = new KeyedCollection<>(); } } envEntry.add(envEntryItem); - } else if (("ejb-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRef - final EjbRef ejbRefItem = readEjbRef(elementReader, context); + EjbRef ejbRefItem = readEjbRef(elementReader, context); if (ejbRef == null) { ejbRef = application.ejbRef; - if (ejbRef != null) { + if (ejbRef!= null) { ejbRef.clear(); } else { - ejbRef = new KeyedCollection(); + ejbRef = new KeyedCollection<>(); } } ejbRef.add(ejbRefItem); - } else if (("ejb-local-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbLocalRef - final EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); if (ejbLocalRef == null) { ejbLocalRef = application.ejbLocalRef; - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { ejbLocalRef.clear(); } else { - ejbLocalRef = new KeyedCollection(); + ejbLocalRef = new KeyedCollection<>(); } } ejbLocalRef.add(ejbLocalRefItem); - } else if (("service-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceRef - final ServiceRef serviceRefItem = readServiceRef(elementReader, context); + ServiceRef serviceRefItem = readServiceRef(elementReader, context); if (serviceRef == null) { serviceRef = application.serviceRef; - if (serviceRef != null) { + if (serviceRef!= null) { serviceRef.clear(); } else { - serviceRef = new KeyedCollection(); + serviceRef = new KeyedCollection<>(); } } serviceRef.add(serviceRefItem); - } else if (("resource-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceRef - final ResourceRef resourceRefItem = readResourceRef(elementReader, context); + ResourceRef resourceRefItem = readResourceRef(elementReader, context); if (resourceRef == null) { resourceRef = application.resourceRef; - if (resourceRef != null) { + if (resourceRef!= null) { resourceRef.clear(); } else { - resourceRef = new KeyedCollection(); + resourceRef = new KeyedCollection<>(); } } resourceRef.add(resourceRefItem); - } else if (("resource-env-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceEnvRef - final ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); if (resourceEnvRef == null) { resourceEnvRef = application.resourceEnvRef; - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { resourceEnvRef.clear(); } else { - resourceEnvRef = new KeyedCollection(); + resourceEnvRef = new KeyedCollection<>(); } } resourceEnvRef.add(resourceEnvRefItem); - } else if (("message-destination-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationRef - final MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); if (messageDestinationRef == null) { messageDestinationRef = application.messageDestinationRef; - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { messageDestinationRef.clear(); } else { - messageDestinationRef = new KeyedCollection(); + messageDestinationRef = new KeyedCollection<>(); } } messageDestinationRef.add(messageDestinationRefItem); - } else if (("persistence-context-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceContextRef - final PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); if (persistenceContextRef == null) { persistenceContextRef = application.persistenceContextRef; - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { persistenceContextRef.clear(); } else { - persistenceContextRef = new KeyedCollection(); + persistenceContextRef = new KeyedCollection<>(); } } persistenceContextRef.add(persistenceContextRefItem); - } else if (("persistence-unit-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceUnitRef - final PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); if (persistenceUnitRef == null) { persistenceUnitRef = application.persistenceUnitRef; - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { persistenceUnitRef.clear(); } else { - persistenceUnitRef = new KeyedCollection(); + persistenceUnitRef = new KeyedCollection<>(); } } persistenceUnitRef.add(persistenceUnitRefItem); - } else if (("message-destination" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestination - final MessageDestination messageDestinationItem = readMessageDestination(elementReader, context); + MessageDestination messageDestinationItem = readMessageDestination(elementReader, context); if (messageDestination == null) { messageDestination = application.messageDestination; - if (messageDestination != null) { + if (messageDestination!= null) { messageDestination.clear(); } else { - messageDestination = new KeyedCollection(); + messageDestination = new KeyedCollection<>(); } } messageDestination.add(messageDestinationItem); - } else if (("data-source" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dataSource - final DataSource dataSourceItem = readDataSource(elementReader, context); + DataSource dataSourceItem = readDataSource(elementReader, context); if (dataSource == null) { dataSource = application.dataSource; - if (dataSource != null) { + if (dataSource!= null) { dataSource.clear(); } else { - dataSource = new KeyedCollection(); + dataSource = new KeyedCollection<>(); } } dataSource.add(dataSourceItem); + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); + if (jmsConnectionFactories == null) { + jmsConnectionFactories = application.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + jmsConnectionFactories.clear(); + } else { + jmsConnectionFactories = new KeyedCollection<>(); + } + } + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = application.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = application.contextService; + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } + } + contextService.add(contextServiceItem); } 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")); + 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"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - application.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + application.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Application.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - application.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + application.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, Application.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { application.icon = icon; } - if (module != null) { + if (module!= null) { application.module = module; } - if (securityRole != null) { + if (securityRole!= null) { application.securityRole = securityRole; } - if (envEntry != null) { + if (envEntry!= null) { application.envEntry = envEntry; } - if (ejbRef != null) { + if (ejbRef!= null) { application.ejbRef = ejbRef; } - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { application.ejbLocalRef = ejbLocalRef; } - if (serviceRef != null) { + if (serviceRef!= null) { application.serviceRef = serviceRef; } - if (resourceRef != null) { + if (resourceRef!= null) { application.resourceRef = resourceRef; } - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { application.resourceEnvRef = resourceEnvRef; } - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { application.messageDestinationRef = messageDestinationRef; } - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { application.persistenceContextRef = persistenceContextRef; } - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { application.persistenceUnitRef = persistenceUnitRef; } - if (messageDestination != null) { + if (messageDestination!= null) { application.messageDestination = messageDestination; } - if (dataSource != null) { + if (dataSource!= null) { application.dataSource = dataSource; } + if (jmsConnectionFactories!= null) { + application.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + application.jmsDestinations = jmsDestinations; + } + if (contextService!= null) { + application.contextService = contextService; + } context.afterUnmarshal(application, LifecycleCallback.NONE); return application; } - public final Application read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Application read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Application application, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Application application, RuntimeContext context) + throws Exception + { if (application == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Application.class != application.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Application.class!= application.getClass()) { context.unexpectedSubclass(writer, application, Application.class); - return; + return ; } context.beforeMarshal(application, LifecycleCallback.NONE); // ATTRIBUTE: version - final String versionRaw = application.version; - if (versionRaw != null) { + String versionRaw = application.version; + if (versionRaw!= null) { String version = null; try { version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw); - } catch (final Exception e) { + } catch (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 idRaw = application.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (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 applicationNameRaw = application.applicationName; String applicationName = null; try { applicationName = Adapters.collapsedStringAdapterAdapter.marshal(applicationNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(application, "applicationName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (applicationName != null) { + if (applicationName!= null) { writer.writeStartElement(prefix, "application-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(applicationName); writer.writeEndElement(); @@ -488,12 +550,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio Text[] descriptions = null; try { descriptions = application.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(application, "descriptions", Application.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -507,12 +569,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio Text[] displayNames = null; try { displayNames = application.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(application, "displayNames", Application.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -523,10 +585,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: icon - final LocalCollection icon = application.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = application.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -537,18 +599,18 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: initializeInOrder - final Boolean initializeInOrder = application.initializeInOrder; - if (initializeInOrder != null) { + 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 = application.module; - if (module != null) { - for (final Module moduleItem : module) { - if (moduleItem != null) { + List module = application.module; + if (module!= null) { + for (Module moduleItem: module) { + if (moduleItem!= null) { writer.writeStartElement(prefix, "module", "http://java.sun.com/xml/ns/javaee"); writeModule(writer, moduleItem, context); writer.writeEndElement(); @@ -559,10 +621,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: securityRole - final List securityRole = application.securityRole; - if (securityRole != null) { - for (final SecurityRole securityRoleItem : securityRole) { - if (securityRoleItem != null) { + List securityRole = application.securityRole; + if (securityRole!= null) { + for (SecurityRole securityRoleItem: securityRole) { + if (securityRoleItem!= null) { writer.writeStartElement(prefix, "security-role", "http://java.sun.com/xml/ns/javaee"); writeSecurityRole(writer, securityRoleItem, context); writer.writeEndElement(); @@ -571,24 +633,24 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: libraryDirectory - final String libraryDirectoryRaw = application.libraryDirectory; + String libraryDirectoryRaw = application.libraryDirectory; String libraryDirectory = null; try { libraryDirectory = Adapters.collapsedStringAdapterAdapter.marshal(libraryDirectoryRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(application, "libraryDirectory", CollapsedStringAdapter.class, String.class, String.class, e); } - if (libraryDirectory != null) { + if (libraryDirectory!= null) { writer.writeStartElement(prefix, "library-directory", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(libraryDirectory); writer.writeEndElement(); } // ELEMENT: envEntry - final KeyedCollection envEntry = application.envEntry; - if (envEntry != null) { - for (final EnvEntry envEntryItem : envEntry) { - if (envEntryItem != null) { + KeyedCollection envEntry = application.envEntry; + if (envEntry!= null) { + for (EnvEntry envEntryItem: envEntry) { + if (envEntryItem!= null) { writer.writeStartElement(prefix, "env-entry", "http://java.sun.com/xml/ns/javaee"); writeEnvEntry(writer, envEntryItem, context); writer.writeEndElement(); @@ -599,10 +661,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: ejbRef - final KeyedCollection ejbRef = application.ejbRef; - if (ejbRef != null) { - for (final EjbRef ejbRefItem : ejbRef) { - if (ejbRefItem != null) { + KeyedCollection ejbRef = application.ejbRef; + if (ejbRef!= null) { + for (EjbRef ejbRefItem: ejbRef) { + if (ejbRefItem!= null) { writer.writeStartElement(prefix, "ejb-ref", "http://java.sun.com/xml/ns/javaee"); writeEjbRef(writer, ejbRefItem, context); writer.writeEndElement(); @@ -613,10 +675,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: ejbLocalRef - final KeyedCollection ejbLocalRef = application.ejbLocalRef; - if (ejbLocalRef != null) { - for (final EjbLocalRef ejbLocalRefItem : ejbLocalRef) { - if (ejbLocalRefItem != null) { + KeyedCollection ejbLocalRef = application.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(); @@ -627,10 +689,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: serviceRef - final KeyedCollection serviceRef = application.serviceRef; - if (serviceRef != null) { - for (final ServiceRef serviceRefItem : serviceRef) { - if (serviceRefItem != null) { + KeyedCollection serviceRef = application.serviceRef; + if (serviceRef!= null) { + for (ServiceRef serviceRefItem: serviceRef) { + if (serviceRefItem!= null) { writer.writeStartElement(prefix, "service-ref", "http://java.sun.com/xml/ns/javaee"); writeServiceRef(writer, serviceRefItem, context); writer.writeEndElement(); @@ -641,10 +703,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: resourceRef - final KeyedCollection resourceRef = application.resourceRef; - if (resourceRef != null) { - for (final ResourceRef resourceRefItem : resourceRef) { - if (resourceRefItem != null) { + KeyedCollection resourceRef = application.resourceRef; + if (resourceRef!= null) { + for (ResourceRef resourceRefItem: resourceRef) { + if (resourceRefItem!= null) { writer.writeStartElement(prefix, "resource-ref", "http://java.sun.com/xml/ns/javaee"); writeResourceRef(writer, resourceRefItem, context); writer.writeEndElement(); @@ -655,10 +717,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: resourceEnvRef - final KeyedCollection resourceEnvRef = application.resourceEnvRef; - if (resourceEnvRef != null) { - for (final ResourceEnvRef resourceEnvRefItem : resourceEnvRef) { - if (resourceEnvRefItem != null) { + KeyedCollection resourceEnvRef = application.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(); @@ -669,10 +731,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: messageDestinationRef - final KeyedCollection messageDestinationRef = application.messageDestinationRef; - if (messageDestinationRef != null) { - for (final MessageDestinationRef messageDestinationRefItem : messageDestinationRef) { - if (messageDestinationRefItem != null) { + KeyedCollection messageDestinationRef = application.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(); @@ -683,10 +745,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: persistenceContextRef - final KeyedCollection persistenceContextRef = application.persistenceContextRef; - if (persistenceContextRef != null) { - for (final PersistenceContextRef persistenceContextRefItem : persistenceContextRef) { - if (persistenceContextRefItem != null) { + KeyedCollection persistenceContextRef = application.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(); @@ -697,10 +759,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: persistenceUnitRef - final KeyedCollection persistenceUnitRef = application.persistenceUnitRef; - if (persistenceUnitRef != null) { - for (final PersistenceUnitRef persistenceUnitRefItem : persistenceUnitRef) { - if (persistenceUnitRefItem != null) { + KeyedCollection persistenceUnitRef = application.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(); @@ -711,10 +773,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: messageDestination - final KeyedCollection messageDestination = application.messageDestination; - if (messageDestination != null) { - for (final MessageDestination messageDestinationItem : messageDestination) { - if (messageDestinationItem != null) { + KeyedCollection messageDestination = application.messageDestination; + if (messageDestination!= null) { + for (MessageDestination messageDestinationItem: messageDestination) { + if (messageDestinationItem!= null) { writer.writeStartElement(prefix, "message-destination", "http://java.sun.com/xml/ns/javaee"); writeMessageDestination(writer, messageDestinationItem, context); writer.writeEndElement(); @@ -725,10 +787,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: dataSource - final KeyedCollection dataSource = application.dataSource; - if (dataSource != null) { - for (final DataSource dataSourceItem : dataSource) { - if (dataSourceItem != null) { + KeyedCollection dataSource = application.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); writeDataSource(writer, dataSourceItem, context); writer.writeEndElement(); @@ -736,6 +798,44 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } } + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = application.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(application, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = application.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: contextService + KeyedCollection contextService = application.contextService; + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + context.afterMarshal(application, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationClient$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationClient$JAXB.java index 980786cc1cf..dbf35db6850 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationClient$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationClient$JAXB.java @@ -1,33 +1,37 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; @@ -38,6 +42,10 @@ import static org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback; import static org.apache.openejb.jee.MessageDestination$JAXB.readMessageDestination; @@ -61,30 +69,36 @@ "StringEquality" }) public class ApplicationClient$JAXB - extends JAXBObject { + extends JAXBObject +{ + private static final FieldAccessor> applicationClientContextService = new FieldAccessor<>(ApplicationClient.class, "contextService"); public ApplicationClient$JAXB() { - super(ApplicationClient.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "application-client".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "application-clientType".intern()), Text$JAXB.class, Icon$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, MessageDestination$JAXB.class, DataSource$JAXB.class); + super(ApplicationClient.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "application-client".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "application-clientType".intern()), Text$JAXB.class, Icon$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, MessageDestination$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, ContextService$JAXB.class); } - public static ApplicationClient readApplicationClient(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ApplicationClient readApplicationClient(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeApplicationClient(final XoXMLStreamWriter writer, final ApplicationClient applicationClient, final RuntimeContext context) - throws Exception { + public static void writeApplicationClient(XoXMLStreamWriter writer, ApplicationClient applicationClient, RuntimeContext context) + throws Exception + { _write(writer, applicationClient, context); } - public void write(final XoXMLStreamWriter writer, final ApplicationClient applicationClient, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ApplicationClient applicationClient, RuntimeContext context) + throws Exception + { _write(writer, applicationClient, context); } - public final static ApplicationClient _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ApplicationClient _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -95,7 +109,7 @@ public final static ApplicationClient _read(final XoXMLStreamReader reader, Runt context = new RuntimeContext(); } - final ApplicationClient applicationClient = new ApplicationClient(); + ApplicationClient applicationClient = new ApplicationClient(); context.beforeUnmarshal(applicationClient, org.metatype.sxc.jaxb.LifecycleCallback.NONE); ArrayList descriptions = null; @@ -114,374 +128,424 @@ public final static ApplicationClient _read(final XoXMLStreamReader reader, Runt List preDestroy = null; KeyedCollection messageDestination = null; KeyedCollection dataSource = null; + KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; + KeyedCollection contextService = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("application-clientType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("application-clientType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ApplicationClient.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, applicationClient); applicationClient.id = id; - } else if (("metadata-complete" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("metadata-complete" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: metadataComplete - final Boolean metadataComplete = ("1".equals(attribute.getValue()) || "true".equals(attribute.getValue())); + Boolean metadataComplete = ("1".equals(attribute.getValue())||"true".equals(attribute.getValue())); applicationClient.metadataComplete = metadataComplete; - } else if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("version" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: version applicationClient.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "metadata-complete"), new QName("", "version")); } } // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("module-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("module-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: moduleName - final String moduleNameRaw = elementReader.getElementAsString(); + String moduleNameRaw = elementReader.getElementText(); - final String moduleName; + String moduleName; try { moduleName = Adapters.collapsedStringAdapterAdapter.unmarshal(moduleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } applicationClient.moduleName = moduleName; - } else if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: descriptions - final Text descriptionsItem = readText(elementReader, context); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = applicationClient.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("env-entry" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: envEntry - final EnvEntry envEntryItem = readEnvEntry(elementReader, context); + EnvEntry envEntryItem = readEnvEntry(elementReader, context); if (envEntry == null) { envEntry = applicationClient.envEntry; - if (envEntry != null) { + if (envEntry!= null) { envEntry.clear(); } else { - envEntry = new KeyedCollection(); + envEntry = new KeyedCollection<>(); } } envEntry.add(envEntryItem); - } else if (("ejb-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRef - final EjbRef ejbRefItem = readEjbRef(elementReader, context); + EjbRef ejbRefItem = readEjbRef(elementReader, context); if (ejbRef == null) { ejbRef = applicationClient.ejbRef; - if (ejbRef != null) { + if (ejbRef!= null) { ejbRef.clear(); } else { - ejbRef = new KeyedCollection(); + ejbRef = new KeyedCollection<>(); } } ejbRef.add(ejbRefItem); - } else if (("ejb-local-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbLocalRef - final EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); if (ejbLocalRef == null) { ejbLocalRef = applicationClient.ejbLocalRef; - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { ejbLocalRef.clear(); } else { - ejbLocalRef = new KeyedCollection(); + ejbLocalRef = new KeyedCollection<>(); } } ejbLocalRef.add(ejbLocalRefItem); - } else if (("service-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceRef - final ServiceRef serviceRefItem = readServiceRef(elementReader, context); + ServiceRef serviceRefItem = readServiceRef(elementReader, context); if (serviceRef == null) { serviceRef = applicationClient.serviceRef; - if (serviceRef != null) { + if (serviceRef!= null) { serviceRef.clear(); } else { - serviceRef = new KeyedCollection(); + serviceRef = new KeyedCollection<>(); } } serviceRef.add(serviceRefItem); - } else if (("resource-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceRef - final ResourceRef resourceRefItem = readResourceRef(elementReader, context); + ResourceRef resourceRefItem = readResourceRef(elementReader, context); if (resourceRef == null) { resourceRef = applicationClient.resourceRef; - if (resourceRef != null) { + if (resourceRef!= null) { resourceRef.clear(); } else { - resourceRef = new KeyedCollection(); + resourceRef = new KeyedCollection<>(); } } resourceRef.add(resourceRefItem); - } else if (("resource-env-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceEnvRef - final ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); if (resourceEnvRef == null) { resourceEnvRef = applicationClient.resourceEnvRef; - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { resourceEnvRef.clear(); } else { - resourceEnvRef = new KeyedCollection(); + resourceEnvRef = new KeyedCollection<>(); } } resourceEnvRef.add(resourceEnvRefItem); - } else if (("message-destination-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationRef - final MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); if (messageDestinationRef == null) { messageDestinationRef = applicationClient.messageDestinationRef; - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { messageDestinationRef.clear(); } else { - messageDestinationRef = new KeyedCollection(); + messageDestinationRef = new KeyedCollection<>(); } } messageDestinationRef.add(messageDestinationRefItem); - } else if (("persistence-context-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceContextRef - final PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); if (persistenceContextRef == null) { persistenceContextRef = applicationClient.persistenceContextRef; - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { persistenceContextRef.clear(); } else { - persistenceContextRef = new KeyedCollection(); + persistenceContextRef = new KeyedCollection<>(); } } persistenceContextRef.add(persistenceContextRefItem); - } else if (("persistence-unit-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceUnitRef - final PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); if (persistenceUnitRef == null) { persistenceUnitRef = applicationClient.persistenceUnitRef; - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { persistenceUnitRef.clear(); } else { - persistenceUnitRef = new KeyedCollection(); + persistenceUnitRef = new KeyedCollection<>(); } } persistenceUnitRef.add(persistenceUnitRefItem); - } else if (("post-construct" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("post-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: postConstruct - final org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); if (postConstruct == null) { postConstruct = applicationClient.postConstruct; - if (postConstruct != null) { + if (postConstruct!= null) { postConstruct.clear(); } else { - postConstruct = new ArrayList(); + postConstruct = new ArrayList<>(); } } postConstruct.add(postConstructItem); - } else if (("pre-destroy" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("pre-destroy" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: preDestroy - final org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); if (preDestroy == null) { preDestroy = applicationClient.preDestroy; - if (preDestroy != null) { + if (preDestroy!= null) { preDestroy.clear(); } else { - preDestroy = new ArrayList(); + preDestroy = new ArrayList<>(); } } preDestroy.add(preDestroyItem); - } else if (("callback-handler" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("callback-handler" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: callbackHandler - final String callbackHandlerRaw = elementReader.getElementAsString(); + String callbackHandlerRaw = elementReader.getElementText(); - final String callbackHandler; + String callbackHandler; try { callbackHandler = Adapters.collapsedStringAdapterAdapter.unmarshal(callbackHandlerRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } applicationClient.callbackHandler = callbackHandler; - } else if (("message-destination" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestination - final MessageDestination messageDestinationItem = readMessageDestination(elementReader, context); + MessageDestination messageDestinationItem = readMessageDestination(elementReader, context); if (messageDestination == null) { messageDestination = applicationClient.messageDestination; - if (messageDestination != null) { + if (messageDestination!= null) { messageDestination.clear(); } else { - messageDestination = new KeyedCollection(); + messageDestination = new KeyedCollection<>(); } } messageDestination.add(messageDestinationItem); - } else if (("data-source" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dataSource - final DataSource dataSourceItem = readDataSource(elementReader, context); + DataSource dataSourceItem = readDataSource(elementReader, context); if (dataSource == null) { dataSource = applicationClient.dataSource; - if (dataSource != null) { + if (dataSource!= null) { dataSource.clear(); } else { - dataSource = new KeyedCollection(); + dataSource = new KeyedCollection<>(); } } dataSource.add(dataSourceItem); + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); + if (jmsConnectionFactories == null) { + jmsConnectionFactories = applicationClient.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + jmsConnectionFactories.clear(); + } else { + jmsConnectionFactories = new KeyedCollection<>(); + } + } + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = applicationClient.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = applicationClientContextService.getObject(reader, context, applicationClient); + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } + } + contextService.add(contextServiceItem); } else { - context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "module-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", "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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "callback-handler"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination"), new QName("http://java.sun.com/xml/ns/javaee", "data-source")); + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "module-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", "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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "callback-handler"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - applicationClient.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + applicationClient.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, ApplicationClient.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - applicationClient.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + applicationClient.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, ApplicationClient.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { applicationClient.icon = icon; } - if (envEntry != null) { + if (envEntry!= null) { applicationClient.envEntry = envEntry; } - if (ejbRef != null) { + if (ejbRef!= null) { applicationClient.ejbRef = ejbRef; } - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { applicationClient.ejbLocalRef = ejbLocalRef; } - if (serviceRef != null) { + if (serviceRef!= null) { applicationClient.serviceRef = serviceRef; } - if (resourceRef != null) { + if (resourceRef!= null) { applicationClient.resourceRef = resourceRef; } - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { applicationClient.resourceEnvRef = resourceEnvRef; } - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { applicationClient.messageDestinationRef = messageDestinationRef; } - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { applicationClient.persistenceContextRef = persistenceContextRef; } - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { applicationClient.persistenceUnitRef = persistenceUnitRef; } - if (postConstruct != null) { + if (postConstruct!= null) { applicationClient.postConstruct = postConstruct; } - if (preDestroy != null) { + if (preDestroy!= null) { applicationClient.preDestroy = preDestroy; } - if (messageDestination != null) { + if (messageDestination!= null) { applicationClient.messageDestination = messageDestination; } - if (dataSource != null) { + if (dataSource!= null) { applicationClient.dataSource = dataSource; } + if (jmsConnectionFactories!= null) { + applicationClient.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + applicationClient.jmsDestinations = jmsDestinations; + } + if (contextService!= null) { + applicationClientContextService.setObject(reader, context, applicationClient, contextService); + } context.afterUnmarshal(applicationClient, org.metatype.sxc.jaxb.LifecycleCallback.NONE); return applicationClient; } - public final ApplicationClient read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ApplicationClient read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ApplicationClient applicationClient, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ApplicationClient applicationClient, RuntimeContext context) + throws Exception + { if (applicationClient == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ApplicationClient.class != applicationClient.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ApplicationClient.class!= applicationClient.getClass()) { context.unexpectedSubclass(writer, applicationClient, ApplicationClient.class); - return; + return ; } context.beforeMarshal(applicationClient, org.metatype.sxc.jaxb.LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = applicationClient.id; - if (idRaw != null) { + String idRaw = applicationClient.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(applicationClient, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: metadataComplete - final Boolean metadataComplete = applicationClient.metadataComplete; - if (metadataComplete != null) { + Boolean metadataComplete = applicationClient.metadataComplete; + if (metadataComplete!= null) { writer.writeAttribute("", "", "metadata-complete", Boolean.toString(metadataComplete)); } // ATTRIBUTE: version - final String versionRaw = applicationClient.version; - if (versionRaw != null) { + String versionRaw = applicationClient.version; + if (versionRaw!= null) { String version = null; try { version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(applicationClient, "version", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "version", version); } // ELEMENT: moduleName - final String moduleNameRaw = applicationClient.moduleName; + String moduleNameRaw = applicationClient.moduleName; String moduleName = null; try { moduleName = Adapters.collapsedStringAdapterAdapter.marshal(moduleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(applicationClient, "moduleName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (moduleName != null) { + if (moduleName!= null) { writer.writeStartElement(prefix, "module-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(moduleName); writer.writeEndElement(); @@ -493,12 +557,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio Text[] descriptions = null; try { descriptions = applicationClient.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(applicationClient, "descriptions", ApplicationClient.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -512,12 +576,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio Text[] displayNames = null; try { displayNames = applicationClient.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(applicationClient, "displayNames", ApplicationClient.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -528,10 +592,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: icon - final LocalCollection icon = applicationClient.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = applicationClient.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -542,10 +606,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: envEntry - final KeyedCollection envEntry = applicationClient.envEntry; - if (envEntry != null) { - for (final EnvEntry envEntryItem : envEntry) { - if (envEntryItem != null) { + KeyedCollection envEntry = applicationClient.envEntry; + if (envEntry!= null) { + for (EnvEntry envEntryItem: envEntry) { + if (envEntryItem!= null) { writer.writeStartElement(prefix, "env-entry", "http://java.sun.com/xml/ns/javaee"); writeEnvEntry(writer, envEntryItem, context); writer.writeEndElement(); @@ -556,10 +620,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: ejbRef - final KeyedCollection ejbRef = applicationClient.ejbRef; - if (ejbRef != null) { - for (final EjbRef ejbRefItem : ejbRef) { - if (ejbRefItem != null) { + KeyedCollection ejbRef = applicationClient.ejbRef; + if (ejbRef!= null) { + for (EjbRef ejbRefItem: ejbRef) { + if (ejbRefItem!= null) { writer.writeStartElement(prefix, "ejb-ref", "http://java.sun.com/xml/ns/javaee"); writeEjbRef(writer, ejbRefItem, context); writer.writeEndElement(); @@ -570,10 +634,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: ejbLocalRef - final KeyedCollection ejbLocalRef = applicationClient.ejbLocalRef; - if (ejbLocalRef != null) { - for (final EjbLocalRef ejbLocalRefItem : ejbLocalRef) { - if (ejbLocalRefItem != null) { + KeyedCollection ejbLocalRef = applicationClient.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(); @@ -584,10 +648,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: serviceRef - final KeyedCollection serviceRef = applicationClient.serviceRef; - if (serviceRef != null) { - for (final ServiceRef serviceRefItem : serviceRef) { - if (serviceRefItem != null) { + KeyedCollection serviceRef = applicationClient.serviceRef; + if (serviceRef!= null) { + for (ServiceRef serviceRefItem: serviceRef) { + if (serviceRefItem!= null) { writer.writeStartElement(prefix, "service-ref", "http://java.sun.com/xml/ns/javaee"); writeServiceRef(writer, serviceRefItem, context); writer.writeEndElement(); @@ -598,10 +662,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: resourceRef - final KeyedCollection resourceRef = applicationClient.resourceRef; - if (resourceRef != null) { - for (final ResourceRef resourceRefItem : resourceRef) { - if (resourceRefItem != null) { + KeyedCollection resourceRef = applicationClient.resourceRef; + if (resourceRef!= null) { + for (ResourceRef resourceRefItem: resourceRef) { + if (resourceRefItem!= null) { writer.writeStartElement(prefix, "resource-ref", "http://java.sun.com/xml/ns/javaee"); writeResourceRef(writer, resourceRefItem, context); writer.writeEndElement(); @@ -612,10 +676,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: resourceEnvRef - final KeyedCollection resourceEnvRef = applicationClient.resourceEnvRef; - if (resourceEnvRef != null) { - for (final ResourceEnvRef resourceEnvRefItem : resourceEnvRef) { - if (resourceEnvRefItem != null) { + KeyedCollection resourceEnvRef = applicationClient.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(); @@ -626,10 +690,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: messageDestinationRef - final KeyedCollection messageDestinationRef = applicationClient.messageDestinationRef; - if (messageDestinationRef != null) { - for (final MessageDestinationRef messageDestinationRefItem : messageDestinationRef) { - if (messageDestinationRefItem != null) { + KeyedCollection messageDestinationRef = applicationClient.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(); @@ -640,10 +704,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: persistenceContextRef - final KeyedCollection persistenceContextRef = applicationClient.persistenceContextRef; - if (persistenceContextRef != null) { - for (final PersistenceContextRef persistenceContextRefItem : persistenceContextRef) { - if (persistenceContextRefItem != null) { + KeyedCollection persistenceContextRef = applicationClient.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(); @@ -654,10 +718,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: persistenceUnitRef - final KeyedCollection persistenceUnitRef = applicationClient.persistenceUnitRef; - if (persistenceUnitRef != null) { - for (final PersistenceUnitRef persistenceUnitRefItem : persistenceUnitRef) { - if (persistenceUnitRefItem != null) { + KeyedCollection persistenceUnitRef = applicationClient.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(); @@ -668,10 +732,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: postConstruct - final List postConstruct = applicationClient.postConstruct; - if (postConstruct != null) { - for (final org.apache.openejb.jee.LifecycleCallback postConstructItem : postConstruct) { - if (postConstructItem != null) { + List postConstruct = applicationClient.postConstruct; + if (postConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback postConstructItem: postConstruct) { + if (postConstructItem!= null) { writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, postConstructItem, context); writer.writeEndElement(); @@ -682,10 +746,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: preDestroy - final List preDestroy = applicationClient.preDestroy; - if (preDestroy != null) { - for (final org.apache.openejb.jee.LifecycleCallback preDestroyItem : preDestroy) { - if (preDestroyItem != null) { + List preDestroy = applicationClient.preDestroy; + if (preDestroy!= null) { + for (org.apache.openejb.jee.LifecycleCallback preDestroyItem: preDestroy) { + if (preDestroyItem!= null) { writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, preDestroyItem, context); writer.writeEndElement(); @@ -696,24 +760,24 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: callbackHandler - final String callbackHandlerRaw = applicationClient.callbackHandler; + String callbackHandlerRaw = applicationClient.callbackHandler; String callbackHandler = null; try { callbackHandler = Adapters.collapsedStringAdapterAdapter.marshal(callbackHandlerRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(applicationClient, "callbackHandler", CollapsedStringAdapter.class, String.class, String.class, e); } - if (callbackHandler != null) { + if (callbackHandler!= null) { writer.writeStartElement(prefix, "callback-handler", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(callbackHandler); writer.writeEndElement(); } // ELEMENT: messageDestination - final KeyedCollection messageDestination = applicationClient.messageDestination; - if (messageDestination != null) { - for (final MessageDestination messageDestinationItem : messageDestination) { - if (messageDestinationItem != null) { + KeyedCollection messageDestination = applicationClient.messageDestination; + if (messageDestination!= null) { + for (MessageDestination messageDestinationItem: messageDestination) { + if (messageDestinationItem!= null) { writer.writeStartElement(prefix, "message-destination", "http://java.sun.com/xml/ns/javaee"); writeMessageDestination(writer, messageDestinationItem, context); writer.writeEndElement(); @@ -724,10 +788,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: dataSource - final KeyedCollection dataSource = applicationClient.dataSource; - if (dataSource != null) { - for (final DataSource dataSourceItem : dataSource) { - if (dataSourceItem != null) { + KeyedCollection dataSource = applicationClient.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); writeDataSource(writer, dataSourceItem, context); writer.writeEndElement(); @@ -735,6 +799,44 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } } + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = applicationClient.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(applicationClient, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = applicationClient.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: contextService + KeyedCollection contextService = applicationClientContextService.getObject(applicationClient, context, applicationClient); + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + context.afterMarshal(applicationClient, org.metatype.sxc.jaxb.LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationException$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationException$JAXB.java index 40c187fc453..049ef192e9c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationException$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationException$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class ApplicationException$JAXB - extends JAXBObject { + extends JAXBObject +{ public ApplicationException$JAXB() { super(ApplicationException.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "application-exceptionType".intern())); } - public static ApplicationException readApplicationException(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ApplicationException readApplicationException(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeApplicationException(final XoXMLStreamWriter writer, final ApplicationException applicationException, final RuntimeContext context) - throws Exception { + public static void writeApplicationException(XoXMLStreamWriter writer, ApplicationException applicationException, RuntimeContext context) + throws Exception + { _write(writer, applicationException, context); } - public void write(final XoXMLStreamWriter writer, final ApplicationException applicationException, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ApplicationException applicationException, RuntimeContext context) + throws Exception + { _write(writer, applicationException, context); } - public final static ApplicationException _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ApplicationException _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,52 +70,52 @@ public final static ApplicationException _read(final XoXMLStreamReader reader, R context = new RuntimeContext(); } - final ApplicationException applicationException = new ApplicationException(); + ApplicationException applicationException = new ApplicationException(); context.beforeUnmarshal(applicationException, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("application-exceptionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("application-exceptionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ApplicationException.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, applicationException); applicationException.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("exception-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("exception-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: exceptionClass - final String exceptionClassRaw = elementReader.getElementAsString(); + String exceptionClassRaw = elementReader.getElementText(); - final String exceptionClass; + String exceptionClass; try { exceptionClass = Adapters.collapsedStringAdapterAdapter.unmarshal(exceptionClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } applicationException.exceptionClass = exceptionClass; - } else if (("rollback" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("rollback" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: rollback - final Boolean rollback = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean rollback = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); applicationException.rollback = rollback; - } else if (("inherited" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("inherited" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: inherited - final Boolean inherited = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean inherited = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); applicationException.inherited = inherited; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "exception-class"), new QName("http://java.sun.com/xml/ns/javaee", "rollback"), new QName("http://java.sun.com/xml/ns/javaee", "inherited")); @@ -122,52 +127,54 @@ public final static ApplicationException _read(final XoXMLStreamReader reader, R return applicationException; } - public final ApplicationException read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ApplicationException read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ApplicationException applicationException, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ApplicationException applicationException, RuntimeContext context) + throws Exception + { if (applicationException == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ApplicationException.class != applicationException.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ApplicationException.class!= applicationException.getClass()) { context.unexpectedSubclass(writer, applicationException, ApplicationException.class); - return; + return ; } context.beforeMarshal(applicationException, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = applicationException.id; - if (idRaw != null) { + String idRaw = applicationException.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(applicationException, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: exceptionClass - final String exceptionClassRaw = applicationException.exceptionClass; + String exceptionClassRaw = applicationException.exceptionClass; String exceptionClass = null; try { exceptionClass = Adapters.collapsedStringAdapterAdapter.marshal(exceptionClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(applicationException, "exceptionClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (exceptionClass != null) { + if (exceptionClass!= null) { writer.writeStartElement(prefix, "exception-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(exceptionClass); writer.writeEndElement(); @@ -176,16 +183,16 @@ public final static void _write(final XoXMLStreamWriter writer, final Applicatio } // ELEMENT: rollback - final Boolean rollback = applicationException.rollback; - if (rollback != null) { + Boolean rollback = applicationException.rollback; + if (rollback!= null) { writer.writeStartElement(prefix, "rollback", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(rollback)); writer.writeEndElement(); } // ELEMENT: inherited - final Boolean inherited = applicationException.inherited; - if (inherited != null) { + Boolean inherited = applicationException.inherited; + if (inherited!= null) { writer.writeStartElement(prefix, "inherited", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(inherited)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AroundInvoke$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AroundInvoke$JAXB.java index e91e2f865f1..6a055fe134d 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AroundInvoke$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AroundInvoke$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class AroundInvoke$JAXB - extends JAXBObject { + extends JAXBObject +{ public AroundInvoke$JAXB() { super(AroundInvoke.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "around-invokeType".intern())); } - public static AroundInvoke readAroundInvoke(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static AroundInvoke readAroundInvoke(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeAroundInvoke(final XoXMLStreamWriter writer, final AroundInvoke aroundInvoke, final RuntimeContext context) - throws Exception { + public static void writeAroundInvoke(XoXMLStreamWriter writer, AroundInvoke aroundInvoke, RuntimeContext context) + throws Exception + { _write(writer, aroundInvoke, context); } - public void write(final XoXMLStreamWriter writer, final AroundInvoke aroundInvoke, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, AroundInvoke aroundInvoke, RuntimeContext context) + throws Exception + { _write(writer, aroundInvoke, context); } - public final static AroundInvoke _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final AroundInvoke _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,48 +70,48 @@ public final static AroundInvoke _read(final XoXMLStreamReader reader, RuntimeCo context = new RuntimeContext(); } - final AroundInvoke aroundInvoke = new AroundInvoke(); + AroundInvoke aroundInvoke = new AroundInvoke(); context.beforeUnmarshal(aroundInvoke, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("around-invokeType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("around-invokeType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, AroundInvoke.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: clazz - final String clazzRaw = elementReader.getElementAsString(); + String clazzRaw = elementReader.getElementText(); - final String clazz; + String clazz; try { clazz = Adapters.collapsedStringAdapterAdapter.unmarshal(clazzRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } aroundInvoke.clazz = clazz; - } else if (("method-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodName - final String methodNameRaw = elementReader.getElementAsString(); + String methodNameRaw = elementReader.getElementText(); - final String methodName; + String methodName; try { methodName = Adapters.collapsedStringAdapterAdapter.unmarshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -122,54 +127,56 @@ public final static AroundInvoke _read(final XoXMLStreamReader reader, RuntimeCo return aroundInvoke; } - public final AroundInvoke read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final AroundInvoke read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final AroundInvoke aroundInvoke, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, AroundInvoke aroundInvoke, RuntimeContext context) + throws Exception + { if (aroundInvoke == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (AroundInvoke.class != aroundInvoke.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (AroundInvoke.class!= aroundInvoke.getClass()) { context.unexpectedSubclass(writer, aroundInvoke, AroundInvoke.class); - return; + return ; } context.beforeMarshal(aroundInvoke, LifecycleCallback.NONE); // ELEMENT: clazz - final String clazzRaw = aroundInvoke.clazz; + String clazzRaw = aroundInvoke.clazz; String clazz = null; try { clazz = Adapters.collapsedStringAdapterAdapter.marshal(clazzRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(aroundInvoke, "clazz", CollapsedStringAdapter.class, String.class, String.class, e); } - if (clazz != null) { + if (clazz!= null) { writer.writeStartElement(prefix, "class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(clazz); writer.writeEndElement(); } // ELEMENT: methodName - final String methodNameRaw = aroundInvoke.methodName; + String methodNameRaw = aroundInvoke.methodName; String methodName = null; try { methodName = Adapters.collapsedStringAdapterAdapter.marshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(aroundInvoke, "methodName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (methodName != null) { + if (methodName!= null) { writer.writeStartElement(prefix, "method-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(methodName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AroundTimeout$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AroundTimeout$JAXB.java index 4d5df080edf..7c545506284 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AroundTimeout$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AroundTimeout$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class AroundTimeout$JAXB - extends JAXBObject { + extends JAXBObject +{ public AroundTimeout$JAXB() { super(AroundTimeout.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "around-timeoutType".intern())); } - public static AroundTimeout readAroundTimeout(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static AroundTimeout readAroundTimeout(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeAroundTimeout(final XoXMLStreamWriter writer, final AroundTimeout aroundTimeout, final RuntimeContext context) - throws Exception { + public static void writeAroundTimeout(XoXMLStreamWriter writer, AroundTimeout aroundTimeout, RuntimeContext context) + throws Exception + { _write(writer, aroundTimeout, context); } - public void write(final XoXMLStreamWriter writer, final AroundTimeout aroundTimeout, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, AroundTimeout aroundTimeout, RuntimeContext context) + throws Exception + { _write(writer, aroundTimeout, context); } - public final static AroundTimeout _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final AroundTimeout _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,48 +70,48 @@ public final static AroundTimeout _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final AroundTimeout aroundTimeout = new AroundTimeout(); + AroundTimeout aroundTimeout = new AroundTimeout(); context.beforeUnmarshal(aroundTimeout, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("around-timeoutType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("around-timeoutType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, AroundTimeout.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: clazz - final String clazzRaw = elementReader.getElementAsString(); + String clazzRaw = elementReader.getElementText(); - final String clazz; + String clazz; try { clazz = Adapters.collapsedStringAdapterAdapter.unmarshal(clazzRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } aroundTimeout.clazz = clazz; - } else if (("method-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodName - final String methodNameRaw = elementReader.getElementAsString(); + String methodNameRaw = elementReader.getElementText(); - final String methodName; + String methodName; try { methodName = Adapters.collapsedStringAdapterAdapter.unmarshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -122,54 +127,56 @@ public final static AroundTimeout _read(final XoXMLStreamReader reader, RuntimeC return aroundTimeout; } - public final AroundTimeout read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final AroundTimeout read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final AroundTimeout aroundTimeout, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, AroundTimeout aroundTimeout, RuntimeContext context) + throws Exception + { if (aroundTimeout == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (AroundTimeout.class != aroundTimeout.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (AroundTimeout.class!= aroundTimeout.getClass()) { context.unexpectedSubclass(writer, aroundTimeout, AroundTimeout.class); - return; + return ; } context.beforeMarshal(aroundTimeout, LifecycleCallback.NONE); // ELEMENT: clazz - final String clazzRaw = aroundTimeout.clazz; + String clazzRaw = aroundTimeout.clazz; String clazz = null; try { clazz = Adapters.collapsedStringAdapterAdapter.marshal(clazzRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(aroundTimeout, "clazz", CollapsedStringAdapter.class, String.class, String.class, e); } - if (clazz != null) { + if (clazz!= null) { writer.writeStartElement(prefix, "class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(clazz); writer.writeEndElement(); } // ELEMENT: methodName - final String methodNameRaw = aroundTimeout.methodName; + String methodNameRaw = aroundTimeout.methodName; String methodName = null; try { methodName = Adapters.collapsedStringAdapterAdapter.marshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(aroundTimeout, "methodName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (methodName != null) { + if (methodName!= null) { writer.writeStartElement(prefix, "method-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(methodName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AssemblyDescriptor$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AssemblyDescriptor$JAXB.java index bc076b2cd64..b5a4a4c091e 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AssemblyDescriptor$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AssemblyDescriptor$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.ApplicationException$JAXB.readApplicationException; import static org.apache.openejb.jee.ApplicationException$JAXB.writeApplicationException; @@ -50,30 +51,35 @@ "StringEquality" }) public class AssemblyDescriptor$JAXB - extends JAXBObject { + extends JAXBObject +{ public AssemblyDescriptor$JAXB() { super(AssemblyDescriptor.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "assembly-descriptorType".intern()), SecurityRole$JAXB.class, MethodPermission$JAXB.class, ContainerTransaction$JAXB.class, ContainerConcurrency$JAXB.class, InterceptorBinding$JAXB.class, MessageDestination$JAXB.class, ExcludeList$JAXB.class, ApplicationException$JAXB.class); } - public static AssemblyDescriptor readAssemblyDescriptor(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static AssemblyDescriptor readAssemblyDescriptor(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeAssemblyDescriptor(final XoXMLStreamWriter writer, final AssemblyDescriptor assemblyDescriptor, final RuntimeContext context) - throws Exception { + public static void writeAssemblyDescriptor(XoXMLStreamWriter writer, AssemblyDescriptor assemblyDescriptor, RuntimeContext context) + throws Exception + { _write(writer, assemblyDescriptor, context); } - public void write(final XoXMLStreamWriter writer, final AssemblyDescriptor assemblyDescriptor, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, AssemblyDescriptor assemblyDescriptor, RuntimeContext context) + throws Exception + { _write(writer, assemblyDescriptor, context); } - public final static AssemblyDescriptor _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final AssemblyDescriptor _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -84,7 +90,7 @@ public final static AssemblyDescriptor _read(final XoXMLStreamReader reader, Run context = new RuntimeContext(); } - final AssemblyDescriptor assemblyDescriptor = new AssemblyDescriptor(); + AssemblyDescriptor assemblyDescriptor = new AssemblyDescriptor(); context.beforeUnmarshal(assemblyDescriptor, LifecycleCallback.NONE); List securityRole = null; @@ -96,112 +102,112 @@ public final static AssemblyDescriptor _read(final XoXMLStreamReader reader, Run KeyedCollection applicationException = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("assembly-descriptorType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("assembly-descriptorType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, AssemblyDescriptor.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, assemblyDescriptor); assemblyDescriptor.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("security-role" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("security-role" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityRole - final SecurityRole securityRoleItem = readSecurityRole(elementReader, context); + SecurityRole securityRoleItem = readSecurityRole(elementReader, context); if (securityRole == null) { securityRole = assemblyDescriptor.securityRole; - if (securityRole != null) { + if (securityRole!= null) { securityRole.clear(); } else { - securityRole = new ArrayList(); + securityRole = new ArrayList<>(); } } securityRole.add(securityRoleItem); - } else if (("method-permission" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method-permission" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodPermission - final MethodPermission methodPermissionItem = readMethodPermission(elementReader, context); + MethodPermission methodPermissionItem = readMethodPermission(elementReader, context); if (methodPermission == null) { methodPermission = assemblyDescriptor.methodPermission; - if (methodPermission != null) { + if (methodPermission!= null) { methodPermission.clear(); } else { - methodPermission = new ArrayList(); + methodPermission = new ArrayList<>(); } } methodPermission.add(methodPermissionItem); - } else if (("container-transaction" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("container-transaction" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: containerTransaction - final ContainerTransaction containerTransactionItem = readContainerTransaction(elementReader, context); + ContainerTransaction containerTransactionItem = readContainerTransaction(elementReader, context); if (containerTransaction == null) { containerTransaction = assemblyDescriptor.containerTransaction; - if (containerTransaction != null) { + if (containerTransaction!= null) { containerTransaction.clear(); } else { - containerTransaction = new ArrayList(); + containerTransaction = new ArrayList<>(); } } containerTransaction.add(containerTransactionItem); - } else if (("container-concurrency" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("container-concurrency" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: containerConcurrency - final ContainerConcurrency containerConcurrencyItem = readContainerConcurrency(elementReader, context); + ContainerConcurrency containerConcurrencyItem = readContainerConcurrency(elementReader, context); if (containerConcurrency == null) { containerConcurrency = assemblyDescriptor.containerConcurrency; - if (containerConcurrency != null) { + if (containerConcurrency!= null) { containerConcurrency.clear(); } else { - containerConcurrency = new ArrayList(); + containerConcurrency = new ArrayList<>(); } } containerConcurrency.add(containerConcurrencyItem); - } else if (("interceptor-binding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("interceptor-binding" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: interceptorBinding - final InterceptorBinding interceptorBindingItem = readInterceptorBinding(elementReader, context); + InterceptorBinding interceptorBindingItem = readInterceptorBinding(elementReader, context); if (interceptorBinding == null) { interceptorBinding = assemblyDescriptor.interceptorBinding; - if (interceptorBinding != null) { + if (interceptorBinding!= null) { interceptorBinding.clear(); } else { - interceptorBinding = new ArrayList(); + interceptorBinding = new ArrayList<>(); } } interceptorBinding.add(interceptorBindingItem); - } else if (("message-destination" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestination - final MessageDestination messageDestinationItem = readMessageDestination(elementReader, context); + MessageDestination messageDestinationItem = readMessageDestination(elementReader, context); if (messageDestination == null) { messageDestination = assemblyDescriptor.messageDestination; - if (messageDestination != null) { + if (messageDestination!= null) { messageDestination.clear(); } else { - messageDestination = new ArrayList(); + messageDestination = new ArrayList<>(); } } messageDestination.add(messageDestinationItem); - } else if (("exclude-list" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("exclude-list" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: excludeList - final ExcludeList excludeList = readExcludeList(elementReader, context); + ExcludeList excludeList = readExcludeList(elementReader, context); assemblyDescriptor.excludeList = excludeList; - } else if (("application-exception" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("application-exception" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: applicationException - final ApplicationException applicationExceptionItem = readApplicationException(elementReader, context); + ApplicationException applicationExceptionItem = readApplicationException(elementReader, context); if (applicationException == null) { applicationException = assemblyDescriptor.applicationException; - if (applicationException != null) { + if (applicationException!= null) { applicationException.clear(); } else { - applicationException = new KeyedCollection(); + applicationException = new KeyedCollection<>(); } } applicationException.add(applicationExceptionItem); @@ -209,25 +215,25 @@ public final static AssemblyDescriptor _read(final XoXMLStreamReader reader, Run context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "security-role"), new QName("http://java.sun.com/xml/ns/javaee", "method-permission"), new QName("http://java.sun.com/xml/ns/javaee", "container-transaction"), new QName("http://java.sun.com/xml/ns/javaee", "container-concurrency"), new QName("http://java.sun.com/xml/ns/javaee", "interceptor-binding"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination"), new QName("http://java.sun.com/xml/ns/javaee", "exclude-list"), new QName("http://java.sun.com/xml/ns/javaee", "application-exception")); } } - if (securityRole != null) { + if (securityRole!= null) { assemblyDescriptor.securityRole = securityRole; } - if (methodPermission != null) { + if (methodPermission!= null) { assemblyDescriptor.methodPermission = methodPermission; } - if (containerTransaction != null) { + if (containerTransaction!= null) { assemblyDescriptor.containerTransaction = containerTransaction; } - if (containerConcurrency != null) { + if (containerConcurrency!= null) { assemblyDescriptor.containerConcurrency = containerConcurrency; } - if (interceptorBinding != null) { + if (interceptorBinding!= null) { assemblyDescriptor.interceptorBinding = interceptorBinding; } - if (messageDestination != null) { + if (messageDestination!= null) { assemblyDescriptor.messageDestination = messageDestination; } - if (applicationException != null) { + if (applicationException!= null) { assemblyDescriptor.applicationException = applicationException; } @@ -236,48 +242,50 @@ public final static AssemblyDescriptor _read(final XoXMLStreamReader reader, Run return assemblyDescriptor; } - public final AssemblyDescriptor read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final AssemblyDescriptor read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final AssemblyDescriptor assemblyDescriptor, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, AssemblyDescriptor assemblyDescriptor, RuntimeContext context) + throws Exception + { if (assemblyDescriptor == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (AssemblyDescriptor.class != assemblyDescriptor.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (AssemblyDescriptor.class!= assemblyDescriptor.getClass()) { context.unexpectedSubclass(writer, assemblyDescriptor, AssemblyDescriptor.class); - return; + return ; } context.beforeMarshal(assemblyDescriptor, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = assemblyDescriptor.id; - if (idRaw != null) { + String idRaw = assemblyDescriptor.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(assemblyDescriptor, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: securityRole - final List securityRole = assemblyDescriptor.securityRole; - if (securityRole != null) { - for (final SecurityRole securityRoleItem : securityRole) { - if (securityRoleItem != null) { + List securityRole = assemblyDescriptor.securityRole; + if (securityRole!= null) { + for (SecurityRole securityRoleItem: securityRole) { + if (securityRoleItem!= null) { writer.writeStartElement(prefix, "security-role", "http://java.sun.com/xml/ns/javaee"); writeSecurityRole(writer, securityRoleItem, context); writer.writeEndElement(); @@ -288,10 +296,10 @@ public final static void _write(final XoXMLStreamWriter writer, final AssemblyDe } // ELEMENT: methodPermission - final List methodPermission = assemblyDescriptor.methodPermission; - if (methodPermission != null) { - for (final MethodPermission methodPermissionItem : methodPermission) { - if (methodPermissionItem != null) { + List methodPermission = assemblyDescriptor.methodPermission; + if (methodPermission!= null) { + for (MethodPermission methodPermissionItem: methodPermission) { + if (methodPermissionItem!= null) { writer.writeStartElement(prefix, "method-permission", "http://java.sun.com/xml/ns/javaee"); writeMethodPermission(writer, methodPermissionItem, context); writer.writeEndElement(); @@ -302,10 +310,10 @@ public final static void _write(final XoXMLStreamWriter writer, final AssemblyDe } // ELEMENT: containerTransaction - final List containerTransaction = assemblyDescriptor.containerTransaction; - if (containerTransaction != null) { - for (final ContainerTransaction containerTransactionItem : containerTransaction) { - if (containerTransactionItem != null) { + List containerTransaction = assemblyDescriptor.containerTransaction; + if (containerTransaction!= null) { + for (ContainerTransaction containerTransactionItem: containerTransaction) { + if (containerTransactionItem!= null) { writer.writeStartElement(prefix, "container-transaction", "http://java.sun.com/xml/ns/javaee"); writeContainerTransaction(writer, containerTransactionItem, context); writer.writeEndElement(); @@ -316,10 +324,10 @@ public final static void _write(final XoXMLStreamWriter writer, final AssemblyDe } // ELEMENT: containerConcurrency - final List containerConcurrency = assemblyDescriptor.containerConcurrency; - if (containerConcurrency != null) { - for (final ContainerConcurrency containerConcurrencyItem : containerConcurrency) { - if (containerConcurrencyItem != null) { + List containerConcurrency = assemblyDescriptor.containerConcurrency; + if (containerConcurrency!= null) { + for (ContainerConcurrency containerConcurrencyItem: containerConcurrency) { + if (containerConcurrencyItem!= null) { writer.writeStartElement(prefix, "container-concurrency", "http://java.sun.com/xml/ns/javaee"); writeContainerConcurrency(writer, containerConcurrencyItem, context); writer.writeEndElement(); @@ -330,10 +338,10 @@ public final static void _write(final XoXMLStreamWriter writer, final AssemblyDe } // ELEMENT: interceptorBinding - final List interceptorBinding = assemblyDescriptor.interceptorBinding; - if (interceptorBinding != null) { - for (final InterceptorBinding interceptorBindingItem : interceptorBinding) { - if (interceptorBindingItem != null) { + List interceptorBinding = assemblyDescriptor.interceptorBinding; + if (interceptorBinding!= null) { + for (InterceptorBinding interceptorBindingItem: interceptorBinding) { + if (interceptorBindingItem!= null) { writer.writeStartElement(prefix, "interceptor-binding", "http://java.sun.com/xml/ns/javaee"); writeInterceptorBinding(writer, interceptorBindingItem, context); writer.writeEndElement(); @@ -344,10 +352,10 @@ public final static void _write(final XoXMLStreamWriter writer, final AssemblyDe } // ELEMENT: messageDestination - final List messageDestination = assemblyDescriptor.messageDestination; - if (messageDestination != null) { - for (final MessageDestination messageDestinationItem : messageDestination) { - if (messageDestinationItem != null) { + List messageDestination = assemblyDescriptor.messageDestination; + if (messageDestination!= null) { + for (MessageDestination messageDestinationItem: messageDestination) { + if (messageDestinationItem!= null) { writer.writeStartElement(prefix, "message-destination", "http://java.sun.com/xml/ns/javaee"); writeMessageDestination(writer, messageDestinationItem, context); writer.writeEndElement(); @@ -358,18 +366,18 @@ public final static void _write(final XoXMLStreamWriter writer, final AssemblyDe } // ELEMENT: excludeList - final ExcludeList excludeList = assemblyDescriptor.excludeList; - if (excludeList != null) { + ExcludeList excludeList = assemblyDescriptor.excludeList; + if (excludeList!= null) { writer.writeStartElement(prefix, "exclude-list", "http://java.sun.com/xml/ns/javaee"); writeExcludeList(writer, excludeList, context); writer.writeEndElement(); } // ELEMENT: applicationException - final KeyedCollection applicationException = assemblyDescriptor.applicationException; - if (applicationException != null) { - for (final ApplicationException applicationExceptionItem : applicationException) { - if (applicationExceptionItem != null) { + KeyedCollection applicationException = assemblyDescriptor.applicationException; + if (applicationException!= null) { + for (ApplicationException applicationExceptionItem: applicationException) { + if (applicationExceptionItem!= null) { writer.writeStartElement(prefix, "application-exception", "http://java.sun.com/xml/ns/javaee"); writeApplicationException(writer, applicationExceptionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AsyncMethod$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AsyncMethod$JAXB.java index dd6ecf3fd55..376b85188b2 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AsyncMethod$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AsyncMethod$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.MethodParams$JAXB.readMethodParams; import static org.apache.openejb.jee.MethodParams$JAXB.writeMethodParams; @@ -34,30 +35,35 @@ "StringEquality" }) public class AsyncMethod$JAXB - extends JAXBObject { + extends JAXBObject +{ public AsyncMethod$JAXB() { super(AsyncMethod.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "async-methodType".intern()), MethodParams$JAXB.class); } - public static AsyncMethod readAsyncMethod(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static AsyncMethod readAsyncMethod(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeAsyncMethod(final XoXMLStreamWriter writer, final AsyncMethod asyncMethod, final RuntimeContext context) - throws Exception { + public static void writeAsyncMethod(XoXMLStreamWriter writer, AsyncMethod asyncMethod, RuntimeContext context) + throws Exception + { _write(writer, asyncMethod, context); } - public void write(final XoXMLStreamWriter writer, final AsyncMethod asyncMethod, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, AsyncMethod asyncMethod, RuntimeContext context) + throws Exception + { _write(writer, asyncMethod, context); } - public final static AsyncMethod _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final AsyncMethod _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -68,48 +74,48 @@ public final static AsyncMethod _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final AsyncMethod asyncMethod = new AsyncMethod(); + AsyncMethod asyncMethod = new AsyncMethod(); context.beforeUnmarshal(asyncMethod, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("async-methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("async-methodType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, AsyncMethod.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, asyncMethod); asyncMethod.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("method-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("method-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodName - final String methodNameRaw = elementReader.getElementAsString(); + String methodNameRaw = elementReader.getElementText(); - final String methodName; + String methodName; try { methodName = Adapters.collapsedStringAdapterAdapter.unmarshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } asyncMethod.methodName = methodName; - } else if (("method-params" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method-params" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodParams - final MethodParams methodParams = readMethodParams(elementReader, context); + MethodParams methodParams = readMethodParams(elementReader, context); asyncMethod.methodParams = methodParams; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "method-name"), new QName("http://java.sun.com/xml/ns/javaee", "method-params")); @@ -121,52 +127,54 @@ public final static AsyncMethod _read(final XoXMLStreamReader reader, RuntimeCon return asyncMethod; } - public final AsyncMethod read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final AsyncMethod read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final AsyncMethod asyncMethod, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, AsyncMethod asyncMethod, RuntimeContext context) + throws Exception + { if (asyncMethod == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (AsyncMethod.class != asyncMethod.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (AsyncMethod.class!= asyncMethod.getClass()) { context.unexpectedSubclass(writer, asyncMethod, AsyncMethod.class); - return; + return ; } context.beforeMarshal(asyncMethod, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = asyncMethod.id; - if (idRaw != null) { + String idRaw = asyncMethod.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(asyncMethod, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: methodName - final String methodNameRaw = asyncMethod.methodName; + String methodNameRaw = asyncMethod.methodName; String methodName = null; try { methodName = Adapters.collapsedStringAdapterAdapter.marshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(asyncMethod, "methodName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (methodName != null) { + if (methodName!= null) { writer.writeStartElement(prefix, "method-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(methodName); writer.writeEndElement(); @@ -175,8 +183,8 @@ public final static void _write(final XoXMLStreamWriter writer, final AsyncMetho } // ELEMENT: methodParams - final MethodParams methodParams = asyncMethod.methodParams; - if (methodParams != null) { + MethodParams methodParams = asyncMethod.methodParams; + if (methodParams!= null) { writer.writeStartElement(prefix, "method-params", "http://java.sun.com/xml/ns/javaee"); writeMethodParams(writer, methodParams, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AuthConstraint$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AuthConstraint$JAXB.java index df640cf32af..1602e1cbf29 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AuthConstraint$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AuthConstraint$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -36,30 +37,35 @@ "StringEquality" }) public class AuthConstraint$JAXB - extends JAXBObject { + extends JAXBObject +{ public AuthConstraint$JAXB() { super(AuthConstraint.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "auth-constraintType".intern()), Text$JAXB.class); } - public static AuthConstraint readAuthConstraint(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static AuthConstraint readAuthConstraint(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeAuthConstraint(final XoXMLStreamWriter writer, final AuthConstraint authConstraint, final RuntimeContext context) - throws Exception { + public static void writeAuthConstraint(XoXMLStreamWriter writer, AuthConstraint authConstraint, RuntimeContext context) + throws Exception + { _write(writer, authConstraint, context); } - public void write(final XoXMLStreamWriter writer, final AuthConstraint authConstraint, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, AuthConstraint authConstraint, RuntimeContext context) + throws Exception + { _write(writer, authConstraint, context); } - public final static AuthConstraint _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final AuthConstraint _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,59 +76,59 @@ public final static AuthConstraint _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final AuthConstraint authConstraint = new AuthConstraint(); + AuthConstraint authConstraint = new AuthConstraint(); context.beforeUnmarshal(authConstraint, LifecycleCallback.NONE); ArrayList descriptions = null; List roleName = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("auth-constraintType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("auth-constraintType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, AuthConstraint.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, authConstraint); authConstraint.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("role-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("role-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: roleName - final String roleNameItemRaw = elementReader.getElementAsString(); + String roleNameItemRaw = elementReader.getElementText(); - final String roleNameItem; + String roleNameItem; try { roleNameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(roleNameItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (roleName == null) { roleName = authConstraint.roleName; - if (roleName != null) { + if (roleName!= null) { roleName.clear(); } else { - roleName = new ArrayList(); + roleName = new ArrayList<>(); } } roleName.add(roleNameItem); @@ -130,14 +136,14 @@ public final static AuthConstraint _read(final XoXMLStreamReader reader, Runtime context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "role-name")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - authConstraint.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + authConstraint.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, AuthConstraint.class, "setDescriptions", Text[].class, e); } } - if (roleName != null) { + if (roleName!= null) { authConstraint.roleName = roleName; } @@ -146,38 +152,40 @@ public final static AuthConstraint _read(final XoXMLStreamReader reader, Runtime return authConstraint; } - public final AuthConstraint read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final AuthConstraint read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final AuthConstraint authConstraint, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, AuthConstraint authConstraint, RuntimeContext context) + throws Exception + { if (authConstraint == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (AuthConstraint.class != authConstraint.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (AuthConstraint.class!= authConstraint.getClass()) { context.unexpectedSubclass(writer, authConstraint, AuthConstraint.class); - return; + return ; } context.beforeMarshal(authConstraint, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = authConstraint.id; - if (idRaw != null) { + String idRaw = authConstraint.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(authConstraint, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -187,12 +195,12 @@ public final static void _write(final XoXMLStreamWriter writer, final AuthConstr Text[] descriptions = null; try { descriptions = authConstraint.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(authConstraint, "descriptions", AuthConstraint.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -203,16 +211,16 @@ public final static void _write(final XoXMLStreamWriter writer, final AuthConstr } // ELEMENT: roleName - final List roleNameRaw = authConstraint.roleName; - if (roleNameRaw != null) { - for (final String roleNameItem : roleNameRaw) { + List roleNameRaw = authConstraint.roleName; + if (roleNameRaw!= null) { + for (String roleNameItem: roleNameRaw) { String roleName = null; try { roleName = Adapters.collapsedStringAdapterAdapter.marshal(roleNameItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(authConstraint, "roleName", CollapsedStringAdapter.class, List.class, List.class, e); } - if (roleName != null) { + if (roleName!= null) { writer.writeStartElement(prefix, "role-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(roleName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AuthenticationMechanism$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AuthenticationMechanism$JAXB.java index 8878f64b8fc..df833e41510 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AuthenticationMechanism$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/AuthenticationMechanism$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class AuthenticationMechanism$JAXB - extends JAXBObject { + extends JAXBObject +{ public AuthenticationMechanism$JAXB() { super(AuthenticationMechanism.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "authentication-mechanismType".intern()), Text$JAXB.class); } - public static AuthenticationMechanism readAuthenticationMechanism(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static AuthenticationMechanism readAuthenticationMechanism(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeAuthenticationMechanism(final XoXMLStreamWriter writer, final AuthenticationMechanism authenticationMechanism, final RuntimeContext context) - throws Exception { + public static void writeAuthenticationMechanism(XoXMLStreamWriter writer, AuthenticationMechanism authenticationMechanism, RuntimeContext context) + throws Exception + { _write(writer, authenticationMechanism, context); } - public void write(final XoXMLStreamWriter writer, final AuthenticationMechanism authenticationMechanism, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, AuthenticationMechanism authenticationMechanism, RuntimeContext context) + throws Exception + { _write(writer, authenticationMechanism, context); } - public final static AuthenticationMechanism _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final AuthenticationMechanism _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,61 +75,61 @@ public final static AuthenticationMechanism _read(final XoXMLStreamReader reader context = new RuntimeContext(); } - final AuthenticationMechanism authenticationMechanism = new AuthenticationMechanism(); + AuthenticationMechanism authenticationMechanism = new AuthenticationMechanism(); context.beforeUnmarshal(authenticationMechanism, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("authentication-mechanismType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("authentication-mechanismType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, AuthenticationMechanism.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, authenticationMechanism); authenticationMechanism.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("authentication-mechanism-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("authentication-mechanism-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: authenticationMechanismType - final String authenticationMechanismTypeRaw = elementReader.getElementAsString(); + String authenticationMechanismTypeRaw = elementReader.getElementText(); - final String authenticationMechanismType; + String authenticationMechanismType; try { authenticationMechanismType = Adapters.collapsedStringAdapterAdapter.unmarshal(authenticationMechanismTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } authenticationMechanism.authenticationMechanismType = authenticationMechanismType; - } else if (("credential-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("credential-interface" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: credentialInterface - final String credentialInterfaceRaw = elementReader.getElementAsString(); + String credentialInterfaceRaw = elementReader.getElementText(); - final String credentialInterface; + String credentialInterface; try { credentialInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(credentialInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -133,10 +139,10 @@ public final static AuthenticationMechanism _read(final XoXMLStreamReader reader context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "authentication-mechanism-type"), new QName("http://java.sun.com/xml/ns/javaee", "credential-interface")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - authenticationMechanism.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + authenticationMechanism.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, AuthenticationMechanism.class, "setDescriptions", Text[].class, e); } } @@ -146,38 +152,40 @@ public final static AuthenticationMechanism _read(final XoXMLStreamReader reader return authenticationMechanism; } - public final AuthenticationMechanism read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final AuthenticationMechanism read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final AuthenticationMechanism authenticationMechanism, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, AuthenticationMechanism authenticationMechanism, RuntimeContext context) + throws Exception + { if (authenticationMechanism == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (AuthenticationMechanism.class != authenticationMechanism.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (AuthenticationMechanism.class!= authenticationMechanism.getClass()) { context.unexpectedSubclass(writer, authenticationMechanism, AuthenticationMechanism.class); - return; + return ; } context.beforeMarshal(authenticationMechanism, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = authenticationMechanism.id; - if (idRaw != null) { + String idRaw = authenticationMechanism.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(authenticationMechanism, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -187,12 +195,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Authentica Text[] descriptions = null; try { descriptions = authenticationMechanism.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(authenticationMechanism, "descriptions", AuthenticationMechanism.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -203,14 +211,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Authentica } // ELEMENT: authenticationMechanismType - final String authenticationMechanismTypeRaw = authenticationMechanism.authenticationMechanismType; + String authenticationMechanismTypeRaw = authenticationMechanism.authenticationMechanismType; String authenticationMechanismType = null; try { authenticationMechanismType = Adapters.collapsedStringAdapterAdapter.marshal(authenticationMechanismTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(authenticationMechanism, "authenticationMechanismType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (authenticationMechanismType != null) { + if (authenticationMechanismType!= null) { writer.writeStartElement(prefix, "authentication-mechanism-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(authenticationMechanismType); writer.writeEndElement(); @@ -219,14 +227,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Authentica } // ELEMENT: credentialInterface - final String credentialInterfaceRaw = authenticationMechanism.credentialInterface; + String credentialInterfaceRaw = authenticationMechanism.credentialInterface; String credentialInterface = null; try { credentialInterface = Adapters.collapsedStringAdapterAdapter.marshal(credentialInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(authenticationMechanism, "credentialInterface", CollapsedStringAdapter.class, String.class, String.class, e); } - if (credentialInterface != null) { + if (credentialInterface!= null) { writer.writeStartElement(prefix, "credential-interface", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(credentialInterface); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/BodyContent$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/BodyContent$JAXB.java index 73b75709bfd..f4a87fc6ebf 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/BodyContent$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/BodyContent$JAXB.java @@ -1,54 +1,58 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class BodyContent$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public BodyContent$JAXB() { super(BodyContent.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "bodyContent".intern())); } - public BodyContent parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public BodyContent parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseBodyContent(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final BodyContent bodyContent) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, BodyContent bodyContent) + throws Exception + { return toStringBodyContent(bean, parameterName, context, bodyContent); } - public static BodyContent parseBodyContent(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { - if ("tagdependent".equalsIgnoreCase(value)) { + public static BodyContent parseBodyContent(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { + if ("tagdependent".equals(value)) { return BodyContent.TAGDEPENDENT; - } else if ("JSP".equalsIgnoreCase(value)) { + } else if ("JSP".equals(value)) { return BodyContent.JSP; - } else if ("empty".equalsIgnoreCase(value)) { + } else if ("empty".equals(value)) { return BodyContent.EMPTY; - } else if ("scriptless".equalsIgnoreCase(value)) { + } else if ("scriptless".equals(value)) { return BodyContent.SCRIPTLESS; } else { context.unexpectedEnumValue(reader, BodyContent.class, value, "tagdependent", "JSP", "empty", "scriptless"); @@ -56,8 +60,9 @@ public static BodyContent parseBodyContent(final XoXMLStreamReader reader, final } } - public static String toStringBodyContent(final Object bean, final String parameterName, final RuntimeContext context, final BodyContent bodyContent) - throws Exception { + public static String toStringBodyContent(Object bean, String parameterName, RuntimeContext context, BodyContent bodyContent) + throws Exception + { if (BodyContent.TAGDEPENDENT == bodyContent) { return "tagdependent"; } else if (BodyContent.JSP == bodyContent) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmpField$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmpField$JAXB.java index aec648d92ab..4801ee45532 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmpField$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmpField$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class CmpField$JAXB - extends JAXBObject { + extends JAXBObject +{ public CmpField$JAXB() { super(CmpField.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "cmp-fieldType".intern()), Text$JAXB.class); } - public static CmpField readCmpField(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static CmpField readCmpField(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeCmpField(final XoXMLStreamWriter writer, final CmpField cmpField, final RuntimeContext context) - throws Exception { + public static void writeCmpField(XoXMLStreamWriter writer, CmpField cmpField, RuntimeContext context) + throws Exception + { _write(writer, cmpField, context); } - public void write(final XoXMLStreamWriter writer, final CmpField cmpField, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, CmpField cmpField, RuntimeContext context) + throws Exception + { _write(writer, cmpField, context); } - public final static CmpField _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final CmpField _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,48 +75,48 @@ public final static CmpField _read(final XoXMLStreamReader reader, RuntimeContex context = new RuntimeContext(); } - final CmpField cmpField = new CmpField(); + CmpField cmpField = new CmpField(); context.beforeUnmarshal(cmpField, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("cmp-fieldType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("cmp-fieldType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, CmpField.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, cmpField); cmpField.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("field-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("field-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: fieldName - final String fieldNameRaw = elementReader.getElementAsString(); + String fieldNameRaw = elementReader.getElementText(); - final String fieldName; + String fieldName; try { fieldName = Adapters.collapsedStringAdapterAdapter.unmarshal(fieldNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -120,10 +126,10 @@ public final static CmpField _read(final XoXMLStreamReader reader, RuntimeContex context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "field-name")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - cmpField.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + cmpField.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, CmpField.class, "setDescriptions", Text[].class, e); } } @@ -133,38 +139,40 @@ public final static CmpField _read(final XoXMLStreamReader reader, RuntimeContex return cmpField; } - public final CmpField read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final CmpField read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final CmpField cmpField, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, CmpField cmpField, RuntimeContext context) + throws Exception + { if (cmpField == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (CmpField.class != cmpField.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (CmpField.class!= cmpField.getClass()) { context.unexpectedSubclass(writer, cmpField, CmpField.class); - return; + return ; } context.beforeMarshal(cmpField, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = cmpField.id; - if (idRaw != null) { + String idRaw = cmpField.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(cmpField, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -174,12 +182,12 @@ public final static void _write(final XoXMLStreamWriter writer, final CmpField c Text[] descriptions = null; try { descriptions = cmpField.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(cmpField, "descriptions", CmpField.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -190,14 +198,14 @@ public final static void _write(final XoXMLStreamWriter writer, final CmpField c } // ELEMENT: fieldName - final String fieldNameRaw = cmpField.fieldName; + String fieldNameRaw = cmpField.fieldName; String fieldName = null; try { fieldName = Adapters.collapsedStringAdapterAdapter.marshal(fieldNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(cmpField, "fieldName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (fieldName != null) { + if (fieldName!= null) { writer.writeStartElement(prefix, "field-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(fieldName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmpVersion$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmpVersion$JAXB.java index 5079e1bd62b..cfa75c0944d 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmpVersion$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmpVersion$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class CmpVersion$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public CmpVersion$JAXB() { super(CmpVersion.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "cmpVersion".intern())); } - public CmpVersion parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public CmpVersion parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseCmpVersion(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final CmpVersion cmpVersion) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, CmpVersion cmpVersion) + throws Exception + { return toStringCmpVersion(bean, parameterName, context, cmpVersion); } - public static CmpVersion parseCmpVersion(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static CmpVersion parseCmpVersion(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("1.x".equals(value)) { return CmpVersion.CMP1; } else if ("2.x".equals(value)) { @@ -52,8 +56,9 @@ public static CmpVersion parseCmpVersion(final XoXMLStreamReader reader, final R } } - public static String toStringCmpVersion(final Object bean, final String parameterName, final RuntimeContext context, final CmpVersion cmpVersion) - throws Exception { + public static String toStringCmpVersion(Object bean, String parameterName, RuntimeContext context, CmpVersion cmpVersion) + throws Exception + { if (CmpVersion.CMP1 == cmpVersion) { return "1.x"; } else if (CmpVersion.CMP2 == cmpVersion) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmrField$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmrField$JAXB.java index 119c882cde9..5e7f3b597cb 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmrField$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmrField$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.CmrFieldType$JAXB.parseCmrFieldType; import static org.apache.openejb.jee.CmrFieldType$JAXB.toStringCmrFieldType; @@ -37,30 +38,35 @@ "StringEquality" }) public class CmrField$JAXB - extends JAXBObject { + extends JAXBObject +{ public CmrField$JAXB() { super(CmrField.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "cmr-fieldType".intern()), Text$JAXB.class, CmrFieldType$JAXB.class); } - public static CmrField readCmrField(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static CmrField readCmrField(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeCmrField(final XoXMLStreamWriter writer, final CmrField cmrField, final RuntimeContext context) - throws Exception { + public static void writeCmrField(XoXMLStreamWriter writer, CmrField cmrField, RuntimeContext context) + throws Exception + { _write(writer, cmrField, context); } - public void write(final XoXMLStreamWriter writer, final CmrField cmrField, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, CmrField cmrField, RuntimeContext context) + throws Exception + { _write(writer, cmrField, context); } - public final static CmrField _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final CmrField _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -71,67 +77,67 @@ public final static CmrField _read(final XoXMLStreamReader reader, RuntimeContex context = new RuntimeContext(); } - final CmrField cmrField = new CmrField(); + CmrField cmrField = new CmrField(); context.beforeUnmarshal(cmrField, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("cmr-fieldType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("cmr-fieldType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, CmrField.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, cmrField); cmrField.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("cmr-field-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("cmr-field-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: cmrFieldName - final String cmrFieldNameRaw = elementReader.getElementAsString(); + String cmrFieldNameRaw = elementReader.getElementText(); - final String cmrFieldName; + String cmrFieldName; try { cmrFieldName = Adapters.collapsedStringAdapterAdapter.unmarshal(cmrFieldNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } cmrField.cmrFieldName = cmrFieldName; - } else if (("cmr-field-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("cmr-field-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: cmrFieldType - final CmrFieldType cmrFieldType = parseCmrFieldType(elementReader, context, elementReader.getElementAsString()); - if (cmrFieldType != null) { + CmrFieldType cmrFieldType = parseCmrFieldType(elementReader, context, elementReader.getElementText()); + if (cmrFieldType!= null) { cmrField.cmrFieldType = cmrFieldType; } } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "cmr-field-name"), new QName("http://java.sun.com/xml/ns/javaee", "cmr-field-type")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - cmrField.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + cmrField.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, CmrField.class, "setDescriptions", Text[].class, e); } } @@ -141,38 +147,40 @@ public final static CmrField _read(final XoXMLStreamReader reader, RuntimeContex return cmrField; } - public final CmrField read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final CmrField read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final CmrField cmrField, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, CmrField cmrField, RuntimeContext context) + throws Exception + { if (cmrField == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (CmrField.class != cmrField.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (CmrField.class!= cmrField.getClass()) { context.unexpectedSubclass(writer, cmrField, CmrField.class); - return; + return ; } context.beforeMarshal(cmrField, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = cmrField.id; - if (idRaw != null) { + String idRaw = cmrField.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(cmrField, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -182,12 +190,12 @@ public final static void _write(final XoXMLStreamWriter writer, final CmrField c Text[] descriptions = null; try { descriptions = cmrField.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(cmrField, "descriptions", CmrField.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -198,14 +206,14 @@ public final static void _write(final XoXMLStreamWriter writer, final CmrField c } // ELEMENT: cmrFieldName - final String cmrFieldNameRaw = cmrField.cmrFieldName; + String cmrFieldNameRaw = cmrField.cmrFieldName; String cmrFieldName = null; try { cmrFieldName = Adapters.collapsedStringAdapterAdapter.marshal(cmrFieldNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(cmrField, "cmrFieldName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (cmrFieldName != null) { + if (cmrFieldName!= null) { writer.writeStartElement(prefix, "cmr-field-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(cmrFieldName); writer.writeEndElement(); @@ -214,8 +222,8 @@ public final static void _write(final XoXMLStreamWriter writer, final CmrField c } // ELEMENT: cmrFieldType - final CmrFieldType cmrFieldType = cmrField.cmrFieldType; - if (cmrFieldType != null) { + CmrFieldType cmrFieldType = cmrField.cmrFieldType; + if (cmrFieldType!= null) { writer.writeStartElement(prefix, "cmr-field-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringCmrFieldType(cmrField, null, context, cmrFieldType)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmrFieldType$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmrFieldType$JAXB.java index 799ad7867ea..d13723d32f2 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmrFieldType$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CmrFieldType$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class CmrFieldType$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public CmrFieldType$JAXB() { super(CmrFieldType.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "cmrFieldType".intern())); } - public CmrFieldType parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public CmrFieldType parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseCmrFieldType(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final CmrFieldType cmrFieldType) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, CmrFieldType cmrFieldType) + throws Exception + { return toStringCmrFieldType(bean, parameterName, context, cmrFieldType); } - public static CmrFieldType parseCmrFieldType(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static CmrFieldType parseCmrFieldType(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("java.util.Collection".equals(value)) { return CmrFieldType.COLLECTION; } else if ("java.util.Set".equals(value)) { @@ -52,8 +56,9 @@ public static CmrFieldType parseCmrFieldType(final XoXMLStreamReader reader, fin } } - public static String toStringCmrFieldType(final Object bean, final String parameterName, final RuntimeContext context, final CmrFieldType cmrFieldType) - throws Exception { + public static String toStringCmrFieldType(Object bean, String parameterName, RuntimeContext context, CmrFieldType cmrFieldType) + throws Exception + { if (CmrFieldType.COLLECTION == cmrFieldType) { return "java.util.Collection"; } else if (CmrFieldType.SET == cmrFieldType) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrencyManagementType$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrencyManagementType$JAXB.java index b30fe37232b..4e8173bef38 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrencyManagementType$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrencyManagementType$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class ConcurrencyManagementType$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public ConcurrencyManagementType$JAXB() { super(ConcurrencyManagementType.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "concurrency-management-typeType".intern())); } - public ConcurrencyManagementType parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public ConcurrencyManagementType parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseConcurrencyManagementType(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final ConcurrencyManagementType concurrencyManagementType) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, ConcurrencyManagementType concurrencyManagementType) + throws Exception + { return toStringConcurrencyManagementType(bean, parameterName, context, concurrencyManagementType); } - public static ConcurrencyManagementType parseConcurrencyManagementType(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static ConcurrencyManagementType parseConcurrencyManagementType(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Bean".equals(value)) { return ConcurrencyManagementType.BEAN; } else if ("Container".equals(value)) { @@ -52,8 +56,9 @@ public static ConcurrencyManagementType parseConcurrencyManagementType(final XoX } } - public static String toStringConcurrencyManagementType(final Object bean, final String parameterName, final RuntimeContext context, final ConcurrencyManagementType concurrencyManagementType) - throws Exception { + public static String toStringConcurrencyManagementType(Object bean, String parameterName, RuntimeContext context, ConcurrencyManagementType concurrencyManagementType) + throws Exception + { if (ConcurrencyManagementType.BEAN == concurrencyManagementType) { return "Bean"; } else if (ConcurrencyManagementType.CONTAINER == concurrencyManagementType) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrentLockType$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrentLockType$JAXB.java index b05be6fa63b..a0e1bf64f6d 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrentLockType$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrentLockType$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class ConcurrentLockType$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public ConcurrentLockType$JAXB() { super(ConcurrentLockType.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "concurrent-lock-typeType".intern())); } - public ConcurrentLockType parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public ConcurrentLockType parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseConcurrentLockType(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final ConcurrentLockType concurrentLockType) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, ConcurrentLockType concurrentLockType) + throws Exception + { return toStringConcurrentLockType(bean, parameterName, context, concurrentLockType); } - public static ConcurrentLockType parseConcurrentLockType(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static ConcurrentLockType parseConcurrentLockType(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Read".equals(value)) { return ConcurrentLockType.READ; } else if ("Write".equals(value)) { @@ -52,8 +56,9 @@ public static ConcurrentLockType parseConcurrentLockType(final XoXMLStreamReader } } - public static String toStringConcurrentLockType(final Object bean, final String parameterName, final RuntimeContext context, final ConcurrentLockType concurrentLockType) - throws Exception { + public static String toStringConcurrentLockType(Object bean, String parameterName, RuntimeContext context, ConcurrentLockType concurrentLockType) + throws Exception + { if (ConcurrentLockType.READ == concurrentLockType) { return "Read"; } else if (ConcurrentLockType.WRITE == concurrentLockType) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrentMethod$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrentMethod$JAXB.java index a99803aaa65..7427ef1b296 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrentMethod$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConcurrentMethod$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.ConcurrentLockType$JAXB.parseConcurrentLockType; import static org.apache.openejb.jee.ConcurrentLockType$JAXB.toStringConcurrentLockType; @@ -38,30 +39,35 @@ "StringEquality" }) public class ConcurrentMethod$JAXB - extends JAXBObject { + extends JAXBObject +{ public ConcurrentMethod$JAXB() { super(ConcurrentMethod.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "concurrent-methodType".intern()), NamedMethod$JAXB.class, ConcurrentLockType$JAXB.class, Timeout$JAXB.class); } - public static ConcurrentMethod readConcurrentMethod(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ConcurrentMethod readConcurrentMethod(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeConcurrentMethod(final XoXMLStreamWriter writer, final ConcurrentMethod concurrentMethod, final RuntimeContext context) - throws Exception { + public static void writeConcurrentMethod(XoXMLStreamWriter writer, ConcurrentMethod concurrentMethod, RuntimeContext context) + throws Exception + { _write(writer, concurrentMethod, context); } - public void write(final XoXMLStreamWriter writer, final ConcurrentMethod concurrentMethod, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ConcurrentMethod concurrentMethod, RuntimeContext context) + throws Exception + { _write(writer, concurrentMethod, context); } - public final static ConcurrentMethod _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ConcurrentMethod _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,45 +78,45 @@ public final static ConcurrentMethod _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final ConcurrentMethod concurrentMethod = new ConcurrentMethod(); + ConcurrentMethod concurrentMethod = new ConcurrentMethod(); context.beforeUnmarshal(concurrentMethod, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("concurrent-methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("concurrent-methodType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ConcurrentMethod.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, concurrentMethod); concurrentMethod.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: method - final NamedMethod method = readNamedMethod(elementReader, context); + NamedMethod method = readNamedMethod(elementReader, context); concurrentMethod.method = method; - } else if (("lock" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lock" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lock - final ConcurrentLockType lock = parseConcurrentLockType(elementReader, context, elementReader.getElementAsString()); - if (lock != null) { + ConcurrentLockType lock = parseConcurrentLockType(elementReader, context, elementReader.getElementText()); + if (lock!= null) { concurrentMethod.lock = lock; } - } else if (("access-timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("access-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: accessTimeout - final Timeout accessTimeout = readTimeout(elementReader, context); + Timeout accessTimeout = readTimeout(elementReader, context); concurrentMethod.accessTimeout = accessTimeout; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "method"), new QName("http://java.sun.com/xml/ns/javaee", "lock"), new QName("http://java.sun.com/xml/ns/javaee", "access-timeout")); @@ -122,46 +128,48 @@ public final static ConcurrentMethod _read(final XoXMLStreamReader reader, Runti return concurrentMethod; } - public final ConcurrentMethod read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ConcurrentMethod read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ConcurrentMethod concurrentMethod, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ConcurrentMethod concurrentMethod, RuntimeContext context) + throws Exception + { if (concurrentMethod == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ConcurrentMethod.class != concurrentMethod.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ConcurrentMethod.class!= concurrentMethod.getClass()) { context.unexpectedSubclass(writer, concurrentMethod, ConcurrentMethod.class); - return; + return ; } context.beforeMarshal(concurrentMethod, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = concurrentMethod.id; - if (idRaw != null) { + String idRaw = concurrentMethod.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(concurrentMethod, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: method - final NamedMethod method = concurrentMethod.method; - if (method != null) { + NamedMethod method = concurrentMethod.method; + if (method!= null) { writer.writeStartElement(prefix, "method", "http://java.sun.com/xml/ns/javaee"); writeNamedMethod(writer, method, context); writer.writeEndElement(); @@ -170,16 +178,16 @@ public final static void _write(final XoXMLStreamWriter writer, final Concurrent } // ELEMENT: lock - final ConcurrentLockType lock = concurrentMethod.lock; - if (lock != null) { + ConcurrentLockType lock = concurrentMethod.lock; + if (lock!= null) { writer.writeStartElement(prefix, "lock", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringConcurrentLockType(concurrentMethod, null, context, lock)); writer.writeEndElement(); } // ELEMENT: accessTimeout - final Timeout accessTimeout = concurrentMethod.accessTimeout; - if (accessTimeout != null) { + Timeout accessTimeout = concurrentMethod.accessTimeout; + if (accessTimeout!= null) { writer.writeStartElement(prefix, "access-timeout", "http://java.sun.com/xml/ns/javaee"); writeTimeout(writer, accessTimeout, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConfigProperty$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConfigProperty$JAXB.java index 060d16d069d..f7617421be6 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConfigProperty$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConfigProperty$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class ConfigProperty$JAXB - extends JAXBObject { + extends JAXBObject +{ public ConfigProperty$JAXB() { super(ConfigProperty.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "config-propertyType".intern()), Text$JAXB.class); } - public static ConfigProperty readConfigProperty(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ConfigProperty readConfigProperty(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeConfigProperty(final XoXMLStreamWriter writer, final ConfigProperty configProperty, final RuntimeContext context) - throws Exception { + public static void writeConfigProperty(XoXMLStreamWriter writer, ConfigProperty configProperty, RuntimeContext context) + throws Exception + { _write(writer, configProperty, context); } - public void write(final XoXMLStreamWriter writer, final ConfigProperty configProperty, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ConfigProperty configProperty, RuntimeContext context) + throws Exception + { _write(writer, configProperty, context); } - public final static ConfigProperty _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ConfigProperty _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,99 +75,99 @@ public final static ConfigProperty _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final ConfigProperty configProperty = new ConfigProperty(); + ConfigProperty configProperty = new ConfigProperty(); context.beforeUnmarshal(configProperty, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("config-propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("config-propertyType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ConfigProperty.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, configProperty); configProperty.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("config-property-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("config-property-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: configPropertyName - final String configPropertyNameRaw = elementReader.getElementAsString(); + String configPropertyNameRaw = elementReader.getElementText(); - final String configPropertyName; + String configPropertyName; try { configPropertyName = Adapters.collapsedStringAdapterAdapter.unmarshal(configPropertyNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } configProperty.configPropertyName = configPropertyName; - } else if (("config-property-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("config-property-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: configPropertyType - final String configPropertyTypeRaw = elementReader.getElementAsString(); + String configPropertyTypeRaw = elementReader.getElementText(); - final String configPropertyType; + String configPropertyType; try { configPropertyType = Adapters.collapsedStringAdapterAdapter.unmarshal(configPropertyTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } configProperty.configPropertyType = configPropertyType; - } else if (("config-property-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("config-property-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: configPropertyValue - final String configPropertyValueRaw = elementReader.getElementAsString(); + String configPropertyValueRaw = elementReader.getElementText(); - final String configPropertyValue; + String configPropertyValue; try { configPropertyValue = Adapters.collapsedStringAdapterAdapter.unmarshal(configPropertyValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } configProperty.configPropertyValue = configPropertyValue; - } else if (("config-property-ignore" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("config-property-ignore" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: configPropertyIgnore - final Boolean configPropertyIgnore = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean configPropertyIgnore = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); configProperty.configPropertyIgnore = configPropertyIgnore; - } else if (("config-property-supports-dynamic-updates" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("config-property-supports-dynamic-updates" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: configPropertySupportsDynamicUpdates - final Boolean configPropertySupportsDynamicUpdates = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean configPropertySupportsDynamicUpdates = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); configProperty.configPropertySupportsDynamicUpdates = configPropertySupportsDynamicUpdates; - } else if (("config-property-confidential" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("config-property-confidential" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: configPropertyConfidential - final Boolean configPropertyConfidential = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean configPropertyConfidential = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); configProperty.configPropertyConfidential = configPropertyConfidential; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-name"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-type"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-value"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-ignore"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-supports-dynamic-updates"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-confidential")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - configProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + configProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, ConfigProperty.class, "setDescriptions", Text[].class, e); } } @@ -171,38 +177,40 @@ public final static ConfigProperty _read(final XoXMLStreamReader reader, Runtime return configProperty; } - public final ConfigProperty read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ConfigProperty read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ConfigProperty configProperty, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ConfigProperty configProperty, RuntimeContext context) + throws Exception + { if (configProperty == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ConfigProperty.class != configProperty.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ConfigProperty.class!= configProperty.getClass()) { context.unexpectedSubclass(writer, configProperty, ConfigProperty.class); - return; + return ; } context.beforeMarshal(configProperty, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = configProperty.id; - if (idRaw != null) { + String idRaw = configProperty.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(configProperty, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -212,12 +220,12 @@ public final static void _write(final XoXMLStreamWriter writer, final ConfigProp Text[] descriptions = null; try { descriptions = configProperty.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(configProperty, "descriptions", ConfigProperty.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -228,14 +236,14 @@ public final static void _write(final XoXMLStreamWriter writer, final ConfigProp } // ELEMENT: configPropertyName - final String configPropertyNameRaw = configProperty.configPropertyName; + String configPropertyNameRaw = configProperty.configPropertyName; String configPropertyName = null; try { configPropertyName = Adapters.collapsedStringAdapterAdapter.marshal(configPropertyNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(configProperty, "configPropertyName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (configPropertyName != null) { + if (configPropertyName!= null) { writer.writeStartElement(prefix, "config-property-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(configPropertyName); writer.writeEndElement(); @@ -244,14 +252,14 @@ public final static void _write(final XoXMLStreamWriter writer, final ConfigProp } // ELEMENT: configPropertyType - final String configPropertyTypeRaw = configProperty.configPropertyType; + String configPropertyTypeRaw = configProperty.configPropertyType; String configPropertyType = null; try { configPropertyType = Adapters.collapsedStringAdapterAdapter.marshal(configPropertyTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(configProperty, "configPropertyType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (configPropertyType != null) { + if (configPropertyType!= null) { writer.writeStartElement(prefix, "config-property-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(configPropertyType); writer.writeEndElement(); @@ -260,38 +268,38 @@ public final static void _write(final XoXMLStreamWriter writer, final ConfigProp } // ELEMENT: configPropertyValue - final String configPropertyValueRaw = configProperty.configPropertyValue; + String configPropertyValueRaw = configProperty.configPropertyValue; String configPropertyValue = null; try { configPropertyValue = Adapters.collapsedStringAdapterAdapter.marshal(configPropertyValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(configProperty, "configPropertyValue", CollapsedStringAdapter.class, String.class, String.class, e); } - if (configPropertyValue != null) { + if (configPropertyValue!= null) { writer.writeStartElement(prefix, "config-property-value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(configPropertyValue); writer.writeEndElement(); } // ELEMENT: configPropertyIgnore - final Boolean configPropertyIgnore = configProperty.configPropertyIgnore; - if (configPropertyIgnore != null) { + Boolean configPropertyIgnore = configProperty.configPropertyIgnore; + if (configPropertyIgnore!= null) { writer.writeStartElement(prefix, "config-property-ignore", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(configPropertyIgnore)); writer.writeEndElement(); } // ELEMENT: configPropertySupportsDynamicUpdates - final Boolean configPropertySupportsDynamicUpdates = configProperty.configPropertySupportsDynamicUpdates; - if (configPropertySupportsDynamicUpdates != null) { + Boolean configPropertySupportsDynamicUpdates = configProperty.configPropertySupportsDynamicUpdates; + if (configPropertySupportsDynamicUpdates!= null) { writer.writeStartElement(prefix, "config-property-supports-dynamic-updates", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(configPropertySupportsDynamicUpdates)); writer.writeEndElement(); } // ELEMENT: configPropertyConfidential - final Boolean configPropertyConfidential = configProperty.configPropertyConfidential; - if (configPropertyConfidential != null) { + Boolean configPropertyConfidential = configProperty.configPropertyConfidential; + if (configPropertyConfidential!= null) { writer.writeStartElement(prefix, "config-property-confidential", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(configPropertyConfidential)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConnectionDefinition$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConnectionDefinition$JAXB.java index 9e4420eda2a..1fb618f89ab 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConnectionDefinition$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConnectionDefinition$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.ConfigProperty$JAXB.readConfigProperty; import static org.apache.openejb.jee.ConfigProperty$JAXB.writeConfigProperty; @@ -36,30 +37,35 @@ "StringEquality" }) public class ConnectionDefinition$JAXB - extends JAXBObject { + extends JAXBObject +{ public ConnectionDefinition$JAXB() { super(ConnectionDefinition.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "connection-definitionType".intern()), ConfigProperty$JAXB.class); } - public static ConnectionDefinition readConnectionDefinition(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ConnectionDefinition readConnectionDefinition(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeConnectionDefinition(final XoXMLStreamWriter writer, final ConnectionDefinition connectionDefinition, final RuntimeContext context) - throws Exception { + public static void writeConnectionDefinition(XoXMLStreamWriter writer, ConnectionDefinition connectionDefinition, RuntimeContext context) + throws Exception + { _write(writer, connectionDefinition, context); } - public void write(final XoXMLStreamWriter writer, final ConnectionDefinition connectionDefinition, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ConnectionDefinition connectionDefinition, RuntimeContext context) + throws Exception + { _write(writer, connectionDefinition, context); } - public final static ConnectionDefinition _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ConnectionDefinition _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,105 +76,105 @@ public final static ConnectionDefinition _read(final XoXMLStreamReader reader, R context = new RuntimeContext(); } - final ConnectionDefinition connectionDefinition = new ConnectionDefinition(); + ConnectionDefinition connectionDefinition = new ConnectionDefinition(); context.beforeUnmarshal(connectionDefinition, LifecycleCallback.NONE); List configProperty = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("connection-definitionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("connection-definitionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ConnectionDefinition.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, connectionDefinition); connectionDefinition.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("managedconnectionfactory-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("managedconnectionfactory-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: managedConnectionFactoryClass - final String managedConnectionFactoryClassRaw = elementReader.getElementAsString(); + String managedConnectionFactoryClassRaw = elementReader.getElementText(); - final String managedConnectionFactoryClass; + String managedConnectionFactoryClass; try { managedConnectionFactoryClass = Adapters.collapsedStringAdapterAdapter.unmarshal(managedConnectionFactoryClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } connectionDefinition.managedConnectionFactoryClass = managedConnectionFactoryClass; - } else if (("config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("config-property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: configProperty - final ConfigProperty configPropertyItem = readConfigProperty(elementReader, context); + ConfigProperty configPropertyItem = readConfigProperty(elementReader, context); if (configProperty == null) { configProperty = connectionDefinition.configProperty; - if (configProperty != null) { + if (configProperty!= null) { configProperty.clear(); } else { - configProperty = new ArrayList(); + configProperty = new ArrayList<>(); } } configProperty.add(configPropertyItem); - } else if (("connectionfactory-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("connectionfactory-interface" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: connectionFactoryInterface - final String connectionFactoryInterfaceRaw = elementReader.getElementAsString(); + String connectionFactoryInterfaceRaw = elementReader.getElementText(); - final String connectionFactoryInterface; + String connectionFactoryInterface; try { connectionFactoryInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(connectionFactoryInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } connectionDefinition.connectionFactoryInterface = connectionFactoryInterface; - } else if (("connectionfactory-impl-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("connectionfactory-impl-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: connectionFactoryImplClass - final String connectionFactoryImplClassRaw = elementReader.getElementAsString(); + String connectionFactoryImplClassRaw = elementReader.getElementText(); - final String connectionFactoryImplClass; + String connectionFactoryImplClass; try { connectionFactoryImplClass = Adapters.collapsedStringAdapterAdapter.unmarshal(connectionFactoryImplClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } connectionDefinition.connectionFactoryImplClass = connectionFactoryImplClass; - } else if (("connection-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("connection-interface" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: connectionInterface - final String connectionInterfaceRaw = elementReader.getElementAsString(); + String connectionInterfaceRaw = elementReader.getElementText(); - final String connectionInterface; + String connectionInterface; try { connectionInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(connectionInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } connectionDefinition.connectionInterface = connectionInterface; - } else if (("connection-impl-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("connection-impl-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: connectionImplClass - final String connectionImplClassRaw = elementReader.getElementAsString(); + String connectionImplClassRaw = elementReader.getElementText(); - final String connectionImplClass; + String connectionImplClass; try { connectionImplClass = Adapters.collapsedStringAdapterAdapter.unmarshal(connectionImplClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -178,7 +184,7 @@ public final static ConnectionDefinition _read(final XoXMLStreamReader reader, R context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "managedconnectionfactory-class"), new QName("http://java.sun.com/xml/ns/javaee", "config-property"), new QName("http://java.sun.com/xml/ns/javaee", "connectionfactory-interface"), new QName("http://java.sun.com/xml/ns/javaee", "connectionfactory-impl-class"), new QName("http://java.sun.com/xml/ns/javaee", "connection-interface"), new QName("http://java.sun.com/xml/ns/javaee", "connection-impl-class")); } } - if (configProperty != null) { + if (configProperty!= null) { connectionDefinition.configProperty = configProperty; } @@ -187,52 +193,54 @@ public final static ConnectionDefinition _read(final XoXMLStreamReader reader, R return connectionDefinition; } - public final ConnectionDefinition read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ConnectionDefinition read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ConnectionDefinition connectionDefinition, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ConnectionDefinition connectionDefinition, RuntimeContext context) + throws Exception + { if (connectionDefinition == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ConnectionDefinition.class != connectionDefinition.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ConnectionDefinition.class!= connectionDefinition.getClass()) { context.unexpectedSubclass(writer, connectionDefinition, ConnectionDefinition.class); - return; + return ; } context.beforeMarshal(connectionDefinition, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = connectionDefinition.id; - if (idRaw != null) { + String idRaw = connectionDefinition.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connectionDefinition, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: managedConnectionFactoryClass - final String managedConnectionFactoryClassRaw = connectionDefinition.managedConnectionFactoryClass; + String managedConnectionFactoryClassRaw = connectionDefinition.managedConnectionFactoryClass; String managedConnectionFactoryClass = null; try { managedConnectionFactoryClass = Adapters.collapsedStringAdapterAdapter.marshal(managedConnectionFactoryClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connectionDefinition, "managedConnectionFactoryClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (managedConnectionFactoryClass != null) { + if (managedConnectionFactoryClass!= null) { writer.writeStartElement(prefix, "managedconnectionfactory-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(managedConnectionFactoryClass); writer.writeEndElement(); @@ -241,10 +249,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Connection } // ELEMENT: configProperty - final List configProperty = connectionDefinition.configProperty; - if (configProperty != null) { - for (final ConfigProperty configPropertyItem : configProperty) { - if (configPropertyItem != null) { + List configProperty = connectionDefinition.configProperty; + if (configProperty!= null) { + for (ConfigProperty configPropertyItem: configProperty) { + if (configPropertyItem!= null) { writer.writeStartElement(prefix, "config-property", "http://java.sun.com/xml/ns/javaee"); writeConfigProperty(writer, configPropertyItem, context); writer.writeEndElement(); @@ -253,14 +261,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Connection } // ELEMENT: connectionFactoryInterface - final String connectionFactoryInterfaceRaw = connectionDefinition.connectionFactoryInterface; + String connectionFactoryInterfaceRaw = connectionDefinition.connectionFactoryInterface; String connectionFactoryInterface = null; try { connectionFactoryInterface = Adapters.collapsedStringAdapterAdapter.marshal(connectionFactoryInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connectionDefinition, "connectionFactoryInterface", CollapsedStringAdapter.class, String.class, String.class, e); } - if (connectionFactoryInterface != null) { + if (connectionFactoryInterface!= null) { writer.writeStartElement(prefix, "connectionfactory-interface", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(connectionFactoryInterface); writer.writeEndElement(); @@ -269,14 +277,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Connection } // ELEMENT: connectionFactoryImplClass - final String connectionFactoryImplClassRaw = connectionDefinition.connectionFactoryImplClass; + String connectionFactoryImplClassRaw = connectionDefinition.connectionFactoryImplClass; String connectionFactoryImplClass = null; try { connectionFactoryImplClass = Adapters.collapsedStringAdapterAdapter.marshal(connectionFactoryImplClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connectionDefinition, "connectionFactoryImplClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (connectionFactoryImplClass != null) { + if (connectionFactoryImplClass!= null) { writer.writeStartElement(prefix, "connectionfactory-impl-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(connectionFactoryImplClass); writer.writeEndElement(); @@ -285,14 +293,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Connection } // ELEMENT: connectionInterface - final String connectionInterfaceRaw = connectionDefinition.connectionInterface; + String connectionInterfaceRaw = connectionDefinition.connectionInterface; String connectionInterface = null; try { connectionInterface = Adapters.collapsedStringAdapterAdapter.marshal(connectionInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connectionDefinition, "connectionInterface", CollapsedStringAdapter.class, String.class, String.class, e); } - if (connectionInterface != null) { + if (connectionInterface!= null) { writer.writeStartElement(prefix, "connection-interface", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(connectionInterface); writer.writeEndElement(); @@ -301,14 +309,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Connection } // ELEMENT: connectionImplClass - final String connectionImplClassRaw = connectionDefinition.connectionImplClass; + String connectionImplClassRaw = connectionDefinition.connectionImplClass; String connectionImplClass = null; try { connectionImplClass = Adapters.collapsedStringAdapterAdapter.marshal(connectionImplClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connectionDefinition, "connectionImplClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (connectionImplClass != null) { + if (connectionImplClass!= null) { writer.writeStartElement(prefix, "connection-impl-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(connectionImplClass); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Connector$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Connector$JAXB.java index 62d274ffeae..5c1d7991d12 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Connector$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Connector$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -42,30 +43,35 @@ "StringEquality" }) public class Connector$JAXB - extends JAXBObject { + extends JAXBObject +{ public Connector$JAXB() { super(Connector.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "connector".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "connectorType".intern()), Text$JAXB.class, Icon$JAXB.class, License$JAXB.class, ResourceAdapter$JAXB.class); } - public static Connector readConnector(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Connector readConnector(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeConnector(final XoXMLStreamWriter writer, final Connector connector, final RuntimeContext context) - throws Exception { + public static void writeConnector(XoXMLStreamWriter writer, Connector connector, RuntimeContext context) + throws Exception + { _write(writer, connector, context); } - public void write(final XoXMLStreamWriter writer, final Connector connector, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Connector connector, RuntimeContext context) + throws Exception + { _write(writer, connector, context); } - public final static Connector _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Connector _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -76,7 +82,7 @@ public final static Connector _read(final XoXMLStreamReader reader, RuntimeConte context = new RuntimeContext(); } - final Connector connector = new Connector(); + Connector connector = new Connector(); context.beforeUnmarshal(connector, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -85,138 +91,138 @@ public final static Connector _read(final XoXMLStreamReader reader, RuntimeConte List requiredWorkContext = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("connectorType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("connectorType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Connector.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, connector); connector.id = id; - } else if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("version" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: version connector.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); - } else if (("metadata-complete" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("metadata-complete" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: metadataComplete - final Boolean metadataComplete = ("1".equals(attribute.getValue()) || "true".equals(attribute.getValue())); + Boolean metadataComplete = ("1".equals(attribute.getValue())||"true".equals(attribute.getValue())); connector.metadataComplete = metadataComplete; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "version"), new QName("", "metadata-complete")); } } // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("module-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("module-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: moduleName - final String moduleNameRaw = elementReader.getElementAsString(); + String moduleNameRaw = elementReader.getElementText(); - final String moduleName; + String moduleName; try { moduleName = Adapters.collapsedStringAdapterAdapter.unmarshal(moduleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } connector.moduleName = moduleName; - } else if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: descriptions - final Text descriptionsItem = readText(elementReader, context); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = connector.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("vendor-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("vendor-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: vendorName - final String vendorNameRaw = elementReader.getElementAsString(); + String vendorNameRaw = elementReader.getElementText(); - final String vendorName; + String vendorName; try { vendorName = Adapters.collapsedStringAdapterAdapter.unmarshal(vendorNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } connector.vendorName = vendorName; - } else if (("eis-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("eis-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: eisType - final String eisTypeRaw = elementReader.getElementAsString(); + String eisTypeRaw = elementReader.getElementText(); - final String eisType; + String eisType; try { eisType = Adapters.collapsedStringAdapterAdapter.unmarshal(eisTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } connector.eisType = eisType; - } else if (("resourceadapter-version" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resourceadapter-version" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceAdapterVersion - final String resourceAdapterVersionRaw = elementReader.getElementAsString(); + String resourceAdapterVersionRaw = elementReader.getElementText(); - final String resourceAdapterVersion; + String resourceAdapterVersion; try { resourceAdapterVersion = Adapters.collapsedStringAdapterAdapter.unmarshal(resourceAdapterVersionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } connector.resourceAdapterVersion = resourceAdapterVersion; - } else if (("license" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("license" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: license - final License license = readLicense(elementReader, context); + License license = readLicense(elementReader, context); connector.license = license; - } else if (("resourceadapter" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resourceadapter" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceAdapter - final ResourceAdapter resourceAdapter = readResourceAdapter(elementReader, context); + ResourceAdapter resourceAdapter = readResourceAdapter(elementReader, context); connector.resourceAdapter = resourceAdapter; - } else if (("required-work-context" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("required-work-context" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: requiredWorkContext - final String requiredWorkContextItemRaw = elementReader.getElementAsString(); + String requiredWorkContextItemRaw = elementReader.getElementText(); - final String requiredWorkContextItem; + String requiredWorkContextItem; try { requiredWorkContextItem = Adapters.collapsedStringAdapterAdapter.unmarshal(requiredWorkContextItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (requiredWorkContext == null) { requiredWorkContext = connector.requiredWorkContext; - if (requiredWorkContext != null) { + if (requiredWorkContext!= null) { requiredWorkContext.clear(); } else { - requiredWorkContext = new ArrayList(); + requiredWorkContext = new ArrayList<>(); } } requiredWorkContext.add(requiredWorkContextItem); @@ -224,24 +230,24 @@ public final static Connector _read(final XoXMLStreamReader reader, RuntimeConte context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "module-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", "vendor-name"), new QName("http://java.sun.com/xml/ns/javaee", "eis-type"), new QName("http://java.sun.com/xml/ns/javaee", "resourceadapter-version"), new QName("http://java.sun.com/xml/ns/javaee", "license"), new QName("http://java.sun.com/xml/ns/javaee", "resourceadapter"), new QName("http://java.sun.com/xml/ns/javaee", "required-work-context")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - connector.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + connector.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Connector.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - connector.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + connector.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, Connector.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { connector.icon = icon; } - if (requiredWorkContext != null) { + if (requiredWorkContext!= null) { connector.requiredWorkContext = requiredWorkContext; } @@ -250,70 +256,72 @@ public final static Connector _read(final XoXMLStreamReader reader, RuntimeConte return connector; } - public final Connector read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Connector read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Connector connector, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Connector connector, RuntimeContext context) + throws Exception + { if (connector == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Connector.class != connector.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Connector.class!= connector.getClass()) { context.unexpectedSubclass(writer, connector, Connector.class); - return; + return ; } context.beforeMarshal(connector, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = connector.id; - if (idRaw != null) { + String idRaw = connector.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connector, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: version - final String versionRaw = connector.version; - if (versionRaw != null) { + String versionRaw = connector.version; + if (versionRaw!= null) { String version = null; try { version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connector, "version", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "version", version); } // ATTRIBUTE: metadataComplete - final Boolean metadataComplete = connector.metadataComplete; - if (metadataComplete != null) { + Boolean metadataComplete = connector.metadataComplete; + if (metadataComplete!= null) { writer.writeAttribute("", "", "metadata-complete", Boolean.toString(metadataComplete)); } // ELEMENT: moduleName - final String moduleNameRaw = connector.moduleName; + String moduleNameRaw = connector.moduleName; String moduleName = null; try { moduleName = Adapters.collapsedStringAdapterAdapter.marshal(moduleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connector, "moduleName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (moduleName != null) { + if (moduleName!= null) { writer.writeStartElement(prefix, "module-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(moduleName); writer.writeEndElement(); @@ -323,12 +331,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Connector Text[] descriptions = null; try { descriptions = connector.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(connector, "descriptions", Connector.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -342,12 +350,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Connector Text[] displayNames = null; try { displayNames = connector.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(connector, "displayNames", Connector.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -358,10 +366,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Connector } // ELEMENT: icon - final LocalCollection icon = connector.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = connector.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -372,58 +380,58 @@ public final static void _write(final XoXMLStreamWriter writer, final Connector } // ELEMENT: vendorName - final String vendorNameRaw = connector.vendorName; + String vendorNameRaw = connector.vendorName; String vendorName = null; try { vendorName = Adapters.collapsedStringAdapterAdapter.marshal(vendorNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connector, "vendorName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (vendorName != null) { + if (vendorName!= null) { writer.writeStartElement(prefix, "vendor-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(vendorName); writer.writeEndElement(); } // ELEMENT: eisType - final String eisTypeRaw = connector.eisType; + String eisTypeRaw = connector.eisType; String eisType = null; try { eisType = Adapters.collapsedStringAdapterAdapter.marshal(eisTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connector, "eisType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (eisType != null) { + if (eisType!= null) { writer.writeStartElement(prefix, "eis-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(eisType); writer.writeEndElement(); } // ELEMENT: resourceAdapterVersion - final String resourceAdapterVersionRaw = connector.resourceAdapterVersion; + String resourceAdapterVersionRaw = connector.resourceAdapterVersion; String resourceAdapterVersion = null; try { resourceAdapterVersion = Adapters.collapsedStringAdapterAdapter.marshal(resourceAdapterVersionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connector, "resourceAdapterVersion", CollapsedStringAdapter.class, String.class, String.class, e); } - if (resourceAdapterVersion != null) { + if (resourceAdapterVersion!= null) { writer.writeStartElement(prefix, "resourceadapter-version", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(resourceAdapterVersion); writer.writeEndElement(); } // ELEMENT: license - final License license = connector.license; - if (license != null) { + License license = connector.license; + if (license!= null) { writer.writeStartElement(prefix, "license", "http://java.sun.com/xml/ns/javaee"); writeLicense(writer, license, context); writer.writeEndElement(); } // ELEMENT: resourceAdapter - final ResourceAdapter resourceAdapter = connector.resourceAdapter; - if (resourceAdapter != null) { + ResourceAdapter resourceAdapter = connector.resourceAdapter; + if (resourceAdapter!= null) { writer.writeStartElement(prefix, "resourceadapter", "http://java.sun.com/xml/ns/javaee"); writeResourceAdapter(writer, resourceAdapter, context); writer.writeEndElement(); @@ -432,16 +440,16 @@ public final static void _write(final XoXMLStreamWriter writer, final Connector } // ELEMENT: requiredWorkContext - final List requiredWorkContextRaw = connector.requiredWorkContext; - if (requiredWorkContextRaw != null) { - for (final String requiredWorkContextItem : requiredWorkContextRaw) { + List requiredWorkContextRaw = connector.requiredWorkContext; + if (requiredWorkContextRaw!= null) { + for (String requiredWorkContextItem: requiredWorkContextRaw) { String requiredWorkContext = null; try { requiredWorkContext = Adapters.collapsedStringAdapterAdapter.marshal(requiredWorkContextItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(connector, "requiredWorkContext", CollapsedStringAdapter.class, List.class, List.class, e); } - if (requiredWorkContext != null) { + if (requiredWorkContext!= null) { writer.writeStartElement(prefix, "required-work-context", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(requiredWorkContext); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConstructorParameterOrder$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConstructorParameterOrder$JAXB.java index b3f3c86518c..be122be18f1 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConstructorParameterOrder$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ConstructorParameterOrder$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class ConstructorParameterOrder$JAXB - extends JAXBObject { + extends JAXBObject +{ public ConstructorParameterOrder$JAXB() { super(ConstructorParameterOrder.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "constructor-parameter-orderType".intern())); } - public static ConstructorParameterOrder readConstructorParameterOrder(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ConstructorParameterOrder readConstructorParameterOrder(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeConstructorParameterOrder(final XoXMLStreamWriter writer, final ConstructorParameterOrder constructorParameterOrder, final RuntimeContext context) - throws Exception { + public static void writeConstructorParameterOrder(XoXMLStreamWriter writer, ConstructorParameterOrder constructorParameterOrder, RuntimeContext context) + throws Exception + { _write(writer, constructorParameterOrder, context); } - public void write(final XoXMLStreamWriter writer, final ConstructorParameterOrder constructorParameterOrder, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ConstructorParameterOrder constructorParameterOrder, RuntimeContext context) + throws Exception + { _write(writer, constructorParameterOrder, context); } - public final static ConstructorParameterOrder _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ConstructorParameterOrder _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,51 +72,51 @@ public final static ConstructorParameterOrder _read(final XoXMLStreamReader read context = new RuntimeContext(); } - final ConstructorParameterOrder constructorParameterOrder = new ConstructorParameterOrder(); + ConstructorParameterOrder constructorParameterOrder = new ConstructorParameterOrder(); context.beforeUnmarshal(constructorParameterOrder, LifecycleCallback.NONE); List elementName = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("constructor-parameter-orderType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("constructor-parameter-orderType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ConstructorParameterOrder.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, constructorParameterOrder); constructorParameterOrder.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("element-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("element-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: elementName - final String elementNameItemRaw = elementReader.getElementAsString(); + String elementNameItemRaw = elementReader.getElementText(); - final String elementNameItem; + String elementNameItem; try { elementNameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(elementNameItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (elementName == null) { elementName = constructorParameterOrder.elementName; - if (elementName != null) { + if (elementName!= null) { elementName.clear(); } else { - elementName = new ArrayList(); + elementName = new ArrayList<>(); } } elementName.add(elementNameItem); @@ -119,7 +124,7 @@ public final static ConstructorParameterOrder _read(final XoXMLStreamReader read context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "element-name")); } } - if (elementName != null) { + if (elementName!= null) { constructorParameterOrder.elementName = elementName; } @@ -128,53 +133,55 @@ public final static ConstructorParameterOrder _read(final XoXMLStreamReader read return constructorParameterOrder; } - public final ConstructorParameterOrder read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ConstructorParameterOrder read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ConstructorParameterOrder constructorParameterOrder, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ConstructorParameterOrder constructorParameterOrder, RuntimeContext context) + throws Exception + { if (constructorParameterOrder == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (ConstructorParameterOrder.class != constructorParameterOrder.getClass()) { + if (ConstructorParameterOrder.class!= constructorParameterOrder.getClass()) { context.unexpectedSubclass(writer, constructorParameterOrder, ConstructorParameterOrder.class); - return; + return ; } context.beforeMarshal(constructorParameterOrder, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = constructorParameterOrder.id; - if (idRaw != null) { + String idRaw = constructorParameterOrder.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(constructorParameterOrder, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: elementName - final List elementNameRaw = constructorParameterOrder.elementName; - if (elementNameRaw != null) { - for (final String elementNameItem : elementNameRaw) { + List elementNameRaw = constructorParameterOrder.elementName; + if (elementNameRaw!= null) { + for (String elementNameItem: elementNameRaw) { String elementName = null; try { elementName = Adapters.collapsedStringAdapterAdapter.marshal(elementNameItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(constructorParameterOrder, "elementName", CollapsedStringAdapter.class, List.class, List.class, e); } - if (elementName != null) { + if (elementName!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "element-name"); writer.writeCharacters(elementName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContainerConcurrency$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContainerConcurrency$JAXB.java index 45053b1f75d..d5dba45ed7c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContainerConcurrency$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContainerConcurrency$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.ConcurrentLockType$JAXB.parseConcurrentLockType; import static org.apache.openejb.jee.ConcurrentLockType$JAXB.toStringConcurrentLockType; @@ -40,30 +41,35 @@ "StringEquality" }) public class ContainerConcurrency$JAXB - extends JAXBObject { + extends JAXBObject +{ public ContainerConcurrency$JAXB() { super(ContainerConcurrency.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "container-concurrencyType".intern()), Text$JAXB.class, Method$JAXB.class, ConcurrentLockType$JAXB.class); } - public static ContainerConcurrency readContainerConcurrency(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ContainerConcurrency readContainerConcurrency(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeContainerConcurrency(final XoXMLStreamWriter writer, final ContainerConcurrency containerConcurrency, final RuntimeContext context) - throws Exception { + public static void writeContainerConcurrency(XoXMLStreamWriter writer, ContainerConcurrency containerConcurrency, RuntimeContext context) + throws Exception + { _write(writer, containerConcurrency, context); } - public void write(final XoXMLStreamWriter writer, final ContainerConcurrency containerConcurrency, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ContainerConcurrency containerConcurrency, RuntimeContext context) + throws Exception + { _write(writer, containerConcurrency, context); } - public final static ContainerConcurrency _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ContainerConcurrency _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,71 +80,71 @@ public final static ContainerConcurrency _read(final XoXMLStreamReader reader, R context = new RuntimeContext(); } - final ContainerConcurrency containerConcurrency = new ContainerConcurrency(); + ContainerConcurrency containerConcurrency = new ContainerConcurrency(); context.beforeUnmarshal(containerConcurrency, LifecycleCallback.NONE); ArrayList descriptions = null; List method = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("container-concurrencyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("container-concurrencyType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ContainerConcurrency.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, containerConcurrency); containerConcurrency.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: method - final Method methodItem = readMethod(elementReader, context); + Method methodItem = readMethod(elementReader, context); if (method == null) { method = containerConcurrency.method; - if (method != null) { + if (method!= null) { method.clear(); } else { - method = new ArrayList(); + method = new ArrayList<>(); } } method.add(methodItem); - } else if (("concurrency-attribute" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("concurrency-attribute" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lock - final ConcurrentLockType lock = parseConcurrentLockType(elementReader, context, elementReader.getElementAsString()); - if (lock != null) { + ConcurrentLockType lock = parseConcurrentLockType(elementReader, context, elementReader.getElementText()); + if (lock!= null) { containerConcurrency.lock = lock; } } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "method"), new QName("http://java.sun.com/xml/ns/javaee", "concurrency-attribute")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - containerConcurrency.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + containerConcurrency.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, ContainerConcurrency.class, "setDescriptions", Text[].class, e); } } - if (method != null) { + if (method!= null) { containerConcurrency.method = method; } @@ -147,38 +153,40 @@ public final static ContainerConcurrency _read(final XoXMLStreamReader reader, R return containerConcurrency; } - public final ContainerConcurrency read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ContainerConcurrency read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ContainerConcurrency containerConcurrency, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ContainerConcurrency containerConcurrency, RuntimeContext context) + throws Exception + { if (containerConcurrency == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ContainerConcurrency.class != containerConcurrency.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ContainerConcurrency.class!= containerConcurrency.getClass()) { context.unexpectedSubclass(writer, containerConcurrency, ContainerConcurrency.class); - return; + return ; } context.beforeMarshal(containerConcurrency, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = containerConcurrency.id; - if (idRaw != null) { + String idRaw = containerConcurrency.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(containerConcurrency, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -188,12 +196,12 @@ public final static void _write(final XoXMLStreamWriter writer, final ContainerC Text[] descriptions = null; try { descriptions = containerConcurrency.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(containerConcurrency, "descriptions", ContainerConcurrency.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -204,10 +212,10 @@ public final static void _write(final XoXMLStreamWriter writer, final ContainerC } // ELEMENT: method - final List method = containerConcurrency.method; - if (method != null) { - for (final Method methodItem : method) { - if (methodItem != null) { + List method = containerConcurrency.method; + if (method!= null) { + for (Method methodItem: method) { + if (methodItem!= null) { writer.writeStartElement(prefix, "method", "http://java.sun.com/xml/ns/javaee"); writeMethod(writer, methodItem, context); writer.writeEndElement(); @@ -218,8 +226,8 @@ public final static void _write(final XoXMLStreamWriter writer, final ContainerC } // ELEMENT: lock - final ConcurrentLockType lock = containerConcurrency.lock; - if (lock != null) { + ConcurrentLockType lock = containerConcurrency.lock; + if (lock!= null) { writer.writeStartElement(prefix, "concurrency-attribute", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringConcurrentLockType(containerConcurrency, null, context, lock)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContainerTransaction$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContainerTransaction$JAXB.java index 0c86883c83f..59913ff38ea 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContainerTransaction$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContainerTransaction$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Method$JAXB.readMethod; import static org.apache.openejb.jee.Method$JAXB.writeMethod; @@ -40,30 +41,35 @@ "StringEquality" }) public class ContainerTransaction$JAXB - extends JAXBObject { + extends JAXBObject +{ public ContainerTransaction$JAXB() { super(ContainerTransaction.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "container-transactionType".intern()), Text$JAXB.class, Method$JAXB.class, TransAttribute$JAXB.class); } - public static ContainerTransaction readContainerTransaction(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ContainerTransaction readContainerTransaction(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeContainerTransaction(final XoXMLStreamWriter writer, final ContainerTransaction containerTransaction, final RuntimeContext context) - throws Exception { + public static void writeContainerTransaction(XoXMLStreamWriter writer, ContainerTransaction containerTransaction, RuntimeContext context) + throws Exception + { _write(writer, containerTransaction, context); } - public void write(final XoXMLStreamWriter writer, final ContainerTransaction containerTransaction, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ContainerTransaction containerTransaction, RuntimeContext context) + throws Exception + { _write(writer, containerTransaction, context); } - public final static ContainerTransaction _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ContainerTransaction _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,71 +80,71 @@ public final static ContainerTransaction _read(final XoXMLStreamReader reader, R context = new RuntimeContext(); } - final ContainerTransaction containerTransaction = new ContainerTransaction(); + ContainerTransaction containerTransaction = new ContainerTransaction(); context.beforeUnmarshal(containerTransaction, LifecycleCallback.NONE); ArrayList descriptions = null; List method = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("container-transactionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("container-transactionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ContainerTransaction.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, containerTransaction); containerTransaction.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: method - final Method methodItem = readMethod(elementReader, context); + Method methodItem = readMethod(elementReader, context); if (method == null) { method = containerTransaction.method; - if (method != null) { + if (method!= null) { method.clear(); } else { - method = new ArrayList(); + method = new ArrayList<>(); } } method.add(methodItem); - } else if (("trans-attribute" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("trans-attribute" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: transAttribute - final TransAttribute transAttribute = parseTransAttribute(elementReader, context, elementReader.getElementAsString()); - if (transAttribute != null) { + TransAttribute transAttribute = parseTransAttribute(elementReader, context, elementReader.getElementText()); + if (transAttribute!= null) { containerTransaction.transAttribute = transAttribute; } } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "method"), new QName("http://java.sun.com/xml/ns/javaee", "trans-attribute")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - containerTransaction.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + containerTransaction.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, ContainerTransaction.class, "setDescriptions", Text[].class, e); } } - if (method != null) { + if (method!= null) { containerTransaction.method = method; } @@ -147,38 +153,40 @@ public final static ContainerTransaction _read(final XoXMLStreamReader reader, R return containerTransaction; } - public final ContainerTransaction read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ContainerTransaction read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ContainerTransaction containerTransaction, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ContainerTransaction containerTransaction, RuntimeContext context) + throws Exception + { if (containerTransaction == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ContainerTransaction.class != containerTransaction.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ContainerTransaction.class!= containerTransaction.getClass()) { context.unexpectedSubclass(writer, containerTransaction, ContainerTransaction.class); - return; + return ; } context.beforeMarshal(containerTransaction, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = containerTransaction.id; - if (idRaw != null) { + String idRaw = containerTransaction.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(containerTransaction, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -188,12 +196,12 @@ public final static void _write(final XoXMLStreamWriter writer, final ContainerT Text[] descriptions = null; try { descriptions = containerTransaction.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(containerTransaction, "descriptions", ContainerTransaction.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -204,10 +212,10 @@ public final static void _write(final XoXMLStreamWriter writer, final ContainerT } // ELEMENT: method - final List method = containerTransaction.method; - if (method != null) { - for (final Method methodItem : method) { - if (methodItem != null) { + List method = containerTransaction.method; + if (method!= null) { + for (Method methodItem: method) { + if (methodItem!= null) { writer.writeStartElement(prefix, "method", "http://java.sun.com/xml/ns/javaee"); writeMethod(writer, methodItem, context); writer.writeEndElement(); @@ -218,8 +226,8 @@ public final static void _write(final XoXMLStreamWriter writer, final ContainerT } // ELEMENT: transAttribute - final TransAttribute transAttribute = containerTransaction.transAttribute; - if (transAttribute != null) { + TransAttribute transAttribute = containerTransaction.transAttribute; + if (transAttribute!= null) { writer.writeStartElement(prefix, "trans-attribute", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringTransAttribute(containerTransaction, null, context, transAttribute)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContextService$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContextService$JAXB.java new file mode 100644 index 00000000000..febbfe0602e --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ContextService$JAXB.java @@ -0,0 +1,346 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.apache.openejb.jee.jba.JndiName; +import org.apache.openejb.jee.jba.JndiName$JAXB; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.Description$JAXB.readDescription; +import static org.apache.openejb.jee.Description$JAXB.writeDescription; +import static org.apache.openejb.jee.Property$JAXB.readProperty; +import static org.apache.openejb.jee.Property$JAXB.writeProperty; +import static org.apache.openejb.jee.jba.JndiName$JAXB.readJndiName; +import static org.apache.openejb.jee.jba.JndiName$JAXB.writeJndiName; + +@SuppressWarnings({ + "StringEquality" +}) +public class ContextService$JAXB + extends JAXBObject +{ + + + public ContextService$JAXB() { + super(ContextService.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "context-serviceType".intern()), Description$JAXB.class, JndiName$JAXB.class, Property$JAXB.class); + } + + public static ContextService readContextService(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeContextService(XoXMLStreamWriter writer, ContextService contextService, RuntimeContext context) + throws Exception + { + _write(writer, contextService, context); + } + + public void write(XoXMLStreamWriter writer, ContextService contextService, RuntimeContext context) + throws Exception + { + _write(writer, contextService, context); + } + + public static final ContextService _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + ContextService contextService = new ContextService(); + context.beforeUnmarshal(contextService, LifecycleCallback.NONE); + + List cleared = null; + List propagated = null; + List unchanged = null; + List property = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("context-serviceType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, ContextService.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, contextService); + contextService.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 (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: description + Description description = readDescription(elementReader, context); + contextService.description = description; + } else if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: name + JndiName name = readJndiName(elementReader, context); + contextService.name = name; + } else if (("cleared" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: cleared + String clearedItemRaw = elementReader.getElementText(); + + String clearedItem; + try { + clearedItem = Adapters.collapsedStringAdapterAdapter.unmarshal(clearedItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (cleared == null) { + cleared = contextService.cleared; + if (cleared!= null) { + cleared.clear(); + } else { + cleared = new ArrayList<>(); + } + } + cleared.add(clearedItem); + } else if (("propagated" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: propagated + String propagatedItemRaw = elementReader.getElementText(); + + String propagatedItem; + try { + propagatedItem = Adapters.collapsedStringAdapterAdapter.unmarshal(propagatedItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (propagated == null) { + propagated = contextService.propagated; + if (propagated!= null) { + propagated.clear(); + } else { + propagated = new ArrayList<>(); + } + } + propagated.add(propagatedItem); + } else if (("unchanged" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: unchanged + String unchangedItemRaw = elementReader.getElementText(); + + String unchangedItem; + try { + unchangedItem = Adapters.collapsedStringAdapterAdapter.unmarshal(unchangedItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (unchanged == null) { + unchanged = contextService.unchanged; + if (unchanged!= null) { + unchanged.clear(); + } else { + unchanged = new ArrayList<>(); + } + } + unchanged.add(unchangedItem); + } else if (("property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: property + Property propertyItem = readProperty(elementReader, context); + if (property == null) { + property = contextService.property; + if (property!= null) { + property.clear(); + } else { + property = new ArrayList<>(); + } + } + property.add(propertyItem); + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "cleared"), new QName("http://java.sun.com/xml/ns/javaee", "propagated"), new QName("http://java.sun.com/xml/ns/javaee", "unchanged"), new QName("http://java.sun.com/xml/ns/javaee", "property")); + } + } + if (cleared!= null) { + contextService.cleared = cleared; + } + if (propagated!= null) { + contextService.propagated = propagated; + } + if (unchanged!= null) { + contextService.unchanged = unchanged; + } + if (property!= null) { + contextService.property = property; + } + + context.afterUnmarshal(contextService, LifecycleCallback.NONE); + + return contextService; + } + + public final ContextService read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, ContextService contextService, RuntimeContext context) + throws Exception + { + if (contextService == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ContextService.class!= contextService.getClass()) { + context.unexpectedSubclass(writer, contextService, ContextService.class); + return ; + } + + context.beforeMarshal(contextService, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = contextService.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(contextService, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: description + Description description = contextService.description; + if (description!= null) { + writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); + writeDescription(writer, description, context); + writer.writeEndElement(); + } + + // ELEMENT: name + JndiName name = contextService.name; + if (name!= null) { + writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); + writeJndiName(writer, name, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(contextService, "name"); + } + + // ELEMENT: cleared + List clearedRaw = contextService.cleared; + if (clearedRaw!= null) { + for (String clearedItem: clearedRaw) { + String cleared = null; + try { + cleared = Adapters.collapsedStringAdapterAdapter.marshal(clearedItem); + } catch (Exception e) { + context.xmlAdapterError(contextService, "cleared", CollapsedStringAdapter.class, List.class, List.class, e); + } + if (cleared!= null) { + writer.writeStartElement(prefix, "cleared", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(cleared); + writer.writeEndElement(); + } + } + } + + // ELEMENT: propagated + List propagatedRaw = contextService.propagated; + if (propagatedRaw!= null) { + for (String propagatedItem: propagatedRaw) { + String propagated = null; + try { + propagated = Adapters.collapsedStringAdapterAdapter.marshal(propagatedItem); + } catch (Exception e) { + context.xmlAdapterError(contextService, "propagated", CollapsedStringAdapter.class, List.class, List.class, e); + } + if (propagated!= null) { + writer.writeStartElement(prefix, "propagated", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(propagated); + writer.writeEndElement(); + } + } + } + + // ELEMENT: unchanged + List unchangedRaw = contextService.unchanged; + if (unchangedRaw!= null) { + for (String unchangedItem: unchangedRaw) { + String unchanged = null; + try { + unchanged = Adapters.collapsedStringAdapterAdapter.marshal(unchangedItem); + } catch (Exception e) { + context.xmlAdapterError(contextService, "unchanged", CollapsedStringAdapter.class, List.class, List.class, e); + } + if (unchanged!= null) { + writer.writeStartElement(prefix, "unchanged", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(unchanged); + writer.writeEndElement(); + } + } + } + + // ELEMENT: property + List property = contextService.property; + if (property!= null) { + for (Property propertyItem: property) { + if (propertyItem!= null) { + writer.writeStartElement(prefix, "property", "http://java.sun.com/xml/ns/javaee"); + writeProperty(writer, propertyItem, context); + writer.writeEndElement(); + } + } + } + + context.afterMarshal(contextService, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CookieConfig$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CookieConfig$JAXB.java index b603110faea..cc43cc72998 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CookieConfig$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/CookieConfig$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class CookieConfig$JAXB - extends JAXBObject { + extends JAXBObject +{ public CookieConfig$JAXB() { super(CookieConfig.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "cookie-configType".intern())); } - public static CookieConfig readCookieConfig(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static CookieConfig readCookieConfig(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeCookieConfig(final XoXMLStreamWriter writer, final CookieConfig cookieConfig, final RuntimeContext context) - throws Exception { + public static void writeCookieConfig(XoXMLStreamWriter writer, CookieConfig cookieConfig, RuntimeContext context) + throws Exception + { _write(writer, cookieConfig, context); } - public void write(final XoXMLStreamWriter writer, final CookieConfig cookieConfig, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, CookieConfig cookieConfig, RuntimeContext context) + throws Exception + { _write(writer, cookieConfig, context); } - public final static CookieConfig _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final CookieConfig _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,95 +70,95 @@ public final static CookieConfig _read(final XoXMLStreamReader reader, RuntimeCo context = new RuntimeContext(); } - final CookieConfig cookieConfig = new CookieConfig(); + CookieConfig cookieConfig = new CookieConfig(); context.beforeUnmarshal(cookieConfig, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("cookie-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("cookie-configType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, CookieConfig.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, cookieConfig); cookieConfig.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + String nameRaw = elementReader.getElementText(); - final String name; + String name; try { name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } cookieConfig.name = name; - } else if (("domain" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("domain" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: domain - final String domainRaw = elementReader.getElementAsString(); + String domainRaw = elementReader.getElementText(); - final String domain; + String domain; try { domain = Adapters.collapsedStringAdapterAdapter.unmarshal(domainRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } cookieConfig.domain = domain; - } else if (("path" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("path" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: path - final String pathRaw = elementReader.getElementAsString(); + String pathRaw = elementReader.getElementText(); - final String path; + String path; try { path = Adapters.collapsedStringAdapterAdapter.unmarshal(pathRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } cookieConfig.path = path; - } else if (("comment" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("comment" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: comment - final String commentRaw = elementReader.getElementAsString(); + String commentRaw = elementReader.getElementText(); - final String comment; + String comment; try { comment = Adapters.collapsedStringAdapterAdapter.unmarshal(commentRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } cookieConfig.comment = comment; - } else if (("http-only" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("http-only" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: httpOnly - final Boolean httpOnly = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean httpOnly = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); cookieConfig.httpOnly = httpOnly; - } else if (("secure" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("secure" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: secure - final Boolean secure = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean secure = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); cookieConfig.secure = secure; - } else if (("max-age" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("max-age" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: maxAge - final Integer maxAge = Integer.valueOf(elementReader.getElementAsString()); + Integer maxAge = Integer.valueOf(elementReader.getElementText()); cookieConfig.maxAge = maxAge; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "domain"), new QName("http://java.sun.com/xml/ns/javaee", "path"), new QName("http://java.sun.com/xml/ns/javaee", "comment"), new QName("http://java.sun.com/xml/ns/javaee", "http-only"), new QName("http://java.sun.com/xml/ns/javaee", "secure"), new QName("http://java.sun.com/xml/ns/javaee", "max-age")); @@ -165,118 +170,120 @@ public final static CookieConfig _read(final XoXMLStreamReader reader, RuntimeCo return cookieConfig; } - public final CookieConfig read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final CookieConfig read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final CookieConfig cookieConfig, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, CookieConfig cookieConfig, RuntimeContext context) + throws Exception + { if (cookieConfig == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (CookieConfig.class != cookieConfig.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (CookieConfig.class!= cookieConfig.getClass()) { context.unexpectedSubclass(writer, cookieConfig, CookieConfig.class); - return; + return ; } context.beforeMarshal(cookieConfig, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = cookieConfig.id; - if (idRaw != null) { + String idRaw = cookieConfig.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(cookieConfig, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: name - final String nameRaw = cookieConfig.name; + String nameRaw = cookieConfig.name; String name = null; try { name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(cookieConfig, "name", CollapsedStringAdapter.class, String.class, String.class, e); } - if (name != null) { + if (name!= null) { writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(name); writer.writeEndElement(); } // ELEMENT: domain - final String domainRaw = cookieConfig.domain; + String domainRaw = cookieConfig.domain; String domain = null; try { domain = Adapters.collapsedStringAdapterAdapter.marshal(domainRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(cookieConfig, "domain", CollapsedStringAdapter.class, String.class, String.class, e); } - if (domain != null) { + if (domain!= null) { writer.writeStartElement(prefix, "domain", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(domain); writer.writeEndElement(); } // ELEMENT: path - final String pathRaw = cookieConfig.path; + String pathRaw = cookieConfig.path; String path = null; try { path = Adapters.collapsedStringAdapterAdapter.marshal(pathRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(cookieConfig, "path", CollapsedStringAdapter.class, String.class, String.class, e); } - if (path != null) { + if (path!= null) { writer.writeStartElement(prefix, "path", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(path); writer.writeEndElement(); } // ELEMENT: comment - final String commentRaw = cookieConfig.comment; + String commentRaw = cookieConfig.comment; String comment = null; try { comment = Adapters.collapsedStringAdapterAdapter.marshal(commentRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(cookieConfig, "comment", CollapsedStringAdapter.class, String.class, String.class, e); } - if (comment != null) { + if (comment!= null) { writer.writeStartElement(prefix, "comment", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(comment); writer.writeEndElement(); } // ELEMENT: httpOnly - final Boolean httpOnly = cookieConfig.httpOnly; - if (httpOnly != null) { + Boolean httpOnly = cookieConfig.httpOnly; + if (httpOnly!= null) { writer.writeStartElement(prefix, "http-only", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(httpOnly)); writer.writeEndElement(); } // ELEMENT: secure - final Boolean secure = cookieConfig.secure; - if (secure != null) { + Boolean secure = cookieConfig.secure; + if (secure!= null) { writer.writeStartElement(prefix, "secure", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(secure)); writer.writeEndElement(); } // ELEMENT: maxAge - final Integer maxAge = cookieConfig.maxAge; - if (maxAge != null) { + Integer maxAge = cookieConfig.maxAge; + if (maxAge!= null) { writer.writeStartElement(prefix, "max-age", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(maxAge)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DataSource$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DataSource$JAXB.java index ee2c980cfc5..344f70997e4 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DataSource$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DataSource$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.IsolationLevel$JAXB.parseIsolationLevel; import static org.apache.openejb.jee.IsolationLevel$JAXB.toStringIsolationLevel; @@ -40,30 +41,35 @@ "StringEquality" }) public class DataSource$JAXB - extends JAXBObject { + extends JAXBObject +{ public DataSource$JAXB() { super(DataSource.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "data-sourceType".intern()), Text$JAXB.class, Property$JAXB.class, IsolationLevel$JAXB.class); } - public static DataSource readDataSource(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static DataSource readDataSource(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeDataSource(final XoXMLStreamWriter writer, final DataSource dataSource, final RuntimeContext context) - throws Exception { + public static void writeDataSource(XoXMLStreamWriter writer, DataSource dataSource, RuntimeContext context) + throws Exception + { _write(writer, dataSource, context); } - public void write(final XoXMLStreamWriter writer, final DataSource dataSource, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, DataSource dataSource, RuntimeContext context) + throws Exception + { _write(writer, dataSource, context); } - public final static DataSource _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final DataSource _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,194 +80,194 @@ public final static DataSource _read(final XoXMLStreamReader reader, RuntimeCont context = new RuntimeContext(); } - final DataSource dataSource = new DataSource(); + DataSource dataSource = new DataSource(); context.beforeUnmarshal(dataSource, LifecycleCallback.NONE); ArrayList descriptions = null; List property = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("data-sourceType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("data-sourceType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, DataSource.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, dataSource); dataSource.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + String nameRaw = elementReader.getElementText(); - final String name; + String name; try { name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } dataSource.name = name; - } else if (("class-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("class-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: className - final String classNameRaw = elementReader.getElementAsString(); + String classNameRaw = elementReader.getElementText(); - final String className; + String className; try { className = Adapters.collapsedStringAdapterAdapter.unmarshal(classNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } dataSource.className = className; - } else if (("server-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("server-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serverName - final String serverNameRaw = elementReader.getElementAsString(); + String serverNameRaw = elementReader.getElementText(); - final String serverName; + String serverName; try { serverName = Adapters.collapsedStringAdapterAdapter.unmarshal(serverNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } dataSource.serverName = serverName; - } else if (("port-number" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("port-number" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: portNumber - final Integer portNumber = Integer.valueOf(elementReader.getElementAsString()); + Integer portNumber = Integer.valueOf(elementReader.getElementText()); dataSource.portNumber = portNumber; - } else if (("database-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("database-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: databaseName - final String databaseNameRaw = elementReader.getElementAsString(); + String databaseNameRaw = elementReader.getElementText(); - final String databaseName; + String databaseName; try { databaseName = Adapters.collapsedStringAdapterAdapter.unmarshal(databaseNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } dataSource.databaseName = databaseName; - } else if (("url" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("url" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: url - final String urlRaw = elementReader.getElementAsString(); + String urlRaw = elementReader.getElementText(); - final String url; + String url; try { url = Adapters.collapsedStringAdapterAdapter.unmarshal(urlRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } dataSource.url = url; - } else if (("user" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("user" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: user - final String userRaw = elementReader.getElementAsString(); + String userRaw = elementReader.getElementText(); - final String user; + String user; try { user = Adapters.collapsedStringAdapterAdapter.unmarshal(userRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } dataSource.user = user; - } else if (("password" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("password" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: password - final String passwordRaw = elementReader.getElementAsString(); + String passwordRaw = elementReader.getElementText(); - final String password; + String password; try { password = Adapters.collapsedStringAdapterAdapter.unmarshal(passwordRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } dataSource.password = password; - } else if (("property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: property - final Property propertyItem = readProperty(elementReader, context); + Property propertyItem = readProperty(elementReader, context); if (property == null) { property = dataSource.property; - if (property != null) { + if (property!= null) { property.clear(); } else { - property = new ArrayList(); + property = new ArrayList<>(); } } property.add(propertyItem); - } else if (("login-timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("login-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: loginTimeout - final Integer loginTimeout = Integer.valueOf(elementReader.getElementAsString()); + Integer loginTimeout = Integer.valueOf(elementReader.getElementText()); dataSource.loginTimeout = loginTimeout; - } else if (("transactional" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("transactional" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: transactional - final Boolean transactional = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean transactional = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); dataSource.transactional = transactional; - } else if (("isolation-level" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("isolation-level" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: isolationLevel - final IsolationLevel isolationLevel = parseIsolationLevel(elementReader, context, elementReader.getElementAsString()); - if (isolationLevel != null) { + IsolationLevel isolationLevel = parseIsolationLevel(elementReader, context, elementReader.getElementText()); + if (isolationLevel!= null) { dataSource.isolationLevel = isolationLevel; } - } else if (("initial-pool-size" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("initial-pool-size" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: initialPoolSize - final Integer initialPoolSize = Integer.valueOf(elementReader.getElementAsString()); + Integer initialPoolSize = Integer.valueOf(elementReader.getElementText()); dataSource.initialPoolSize = initialPoolSize; - } else if (("max-pool-size" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("max-pool-size" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: maxPoolSize - final Integer maxPoolSize = Integer.valueOf(elementReader.getElementAsString()); + Integer maxPoolSize = Integer.valueOf(elementReader.getElementText()); dataSource.maxPoolSize = maxPoolSize; - } else if (("min-pool-size" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("min-pool-size" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: minPoolSize - final Integer minPoolSize = Integer.valueOf(elementReader.getElementAsString()); + Integer minPoolSize = Integer.valueOf(elementReader.getElementText()); dataSource.minPoolSize = minPoolSize; - } else if (("max-idle-time" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("max-idle-time" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: maxIdleTime - final Integer maxIdleTime = Integer.valueOf(elementReader.getElementAsString()); + Integer maxIdleTime = Integer.valueOf(elementReader.getElementText()); dataSource.maxIdleTime = maxIdleTime; - } else if (("max-statements" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("max-statements" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: maxStatements - final Integer maxStatements = Integer.valueOf(elementReader.getElementAsString()); + Integer maxStatements = Integer.valueOf(elementReader.getElementText()); dataSource.maxStatements = maxStatements; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "class-name"), new QName("http://java.sun.com/xml/ns/javaee", "server-name"), new QName("http://java.sun.com/xml/ns/javaee", "port-number"), new QName("http://java.sun.com/xml/ns/javaee", "database-name"), new QName("http://java.sun.com/xml/ns/javaee", "url"), new QName("http://java.sun.com/xml/ns/javaee", "user"), new QName("http://java.sun.com/xml/ns/javaee", "password"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "login-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "transactional"), new QName("http://java.sun.com/xml/ns/javaee", "isolation-level"), new QName("http://java.sun.com/xml/ns/javaee", "initial-pool-size"), new QName("http://java.sun.com/xml/ns/javaee", "max-pool-size"), new QName("http://java.sun.com/xml/ns/javaee", "min-pool-size"), new QName("http://java.sun.com/xml/ns/javaee", "max-idle-time"), new QName("http://java.sun.com/xml/ns/javaee", "max-statements")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - dataSource.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + dataSource.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, DataSource.class, "setDescriptions", Text[].class, e); } } - if (property != null) { + if (property!= null) { dataSource.property = property; } @@ -270,38 +276,40 @@ public final static DataSource _read(final XoXMLStreamReader reader, RuntimeCont return dataSource; } - public final DataSource read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final DataSource read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final DataSource dataSource, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, DataSource dataSource, RuntimeContext context) + throws Exception + { if (dataSource == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (DataSource.class != dataSource.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (DataSource.class!= dataSource.getClass()) { context.unexpectedSubclass(writer, dataSource, DataSource.class); - return; + return ; } context.beforeMarshal(dataSource, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = dataSource.id; - if (idRaw != null) { + String idRaw = dataSource.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(dataSource, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -311,12 +319,12 @@ public final static void _write(final XoXMLStreamWriter writer, final DataSource Text[] descriptions = null; try { descriptions = dataSource.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(dataSource, "descriptions", DataSource.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -325,14 +333,14 @@ public final static void _write(final XoXMLStreamWriter writer, final DataSource } // ELEMENT: name - final String nameRaw = dataSource.name; + String nameRaw = dataSource.name; String name = null; try { name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(dataSource, "name", CollapsedStringAdapter.class, String.class, String.class, e); } - if (name != null) { + if (name!= null) { writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(name); writer.writeEndElement(); @@ -341,103 +349,103 @@ public final static void _write(final XoXMLStreamWriter writer, final DataSource } // ELEMENT: className - final String classNameRaw = dataSource.className; + String classNameRaw = dataSource.className; String className = null; try { className = Adapters.collapsedStringAdapterAdapter.marshal(classNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(dataSource, "className", CollapsedStringAdapter.class, String.class, String.class, e); } - if (className != null) { + if (className!= null) { writer.writeStartElement(prefix, "class-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(className); writer.writeEndElement(); } // ELEMENT: serverName - final String serverNameRaw = dataSource.serverName; + String serverNameRaw = dataSource.serverName; String serverName = null; try { serverName = Adapters.collapsedStringAdapterAdapter.marshal(serverNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(dataSource, "serverName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (serverName != null) { + if (serverName!= null) { writer.writeStartElement(prefix, "server-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(serverName); writer.writeEndElement(); } // ELEMENT: portNumber - final Integer portNumber = dataSource.portNumber; - if (portNumber != null) { + Integer portNumber = dataSource.portNumber; + if (portNumber!= null) { writer.writeStartElement(prefix, "port-number", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(portNumber)); writer.writeEndElement(); } // ELEMENT: databaseName - final String databaseNameRaw = dataSource.databaseName; + String databaseNameRaw = dataSource.databaseName; String databaseName = null; try { databaseName = Adapters.collapsedStringAdapterAdapter.marshal(databaseNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(dataSource, "databaseName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (databaseName != null) { + if (databaseName!= null) { writer.writeStartElement(prefix, "database-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(databaseName); writer.writeEndElement(); } // ELEMENT: url - final String urlRaw = dataSource.url; + String urlRaw = dataSource.url; String url = null; try { url = Adapters.collapsedStringAdapterAdapter.marshal(urlRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(dataSource, "url", CollapsedStringAdapter.class, String.class, String.class, e); } - if (url != null) { + if (url!= null) { writer.writeStartElement(prefix, "url", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(url); writer.writeEndElement(); } // ELEMENT: user - final String userRaw = dataSource.user; + String userRaw = dataSource.user; String user = null; try { user = Adapters.collapsedStringAdapterAdapter.marshal(userRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(dataSource, "user", CollapsedStringAdapter.class, String.class, String.class, e); } - if (user != null) { + if (user!= null) { writer.writeStartElement(prefix, "user", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(user); writer.writeEndElement(); } // ELEMENT: password - final String passwordRaw = dataSource.password; + String passwordRaw = dataSource.password; String password = null; try { password = Adapters.collapsedStringAdapterAdapter.marshal(passwordRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(dataSource, "password", CollapsedStringAdapter.class, String.class, String.class, e); } - if (password != null) { + if (password!= null) { writer.writeStartElement(prefix, "password", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(password); writer.writeEndElement(); } // ELEMENT: property - final List property = dataSource.property; - if (property != null) { - for (final Property propertyItem : property) { + List property = dataSource.property; + if (property!= null) { + for (Property propertyItem: property) { writer.writeStartElement(prefix, "property", "http://java.sun.com/xml/ns/javaee"); - if (propertyItem != null) { + if (propertyItem!= null) { writeProperty(writer, propertyItem, context); } else { writer.writeXsiNil(); @@ -447,64 +455,64 @@ public final static void _write(final XoXMLStreamWriter writer, final DataSource } // ELEMENT: loginTimeout - final Integer loginTimeout = dataSource.loginTimeout; - if (loginTimeout != null) { + Integer loginTimeout = dataSource.loginTimeout; + if (loginTimeout!= null) { writer.writeStartElement(prefix, "login-timeout", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(loginTimeout)); writer.writeEndElement(); } // ELEMENT: transactional - final Boolean transactional = dataSource.transactional; - if (transactional != null) { + Boolean transactional = dataSource.transactional; + if (transactional!= null) { writer.writeStartElement(prefix, "transactional", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(transactional)); writer.writeEndElement(); } // ELEMENT: isolationLevel - final IsolationLevel isolationLevel = dataSource.isolationLevel; - if (isolationLevel != null) { + IsolationLevel isolationLevel = dataSource.isolationLevel; + if (isolationLevel!= null) { writer.writeStartElement(prefix, "isolation-level", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringIsolationLevel(dataSource, null, context, isolationLevel)); writer.writeEndElement(); } // ELEMENT: initialPoolSize - final Integer initialPoolSize = dataSource.initialPoolSize; - if (initialPoolSize != null) { + Integer initialPoolSize = dataSource.initialPoolSize; + if (initialPoolSize!= null) { writer.writeStartElement(prefix, "initial-pool-size", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(initialPoolSize)); writer.writeEndElement(); } // ELEMENT: maxPoolSize - final Integer maxPoolSize = dataSource.maxPoolSize; - if (maxPoolSize != null) { + Integer maxPoolSize = dataSource.maxPoolSize; + if (maxPoolSize!= null) { writer.writeStartElement(prefix, "max-pool-size", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(maxPoolSize)); writer.writeEndElement(); } // ELEMENT: minPoolSize - final Integer minPoolSize = dataSource.minPoolSize; - if (minPoolSize != null) { + Integer minPoolSize = dataSource.minPoolSize; + if (minPoolSize!= null) { writer.writeStartElement(prefix, "min-pool-size", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(minPoolSize)); writer.writeEndElement(); } // ELEMENT: maxIdleTime - final Integer maxIdleTime = dataSource.maxIdleTime; - if (maxIdleTime != null) { + Integer maxIdleTime = dataSource.maxIdleTime; + if (maxIdleTime!= null) { writer.writeStartElement(prefix, "max-idle-time", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(maxIdleTime)); writer.writeEndElement(); } // ELEMENT: maxStatements - final Integer maxStatements = dataSource.maxStatements; - if (maxStatements != null) { + Integer maxStatements = dataSource.maxStatements; + if (maxStatements!= null) { writer.writeStartElement(prefix, "max-statements", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(maxStatements)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Description$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Description$JAXB.java new file mode 100644 index 00000000000..94be15397d8 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Description$JAXB.java @@ -0,0 +1,185 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class Description$JAXB + extends JAXBObject +{ + + + public Description$JAXB() { + super(Description.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "descriptionType".intern())); + } + + public static Description readDescription(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeDescription(XoXMLStreamWriter writer, Description description, RuntimeContext context) + throws Exception + { + _write(writer, description, context); + } + + public void write(XoXMLStreamWriter writer, Description description, RuntimeContext context) + throws Exception + { + _write(writer, description, context); + } + + public static final Description _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + Description description = new Description(); + context.beforeUnmarshal(description, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("descriptionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, Description.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (("lang" == attribute.getLocalName())&&("http://www.w3.org/XML/1998/namespace" == attribute.getNamespace())) { + // ATTRIBUTE: lang + description.lang = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + } else if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: id + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + context.addXmlId(reader, id, description); + description.id = id; + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("http://www.w3.org/XML/1998/namespace", "lang"), new QName("", "id")); + } + } + + // VALUE: value + String valueRaw = reader.getElementText(); + + String value = null; + boolean valueConverted; + try { + value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); + valueConverted = true; + } catch (Exception e) { + context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); + valueConverted = false; + } + + if (valueConverted) { + description.value = value; + } + + context.afterUnmarshal(description, LifecycleCallback.NONE); + + return description; + } + + public final Description read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, Description description, RuntimeContext context) + throws Exception + { + if (description == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (Description.class!= description.getClass()) { + context.unexpectedSubclass(writer, description, Description.class); + return ; + } + + context.beforeMarshal(description, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = description.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(description, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ATTRIBUTE: lang + String langRaw = description.lang; + if (langRaw!= null) { + String lang = null; + try { + lang = Adapters.collapsedStringAdapterAdapter.marshal(langRaw); + } catch (Exception e) { + context.xmlAdapterError(description, "lang", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("xml", "http://www.w3.org/XML/1998/namespace", "lang", lang); + } + + // VALUE: value + String valueRaw = description.value; + String value = null; + try { + value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); + } catch (Exception e) { + context.xmlAdapterError(description, "value", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeCharacters(value); + + context.afterMarshal(description, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DestinationType$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DestinationType$JAXB.java index bcb736b698f..92444ef600c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DestinationType$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DestinationType$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class DestinationType$JAXB - extends JAXBObject { + extends JAXBObject +{ public DestinationType$JAXB() { super(DestinationType.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "destination-type".intern()), null); } - public static DestinationType readDestinationType(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static DestinationType readDestinationType(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeDestinationType(final XoXMLStreamWriter writer, final DestinationType destinationType, final RuntimeContext context) - throws Exception { + public static void writeDestinationType(XoXMLStreamWriter writer, DestinationType destinationType, RuntimeContext context) + throws Exception + { _write(writer, destinationType, context); } - public void write(final XoXMLStreamWriter writer, final DestinationType destinationType, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, DestinationType destinationType, RuntimeContext context) + throws Exception + { _write(writer, destinationType, context); } - public final static DestinationType _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final DestinationType _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,37 +70,37 @@ public final static DestinationType _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final DestinationType destinationType = new DestinationType(); + DestinationType destinationType = new DestinationType(); context.beforeUnmarshal(destinationType, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { return context.unexpectedXsiType(reader, DestinationType.class); } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, destinationType); destinationType.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id")); } } // VALUE: value - final String valueRaw = reader.getElementText(); + String valueRaw = reader.getElementText(); String value = null; boolean valueConverted; try { value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); valueConverted = true; - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); valueConverted = false; } @@ -109,48 +114,50 @@ public final static DestinationType _read(final XoXMLStreamReader reader, Runtim return destinationType; } - public final DestinationType read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final DestinationType read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final DestinationType destinationType, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, DestinationType destinationType, RuntimeContext context) + throws Exception + { if (destinationType == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (DestinationType.class != destinationType.getClass()) { + if (DestinationType.class!= destinationType.getClass()) { context.unexpectedSubclass(writer, destinationType, DestinationType.class); - return; + return ; } context.beforeMarshal(destinationType, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = destinationType.id; - if (idRaw != null) { + String idRaw = destinationType.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(destinationType, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // VALUE: value - final String valueRaw = destinationType.value; + String valueRaw = destinationType.value; String value = null; try { value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(destinationType, "value", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeCharacters(value); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Dispatcher$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Dispatcher$JAXB.java index 5451294109b..09b5e59253c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Dispatcher$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Dispatcher$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class Dispatcher$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public Dispatcher$JAXB() { super(Dispatcher.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "dispatcherType".intern())); } - public Dispatcher parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public Dispatcher parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseDispatcher(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final Dispatcher dispatcher) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, Dispatcher dispatcher) + throws Exception + { return toStringDispatcher(bean, parameterName, context, dispatcher); } - public static Dispatcher parseDispatcher(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static Dispatcher parseDispatcher(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("FORWARD".equals(value)) { return Dispatcher.FORWARD; } else if ("REQUEST".equals(value)) { @@ -58,8 +62,9 @@ public static Dispatcher parseDispatcher(final XoXMLStreamReader reader, final R } } - public static String toStringDispatcher(final Object bean, final String parameterName, final RuntimeContext context, final Dispatcher dispatcher) - throws Exception { + public static String toStringDispatcher(Object bean, String parameterName, RuntimeContext context, Dispatcher dispatcher) + throws Exception + { if (Dispatcher.FORWARD == dispatcher) { return "FORWARD"; } else if (Dispatcher.REQUEST == dispatcher) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DisplayName$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DisplayName$JAXB.java new file mode 100644 index 00000000000..6a317d27d25 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/DisplayName$JAXB.java @@ -0,0 +1,185 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class DisplayName$JAXB + extends JAXBObject +{ + + + public DisplayName$JAXB() { + super(DisplayName.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "display-nameType".intern())); + } + + public static DisplayName readDisplayName(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeDisplayName(XoXMLStreamWriter writer, DisplayName displayName, RuntimeContext context) + throws Exception + { + _write(writer, displayName, context); + } + + public void write(XoXMLStreamWriter writer, DisplayName displayName, RuntimeContext context) + throws Exception + { + _write(writer, displayName, context); + } + + public static final DisplayName _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + DisplayName displayName = new DisplayName(); + context.beforeUnmarshal(displayName, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("display-nameType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, DisplayName.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (("lang" == attribute.getLocalName())&&("http://www.w3.org/XML/1998/namespace" == attribute.getNamespace())) { + // ATTRIBUTE: lang + displayName.lang = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + } else if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: id + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + context.addXmlId(reader, id, displayName); + displayName.id = id; + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("http://www.w3.org/XML/1998/namespace", "lang"), new QName("", "id")); + } + } + + // VALUE: value + String valueRaw = reader.getElementText(); + + String value = null; + boolean valueConverted; + try { + value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); + valueConverted = true; + } catch (Exception e) { + context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); + valueConverted = false; + } + + if (valueConverted) { + displayName.value = value; + } + + context.afterUnmarshal(displayName, LifecycleCallback.NONE); + + return displayName; + } + + public final DisplayName read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, DisplayName displayName, RuntimeContext context) + throws Exception + { + if (displayName == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (DisplayName.class!= displayName.getClass()) { + context.unexpectedSubclass(writer, displayName, DisplayName.class); + return ; + } + + context.beforeMarshal(displayName, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = displayName.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(displayName, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ATTRIBUTE: lang + String langRaw = displayName.lang; + if (langRaw!= null) { + String lang = null; + try { + lang = Adapters.collapsedStringAdapterAdapter.marshal(langRaw); + } catch (Exception e) { + context.xmlAdapterError(displayName, "lang", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("xml", "http://www.w3.org/XML/1998/namespace", "lang", lang); + } + + // VALUE: value + String valueRaw = displayName.value; + String value = null; + try { + value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); + } catch (Exception e) { + context.xmlAdapterError(displayName, "value", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeCharacters(value); + + context.afterMarshal(displayName, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbJar$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbJar$JAXB.java index 606c0f47c7d..fd311d38350 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbJar$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbJar$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.AssemblyDescriptor$JAXB.readAssemblyDescriptor; import static org.apache.openejb.jee.AssemblyDescriptor$JAXB.writeAssemblyDescriptor; @@ -49,30 +50,35 @@ "StringEquality" }) public class EjbJar$JAXB - extends JAXBObject { + extends JAXBObject +{ public EjbJar$JAXB() { super(EjbJar.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "ejb-jar".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "ejb-jarType".intern()), Text$JAXB.class, Icon$JAXB.class, MessageDrivenBean$JAXB.class, SessionBean$JAXB.class, EntityBean$JAXB.class, Interceptors$JAXB.class, Relationships$JAXB.class, AssemblyDescriptor$JAXB.class); } - public static EjbJar readEjbJar(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static EjbJar readEjbJar(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeEjbJar(final XoXMLStreamWriter writer, final EjbJar ejbJar, final RuntimeContext context) - throws Exception { + public static void writeEjbJar(XoXMLStreamWriter writer, EjbJar ejbJar, RuntimeContext context) + throws Exception + { _write(writer, ejbJar, context); } - public void write(final XoXMLStreamWriter writer, final EjbJar ejbJar, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, EjbJar ejbJar, RuntimeContext context) + throws Exception + { _write(writer, ejbJar, context); } - public final static EjbJar _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final EjbJar _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -83,7 +89,7 @@ public final static EjbJar _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final EjbJar ejbJar = new EjbJar(); + EjbJar ejbJar = new EjbJar(); context.beforeUnmarshal(ejbJar, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -91,96 +97,96 @@ public final static EjbJar _read(final XoXMLStreamReader reader, RuntimeContext LocalCollection icon = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("ejb-jarType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("ejb-jarType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, EjbJar.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, ejbJar); ejbJar.id = id; - } else if (("metadata-complete" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("metadata-complete" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: metadataComplete - final Boolean metadataComplete = ("1".equals(attribute.getValue()) || "true".equals(attribute.getValue())); + Boolean metadataComplete = ("1".equals(attribute.getValue())||"true".equals(attribute.getValue())); ejbJar.metadataComplete = metadataComplete; - } else if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("version" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: version ejbJar.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "metadata-complete"), new QName("", "version")); } } // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("module-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("module-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: moduleName - final String moduleNameRaw = elementReader.getElementAsString(); + String moduleNameRaw = elementReader.getElementText(); - final String moduleName; + String moduleName; try { moduleName = Adapters.collapsedStringAdapterAdapter.unmarshal(moduleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } ejbJar.moduleName = moduleName; - } else if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: descriptions - final Text descriptionsItem = readText(elementReader, context); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = ejbJar.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("enterprise-beans" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("enterprise-beans" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT WRAPPER: enterpriseBeans _readEnterpriseBeans(elementReader, context, ejbJar); - } else if (("interceptors" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("interceptors" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: interceptors - final Interceptors interceptors = readInterceptors(elementReader, context); + Interceptors interceptors = readInterceptors(elementReader, context); ejbJar.interceptors = interceptors; - } else if (("relationships" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("relationships" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: relationships - final Relationships relationships = readRelationships(elementReader, context); + Relationships relationships = readRelationships(elementReader, context); ejbJar.relationships = relationships; - } else if (("assembly-descriptor" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("assembly-descriptor" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: assemblyDescriptor - final AssemblyDescriptor assemblyDescriptor = readAssemblyDescriptor(elementReader, context); + AssemblyDescriptor assemblyDescriptor = readAssemblyDescriptor(elementReader, context); ejbJar.assemblyDescriptor = assemblyDescriptor; - } else if (("ejb-client-jar" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-client-jar" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbClientJar - final String ejbClientJarRaw = elementReader.getElementAsString(); + String ejbClientJarRaw = elementReader.getElementText(); - final String ejbClientJar; + String ejbClientJar; try { ejbClientJar = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClientJarRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -190,21 +196,21 @@ public final static EjbJar _read(final XoXMLStreamReader reader, RuntimeContext context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "module-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", "enterprise-beans"), new QName("http://java.sun.com/xml/ns/javaee", "interceptors"), new QName("http://java.sun.com/xml/ns/javaee", "relationships"), new QName("http://java.sun.com/xml/ns/javaee", "assembly-descriptor"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-client-jar")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - ejbJar.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + ejbJar.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, EjbJar.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - ejbJar.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + ejbJar.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, EjbJar.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { ejbJar.icon = icon; } @@ -213,108 +219,111 @@ public final static EjbJar _read(final XoXMLStreamReader reader, RuntimeContext return ejbJar; } - public final EjbJar read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final EjbJar read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _readEnterpriseBeans(final XoXMLStreamReader reader, final RuntimeContext context, final EjbJar ejbJar) - throws Exception { + public static final void _readEnterpriseBeans(XoXMLStreamReader reader, RuntimeContext context, EjbJar ejbJar) + throws Exception + { ArrayList enterpriseBeans = null; // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("message-driven" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("message-driven" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: enterpriseBeans - final org.apache.openejb.jee.MessageDrivenBean enterpriseBeansItem = readMessageDrivenBean(elementReader, context); + org.apache.openejb.jee.MessageDrivenBean enterpriseBeansItem = readMessageDrivenBean(elementReader, context); if (enterpriseBeans == null) { - enterpriseBeans = new ArrayList(); + enterpriseBeans = new ArrayList<>(); } enterpriseBeans.add(enterpriseBeansItem); - } else if (("session" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("session" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: enterpriseBeans - final org.apache.openejb.jee.SessionBean enterpriseBeansItem1 = readSessionBean(elementReader, context); + org.apache.openejb.jee.SessionBean enterpriseBeansItem1 = readSessionBean(elementReader, context); if (enterpriseBeans == null) { - enterpriseBeans = new ArrayList(); + enterpriseBeans = new ArrayList<>(); } enterpriseBeans.add(enterpriseBeansItem1); - } else if (("entity" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("entity" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: enterpriseBeans - final org.apache.openejb.jee.EntityBean enterpriseBeansItem2 = readEntityBean(elementReader, context); + org.apache.openejb.jee.EntityBean enterpriseBeansItem2 = readEntityBean(elementReader, context); if (enterpriseBeans == null) { - enterpriseBeans = new ArrayList(); + enterpriseBeans = new ArrayList<>(); } enterpriseBeans.add(enterpriseBeansItem2); } } - if (enterpriseBeans != null) { + if (enterpriseBeans!= null) { try { - ejbJar.setEnterpriseBeans(enterpriseBeans.toArray(new EnterpriseBean[enterpriseBeans.size()])); - } catch (final Exception e) { + ejbJar.setEnterpriseBeans(enterpriseBeans.toArray(new EnterpriseBean[enterpriseBeans.size()] )); + } catch (Exception e) { context.setterError(reader, EjbJar.class, "setEnterpriseBeans", EnterpriseBean[].class, e); } } } - public final static void _write(final XoXMLStreamWriter writer, final EjbJar ejbJar, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, EjbJar ejbJar, RuntimeContext context) + throws Exception + { if (ejbJar == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (EjbJar.class != ejbJar.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (EjbJar.class!= ejbJar.getClass()) { context.unexpectedSubclass(writer, ejbJar, EjbJar.class); - return; + return ; } context.beforeMarshal(ejbJar, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = ejbJar.id; - if (idRaw != null) { + String idRaw = ejbJar.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbJar, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: metadataComplete - final Boolean metadataComplete = ejbJar.metadataComplete; - if (metadataComplete != null) { + Boolean metadataComplete = ejbJar.metadataComplete; + if (metadataComplete!= null) { writer.writeAttribute("", "", "metadata-complete", Boolean.toString(metadataComplete)); } // ATTRIBUTE: version - final String versionRaw = ejbJar.version; - if (versionRaw != null) { + String versionRaw = ejbJar.version; + if (versionRaw!= null) { String version = null; try { version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbJar, "version", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "version", version); } // ELEMENT: moduleName - final String moduleNameRaw = ejbJar.moduleName; + String moduleNameRaw = ejbJar.moduleName; String moduleName = null; try { moduleName = Adapters.collapsedStringAdapterAdapter.marshal(moduleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbJar, "moduleName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (moduleName != null) { + if (moduleName!= null) { writer.writeStartElement(prefix, "module-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(moduleName); writer.writeEndElement(); @@ -324,12 +333,12 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbJar ejb Text[] descriptions = null; try { descriptions = ejbJar.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(ejbJar, "descriptions", EjbJar.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -343,12 +352,12 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbJar ejb Text[] displayNames = null; try { displayNames = ejbJar.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(ejbJar, "displayNames", EjbJar.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -359,10 +368,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbJar ejb } // ELEMENT: icon - final LocalCollection icon = ejbJar.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = ejbJar.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -376,24 +385,24 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbJar ejb EnterpriseBean[] enterpriseBeans = null; try { enterpriseBeans = ejbJar.getEnterpriseBeans(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(ejbJar, "enterpriseBeans", EjbJar.class, "getEnterpriseBeans", e); } writer.writeStartElement(prefix, "enterprise-beans", "http://java.sun.com/xml/ns/javaee"); - if (enterpriseBeans != null) { - for (final EnterpriseBean enterpriseBeansItem : enterpriseBeans) { + if (enterpriseBeans!= null) { + for (EnterpriseBean enterpriseBeansItem: enterpriseBeans) { if (enterpriseBeansItem instanceof org.apache.openejb.jee.EntityBean) { - final org.apache.openejb.jee.EntityBean EntityBean = ((org.apache.openejb.jee.EntityBean) enterpriseBeansItem); + org.apache.openejb.jee.EntityBean EntityBean = ((org.apache.openejb.jee.EntityBean) enterpriseBeansItem); writer.writeStartElement(prefix, "entity", "http://java.sun.com/xml/ns/javaee"); writeEntityBean(writer, EntityBean, context); writer.writeEndElement(); } else if (enterpriseBeansItem instanceof org.apache.openejb.jee.SessionBean) { - final org.apache.openejb.jee.SessionBean SessionBean = ((org.apache.openejb.jee.SessionBean) enterpriseBeansItem); + org.apache.openejb.jee.SessionBean SessionBean = ((org.apache.openejb.jee.SessionBean) enterpriseBeansItem); writer.writeStartElement(prefix, "session", "http://java.sun.com/xml/ns/javaee"); writeSessionBean(writer, SessionBean, context); writer.writeEndElement(); } else if (enterpriseBeansItem instanceof org.apache.openejb.jee.MessageDrivenBean) { - final org.apache.openejb.jee.MessageDrivenBean MessageDrivenBean = ((org.apache.openejb.jee.MessageDrivenBean) enterpriseBeansItem); + org.apache.openejb.jee.MessageDrivenBean MessageDrivenBean = ((org.apache.openejb.jee.MessageDrivenBean) enterpriseBeansItem); writer.writeStartElement(prefix, "message-driven", "http://java.sun.com/xml/ns/javaee"); writeMessageDrivenBean(writer, MessageDrivenBean, context); writer.writeEndElement(); @@ -407,38 +416,38 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbJar ejb writer.writeEndElement(); // ELEMENT: interceptors - final Interceptors interceptors = ejbJar.interceptors; - if (interceptors != null) { + Interceptors interceptors = ejbJar.interceptors; + if (interceptors!= null) { writer.writeStartElement(prefix, "interceptors", "http://java.sun.com/xml/ns/javaee"); writeInterceptors(writer, interceptors, context); writer.writeEndElement(); } // ELEMENT: relationships - final Relationships relationships = ejbJar.relationships; - if (relationships != null) { + Relationships relationships = ejbJar.relationships; + if (relationships!= null) { writer.writeStartElement(prefix, "relationships", "http://java.sun.com/xml/ns/javaee"); writeRelationships(writer, relationships, context); writer.writeEndElement(); } // ELEMENT: assemblyDescriptor - final AssemblyDescriptor assemblyDescriptor = ejbJar.assemblyDescriptor; - if (assemblyDescriptor != null) { + AssemblyDescriptor assemblyDescriptor = ejbJar.assemblyDescriptor; + if (assemblyDescriptor!= null) { writer.writeStartElement(prefix, "assembly-descriptor", "http://java.sun.com/xml/ns/javaee"); writeAssemblyDescriptor(writer, assemblyDescriptor, context); writer.writeEndElement(); } // ELEMENT: ejbClientJar - final String ejbClientJarRaw = ejbJar.ejbClientJar; + String ejbClientJarRaw = ejbJar.ejbClientJar; String ejbClientJar = null; try { ejbClientJar = Adapters.collapsedStringAdapterAdapter.marshal(ejbClientJarRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbJar, "ejbClientJar", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbClientJar != null) { + if (ejbClientJar!= null) { writer.writeStartElement(prefix, "ejb-client-jar", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbClientJar); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbLocalRef$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbLocalRef$JAXB.java index 9f0eaf38f40..036b2b5c3d4 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbLocalRef$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbLocalRef$JAXB.java @@ -1,21 +1,28 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,12 +30,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; import static org.apache.openejb.jee.EjbRefType$JAXB.parseEjbRefType; import static org.apache.openejb.jee.EjbRefType$JAXB.toStringEjbRefType; @@ -41,30 +42,35 @@ "StringEquality" }) public class EjbLocalRef$JAXB - extends JAXBObject { + extends JAXBObject +{ public EjbLocalRef$JAXB() { super(EjbLocalRef.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "ejb-local-refType".intern()), Text$JAXB.class, EjbRefType$JAXB.class, InjectionTarget$JAXB.class); } - public static EjbLocalRef readEjbLocalRef(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static EjbLocalRef readEjbLocalRef(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeEjbLocalRef(final XoXMLStreamWriter writer, final EjbLocalRef ejbLocalRef, final RuntimeContext context) - throws Exception { + public static void writeEjbLocalRef(XoXMLStreamWriter writer, EjbLocalRef ejbLocalRef, RuntimeContext context) + throws Exception + { _write(writer, ejbLocalRef, context); } - public void write(final XoXMLStreamWriter writer, final EjbLocalRef ejbLocalRef, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, EjbLocalRef ejbLocalRef, RuntimeContext context) + throws Exception + { _write(writer, ejbLocalRef, context); } - public final static EjbLocalRef _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final EjbLocalRef _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -75,132 +81,132 @@ public final static EjbLocalRef _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final EjbLocalRef ejbLocalRef = new EjbLocalRef(); + EjbLocalRef ejbLocalRef = new EjbLocalRef(); context.beforeUnmarshal(ejbLocalRef, LifecycleCallback.NONE); ArrayList descriptions = null; Set 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())) { + 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))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("ejb-ref-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-ref-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRefName - final String ejbRefNameRaw = elementReader.getElementAsString(); + String ejbRefNameRaw = elementReader.getElementText(); - final String ejbRefName; + String ejbRefName; try { ejbRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbRefNameRaw); - } catch (final Exception e) { + } catch (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())) { + } 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) { + EjbRefType ejbRefType = parseEjbRefType(elementReader, context, elementReader.getElementText()); + if (ejbRefType!= null) { ejbLocalRef.ejbRefType = ejbRefType; } - } else if (("local-home" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("local-home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: localHome - final String localHomeRaw = elementReader.getElementAsString(); + String localHomeRaw = elementReader.getElementText(); - final String localHome; + String localHome; try { localHome = Adapters.collapsedStringAdapterAdapter.unmarshal(localHomeRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: local - final String localRaw = elementReader.getElementAsString(); + String localRaw = elementReader.getElementText(); - final String local; + String local; try { local = Adapters.collapsedStringAdapterAdapter.unmarshal(localRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("ejb-link" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbLink - final String ejbLinkRaw = elementReader.getElementAsString(); + String ejbLinkRaw = elementReader.getElementText(); - final String ejbLink; + String ejbLink; try { ejbLink = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbLinkRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("injection-target" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: injectionTarget - final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); + InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); if (injectionTarget == null) { injectionTarget = ejbLocalRef.injectionTarget; - if (injectionTarget != null) { + if (injectionTarget!= null) { injectionTarget.clear(); } else { - injectionTarget = new LinkedHashSet(); + injectionTarget = new LinkedHashSet<>(); } } injectionTarget.add(injectionTargetItem); - } else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lookup-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lookupName - final String lookupNameRaw = elementReader.getElementAsString(); + String lookupNameRaw = elementReader.getElementText(); - final String lookupName; + String lookupName; try { lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -210,14 +216,14 @@ public final static EjbLocalRef _read(final XoXMLStreamReader reader, RuntimeCon 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) { + if (descriptions!= null) { try { - ejbLocalRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + ejbLocalRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, EjbLocalRef.class, "setDescriptions", Text[].class, e); } } - if (injectionTarget != null) { + if (injectionTarget!= null) { ejbLocalRef.injectionTarget = injectionTarget; } @@ -226,38 +232,40 @@ public final static EjbLocalRef _read(final XoXMLStreamReader reader, RuntimeCon return ejbLocalRef; } - public final EjbLocalRef read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final EjbLocalRef read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final EjbLocalRef ejbLocalRef, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, EjbLocalRef ejbLocalRef, RuntimeContext context) + throws Exception + { if (ejbLocalRef == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (EjbLocalRef.class != ejbLocalRef.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (EjbLocalRef.class!= ejbLocalRef.getClass()) { context.unexpectedSubclass(writer, ejbLocalRef, EjbLocalRef.class); - return; + return ; } context.beforeMarshal(ejbLocalRef, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = ejbLocalRef.id; - if (idRaw != null) { + String idRaw = ejbLocalRef.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbLocalRef, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -267,12 +275,12 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbLocalRe Text[] descriptions = null; try { descriptions = ejbLocalRef.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(ejbLocalRef, "descriptions", EjbLocalRef.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -283,14 +291,14 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbLocalRe } // ELEMENT: ejbRefName - final String ejbRefNameRaw = ejbLocalRef.ejbRefName; + String ejbRefNameRaw = ejbLocalRef.ejbRefName; String ejbRefName = null; try { ejbRefName = Adapters.collapsedStringAdapterAdapter.marshal(ejbRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbLocalRef, "ejbRefName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbRefName != null) { + if (ejbRefName!= null) { writer.writeStartElement(prefix, "ejb-ref-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbRefName); writer.writeEndElement(); @@ -299,74 +307,74 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbLocalRe } // ELEMENT: ejbRefType - final EjbRefType ejbRefType = ejbLocalRef.ejbRefType; - if (ejbRefType != null) { + EjbRefType ejbRefType = ejbLocalRef.ejbRefType; + if (ejbRefType!= null) { writer.writeStartElement(prefix, "ejb-ref-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringEjbRefType(ejbLocalRef, null, context, ejbRefType)); writer.writeEndElement(); } // ELEMENT: localHome - final String localHomeRaw = ejbLocalRef.localHome; + String localHomeRaw = ejbLocalRef.localHome; String localHome = null; try { localHome = Adapters.collapsedStringAdapterAdapter.marshal(localHomeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbLocalRef, "localHome", CollapsedStringAdapter.class, String.class, String.class, e); } - if (localHome != null) { + if (localHome!= null) { writer.writeStartElement(prefix, "local-home", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(localHome); writer.writeEndElement(); } // ELEMENT: local - final String localRaw = ejbLocalRef.local; + String localRaw = ejbLocalRef.local; String local = null; try { local = Adapters.collapsedStringAdapterAdapter.marshal(localRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbLocalRef, "local", CollapsedStringAdapter.class, String.class, String.class, e); } - if (local != null) { + if (local!= null) { writer.writeStartElement(prefix, "local", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(local); writer.writeEndElement(); } // ELEMENT: ejbLink - final String ejbLinkRaw = ejbLocalRef.ejbLink; + String ejbLinkRaw = ejbLocalRef.ejbLink; String ejbLink = null; try { ejbLink = Adapters.collapsedStringAdapterAdapter.marshal(ejbLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbLocalRef, "ejbLink", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbLink != null) { + if (ejbLink!= null) { writer.writeStartElement(prefix, "ejb-link", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbLink); writer.writeEndElement(); } // ELEMENT: mappedName - final String mappedNameRaw = ejbLocalRef.mappedName; + String mappedNameRaw = ejbLocalRef.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbLocalRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + 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 = ejbLocalRef.injectionTarget; - if (injectionTarget != null) { - for (final InjectionTarget injectionTargetItem : injectionTarget) { - if (injectionTargetItem != null) { + Set injectionTarget = ejbLocalRef.injectionTarget; + if (injectionTarget!= null) { + for (InjectionTarget injectionTargetItem: injectionTarget) { + if (injectionTargetItem!= null) { writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee"); writeInjectionTarget(writer, injectionTargetItem, context); writer.writeEndElement(); @@ -377,14 +385,14 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbLocalRe } // ELEMENT: lookupName - final String lookupNameRaw = ejbLocalRef.lookupName; + String lookupNameRaw = ejbLocalRef.lookupName; String lookupName = null; try { lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbLocalRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lookupName != null) { + if (lookupName!= null) { writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lookupName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRef$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRef$JAXB.java index f1127598521..23a264f44b9 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRef$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRef$JAXB.java @@ -1,21 +1,28 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,12 +30,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; import static org.apache.openejb.jee.EjbRefType$JAXB.parseEjbRefType; import static org.apache.openejb.jee.EjbRefType$JAXB.toStringEjbRefType; @@ -41,30 +42,35 @@ "StringEquality" }) public class EjbRef$JAXB - extends JAXBObject { + extends JAXBObject +{ public EjbRef$JAXB() { super(EjbRef.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "ejb-refType".intern()), Text$JAXB.class, EjbRefType$JAXB.class, InjectionTarget$JAXB.class); } - public static EjbRef readEjbRef(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static EjbRef readEjbRef(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeEjbRef(final XoXMLStreamWriter writer, final EjbRef ejbRef, final RuntimeContext context) - throws Exception { + public static void writeEjbRef(XoXMLStreamWriter writer, EjbRef ejbRef, RuntimeContext context) + throws Exception + { _write(writer, ejbRef, context); } - public void write(final XoXMLStreamWriter writer, final EjbRef ejbRef, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, EjbRef ejbRef, RuntimeContext context) + throws Exception + { _write(writer, ejbRef, context); } - public final static EjbRef _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final EjbRef _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -75,132 +81,132 @@ public final static EjbRef _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final EjbRef ejbRef = new EjbRef(); + EjbRef ejbRef = new EjbRef(); context.beforeUnmarshal(ejbRef, LifecycleCallback.NONE); ArrayList descriptions = null; Set injectionTarget = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("ejb-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("ejb-refType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, EjbRef.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, ejbRef); ejbRef.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("ejb-ref-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-ref-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRefName - final String ejbRefNameRaw = elementReader.getElementAsString(); + String ejbRefNameRaw = elementReader.getElementText(); - final String ejbRefName; + String ejbRefName; try { ejbRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } ejbRef.ejbRefName = ejbRefName; - } else if (("ejb-ref-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } 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) { + EjbRefType ejbRefType = parseEjbRefType(elementReader, context, elementReader.getElementText()); + if (ejbRefType!= null) { ejbRef.ejbRefType = ejbRefType; } - } else if (("home" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: home - final String homeRaw = elementReader.getElementAsString(); + String homeRaw = elementReader.getElementText(); - final String home; + String home; try { home = Adapters.collapsedStringAdapterAdapter.unmarshal(homeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } ejbRef.home = home; - } else if (("remote" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: remote - final String remoteRaw = elementReader.getElementAsString(); + String remoteRaw = elementReader.getElementText(); - final String remote; + String remote; try { remote = Adapters.collapsedStringAdapterAdapter.unmarshal(remoteRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } ejbRef.remote = remote; - } else if (("ejb-link" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-link" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbLink - final String ejbLinkRaw = elementReader.getElementAsString(); + String ejbLinkRaw = elementReader.getElementText(); - final String ejbLink; + String ejbLink; try { ejbLink = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } ejbRef.ejbLink = ejbLink; - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } ejbRef.mappedName = mappedName; - } else if (("injection-target" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("injection-target" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: injectionTarget - final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); + InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); if (injectionTarget == null) { injectionTarget = ejbRef.injectionTarget; - if (injectionTarget != null) { + if (injectionTarget!= null) { injectionTarget.clear(); } else { - injectionTarget = new LinkedHashSet(); + injectionTarget = new LinkedHashSet<>(); } } injectionTarget.add(injectionTargetItem); - } else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lookup-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lookupName - final String lookupNameRaw = elementReader.getElementAsString(); + String lookupNameRaw = elementReader.getElementText(); - final String lookupName; + String lookupName; try { lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -210,14 +216,14 @@ public final static EjbRef _read(final XoXMLStreamReader reader, RuntimeContext 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", "home"), new QName("http://java.sun.com/xml/ns/javaee", "remote"), 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) { + if (descriptions!= null) { try { - ejbRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + ejbRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, EjbRef.class, "setDescriptions", Text[].class, e); } } - if (injectionTarget != null) { + if (injectionTarget!= null) { ejbRef.injectionTarget = injectionTarget; } @@ -226,38 +232,40 @@ public final static EjbRef _read(final XoXMLStreamReader reader, RuntimeContext return ejbRef; } - public final EjbRef read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final EjbRef read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final EjbRef ejbRef, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, EjbRef ejbRef, RuntimeContext context) + throws Exception + { if (ejbRef == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (EjbRef.class != ejbRef.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (EjbRef.class!= ejbRef.getClass()) { context.unexpectedSubclass(writer, ejbRef, EjbRef.class); - return; + return ; } context.beforeMarshal(ejbRef, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = ejbRef.id; - if (idRaw != null) { + String idRaw = ejbRef.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbRef, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -267,12 +275,12 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbRef ejb Text[] descriptions = null; try { descriptions = ejbRef.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(ejbRef, "descriptions", EjbRef.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -283,14 +291,14 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbRef ejb } // ELEMENT: ejbRefName - final String ejbRefNameRaw = ejbRef.ejbRefName; + String ejbRefNameRaw = ejbRef.ejbRefName; String ejbRefName = null; try { ejbRefName = Adapters.collapsedStringAdapterAdapter.marshal(ejbRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbRef, "ejbRefName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbRefName != null) { + if (ejbRefName!= null) { writer.writeStartElement(prefix, "ejb-ref-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbRefName); writer.writeEndElement(); @@ -299,74 +307,74 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbRef ejb } // ELEMENT: ejbRefType - final EjbRefType ejbRefType = ejbRef.ejbRefType; - if (ejbRefType != null) { + EjbRefType ejbRefType = ejbRef.ejbRefType; + if (ejbRefType!= null) { writer.writeStartElement(prefix, "ejb-ref-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringEjbRefType(ejbRef, null, context, ejbRefType)); writer.writeEndElement(); } // ELEMENT: home - final String homeRaw = ejbRef.home; + String homeRaw = ejbRef.home; String home = null; try { home = Adapters.collapsedStringAdapterAdapter.marshal(homeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbRef, "home", CollapsedStringAdapter.class, String.class, String.class, e); } - if (home != null) { + if (home!= null) { writer.writeStartElement(prefix, "home", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(home); writer.writeEndElement(); } // ELEMENT: remote - final String remoteRaw = ejbRef.remote; + String remoteRaw = ejbRef.remote; String remote = null; try { remote = Adapters.collapsedStringAdapterAdapter.marshal(remoteRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbRef, "remote", CollapsedStringAdapter.class, String.class, String.class, e); } - if (remote != null) { + if (remote!= null) { writer.writeStartElement(prefix, "remote", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(remote); writer.writeEndElement(); } // ELEMENT: ejbLink - final String ejbLinkRaw = ejbRef.ejbLink; + String ejbLinkRaw = ejbRef.ejbLink; String ejbLink = null; try { ejbLink = Adapters.collapsedStringAdapterAdapter.marshal(ejbLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbRef, "ejbLink", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbLink != null) { + if (ejbLink!= null) { writer.writeStartElement(prefix, "ejb-link", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbLink); writer.writeEndElement(); } // ELEMENT: mappedName - final String mappedNameRaw = ejbRef.mappedName; + String mappedNameRaw = ejbRef.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + 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 = ejbRef.injectionTarget; - if (injectionTarget != null) { - for (final InjectionTarget injectionTargetItem : injectionTarget) { - if (injectionTargetItem != null) { + Set injectionTarget = ejbRef.injectionTarget; + if (injectionTarget!= null) { + for (InjectionTarget injectionTargetItem: injectionTarget) { + if (injectionTargetItem!= null) { writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee"); writeInjectionTarget(writer, injectionTargetItem, context); writer.writeEndElement(); @@ -377,14 +385,14 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbRef ejb } // ELEMENT: lookupName - final String lookupNameRaw = ejbRef.lookupName; + String lookupNameRaw = ejbRef.lookupName; String lookupName = null; try { lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lookupName != null) { + if (lookupName!= null) { writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lookupName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRefType$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRefType$JAXB.java index 5e368a1131b..c2a521b9f0b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRefType$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRefType$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class EjbRefType$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public EjbRefType$JAXB() { super(EjbRefType.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "ejbRefType".intern())); } - public EjbRefType parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public EjbRefType parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseEjbRefType(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final EjbRefType ejbRefType) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, EjbRefType ejbRefType) + throws Exception + { return toStringEjbRefType(bean, parameterName, context, ejbRefType); } - public static EjbRefType parseEjbRefType(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static EjbRefType parseEjbRefType(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Entity".equals(value)) { return EjbRefType.ENTITY; } else if ("Session".equals(value)) { @@ -52,8 +56,9 @@ public static EjbRefType parseEjbRefType(final XoXMLStreamReader reader, final R } } - public static String toStringEjbRefType(final Object bean, final String parameterName, final RuntimeContext context, final EjbRefType ejbRefType) - throws Exception { + public static String toStringEjbRefType(Object bean, String parameterName, RuntimeContext context, EjbRefType ejbRefType) + throws Exception + { if (EjbRefType.ENTITY == ejbRefType) { return "Entity"; } else if (EjbRefType.SESSION == ejbRefType) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRelation$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRelation$JAXB.java index d97fc1c8030..86cdc0dcb2c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRelation$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRelation$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.EjbRelationshipRole$JAXB.readEjbRelationshipRole; import static org.apache.openejb.jee.EjbRelationshipRole$JAXB.writeEjbRelationshipRole; @@ -38,30 +39,35 @@ "StringEquality" }) public class EjbRelation$JAXB - extends JAXBObject { + extends JAXBObject +{ public EjbRelation$JAXB() { super(EjbRelation.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "ejb-relationType".intern()), Text$JAXB.class, EjbRelationshipRole$JAXB.class); } - public static EjbRelation readEjbRelation(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static EjbRelation readEjbRelation(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeEjbRelation(final XoXMLStreamWriter writer, final EjbRelation ejbRelation, final RuntimeContext context) - throws Exception { + public static void writeEjbRelation(XoXMLStreamWriter writer, EjbRelation ejbRelation, RuntimeContext context) + throws Exception + { _write(writer, ejbRelation, context); } - public void write(final XoXMLStreamWriter writer, final EjbRelation ejbRelation, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, EjbRelation ejbRelation, RuntimeContext context) + throws Exception + { _write(writer, ejbRelation, context); } - public final static EjbRelation _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final EjbRelation _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,63 +78,63 @@ public final static EjbRelation _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final EjbRelation ejbRelation = new EjbRelation(); + EjbRelation ejbRelation = new EjbRelation(); context.beforeUnmarshal(ejbRelation, LifecycleCallback.NONE); ArrayList descriptions = null; List ejbRelationshipRole = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("ejb-relationType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("ejb-relationType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, EjbRelation.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, ejbRelation); ejbRelation.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("ejb-relation-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-relation-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRelationName - final String ejbRelationNameRaw = elementReader.getElementAsString(); + String ejbRelationNameRaw = elementReader.getElementText(); - final String ejbRelationName; + String ejbRelationName; try { ejbRelationName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbRelationNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } ejbRelation.ejbRelationName = ejbRelationName; - } else if (("ejb-relationship-role" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-relationship-role" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRelationshipRole - final EjbRelationshipRole ejbRelationshipRoleItem = readEjbRelationshipRole(elementReader, context); + EjbRelationshipRole ejbRelationshipRoleItem = readEjbRelationshipRole(elementReader, context); if (ejbRelationshipRole == null) { ejbRelationshipRole = ejbRelation.ejbRelationshipRole; - if (ejbRelationshipRole != null) { + if (ejbRelationshipRole!= null) { ejbRelationshipRole.clear(); } else { - ejbRelationshipRole = new ArrayList(); + ejbRelationshipRole = new ArrayList<>(); } } ejbRelationshipRole.add(ejbRelationshipRoleItem); @@ -136,14 +142,14 @@ public final static EjbRelation _read(final XoXMLStreamReader reader, RuntimeCon context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-relation-name"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-relationship-role")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - ejbRelation.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + ejbRelation.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, EjbRelation.class, "setDescriptions", Text[].class, e); } } - if (ejbRelationshipRole != null) { + if (ejbRelationshipRole!= null) { ejbRelation.ejbRelationshipRole = ejbRelationshipRole; } @@ -152,38 +158,40 @@ public final static EjbRelation _read(final XoXMLStreamReader reader, RuntimeCon return ejbRelation; } - public final EjbRelation read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final EjbRelation read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final EjbRelation ejbRelation, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, EjbRelation ejbRelation, RuntimeContext context) + throws Exception + { if (ejbRelation == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (EjbRelation.class != ejbRelation.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (EjbRelation.class!= ejbRelation.getClass()) { context.unexpectedSubclass(writer, ejbRelation, EjbRelation.class); - return; + return ; } context.beforeMarshal(ejbRelation, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = ejbRelation.id; - if (idRaw != null) { + String idRaw = ejbRelation.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbRelation, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -193,12 +201,12 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbRelatio Text[] descriptions = null; try { descriptions = ejbRelation.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(ejbRelation, "descriptions", EjbRelation.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -209,24 +217,24 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbRelatio } // ELEMENT: ejbRelationName - final String ejbRelationNameRaw = ejbRelation.ejbRelationName; + String ejbRelationNameRaw = ejbRelation.ejbRelationName; String ejbRelationName = null; try { ejbRelationName = Adapters.collapsedStringAdapterAdapter.marshal(ejbRelationNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbRelation, "ejbRelationName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbRelationName != null) { + if (ejbRelationName!= null) { writer.writeStartElement(prefix, "ejb-relation-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbRelationName); writer.writeEndElement(); } // ELEMENT: ejbRelationshipRole - final List ejbRelationshipRole = ejbRelation.ejbRelationshipRole; - if (ejbRelationshipRole != null) { - for (final EjbRelationshipRole ejbRelationshipRoleItem : ejbRelationshipRole) { - if (ejbRelationshipRoleItem != null) { + List ejbRelationshipRole = ejbRelation.ejbRelationshipRole; + if (ejbRelationshipRole!= null) { + for (EjbRelationshipRole ejbRelationshipRoleItem: ejbRelationshipRole) { + if (ejbRelationshipRoleItem!= null) { writer.writeStartElement(prefix, "ejb-relationship-role", "http://java.sun.com/xml/ns/javaee"); writeEjbRelationshipRole(writer, ejbRelationshipRoleItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRelationshipRole$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRelationshipRole$JAXB.java index 2163eae7bfd..d457194a462 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRelationshipRole$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EjbRelationshipRole$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.CmrField$JAXB.readCmrField; import static org.apache.openejb.jee.CmrField$JAXB.writeCmrField; @@ -43,30 +44,35 @@ "StringEquality" }) public class EjbRelationshipRole$JAXB - extends JAXBObject { + extends JAXBObject +{ public EjbRelationshipRole$JAXB() { super(EjbRelationshipRole.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "ejb-relationship-roleType".intern()), Text$JAXB.class, Multiplicity$JAXB.class, Empty$JAXB.class, RelationshipRoleSource$JAXB.class, CmrField$JAXB.class); } - public static EjbRelationshipRole readEjbRelationshipRole(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static EjbRelationshipRole readEjbRelationshipRole(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeEjbRelationshipRole(final XoXMLStreamWriter writer, final EjbRelationshipRole ejbRelationshipRole, final RuntimeContext context) - throws Exception { + public static void writeEjbRelationshipRole(XoXMLStreamWriter writer, EjbRelationshipRole ejbRelationshipRole, RuntimeContext context) + throws Exception + { _write(writer, ejbRelationshipRole, context); } - public void write(final XoXMLStreamWriter writer, final EjbRelationshipRole ejbRelationshipRole, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, EjbRelationshipRole ejbRelationshipRole, RuntimeContext context) + throws Exception + { _write(writer, ejbRelationshipRole, context); } - public final static EjbRelationshipRole _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final EjbRelationshipRole _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -77,79 +83,79 @@ public final static EjbRelationshipRole _read(final XoXMLStreamReader reader, Ru context = new RuntimeContext(); } - final EjbRelationshipRole ejbRelationshipRole = new EjbRelationshipRole(); + EjbRelationshipRole ejbRelationshipRole = new EjbRelationshipRole(); context.beforeUnmarshal(ejbRelationshipRole, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("ejb-relationship-roleType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("ejb-relationship-roleType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, EjbRelationshipRole.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, ejbRelationshipRole); ejbRelationshipRole.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("ejb-relationship-role-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-relationship-role-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRelationshipRoleName - final String ejbRelationshipRoleNameRaw = elementReader.getElementAsString(); + String ejbRelationshipRoleNameRaw = elementReader.getElementText(); - final String ejbRelationshipRoleName; + String ejbRelationshipRoleName; try { ejbRelationshipRoleName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbRelationshipRoleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } ejbRelationshipRole.ejbRelationshipRoleName = ejbRelationshipRoleName; - } else if (("multiplicity" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("multiplicity" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: multiplicity - final Multiplicity multiplicity = parseMultiplicity(elementReader, context, elementReader.getElementAsString()); - if (multiplicity != null) { + Multiplicity multiplicity = parseMultiplicity(elementReader, context, elementReader.getElementText()); + if (multiplicity!= null) { ejbRelationshipRole.multiplicity = multiplicity; } - } else if (("cascade-delete" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("cascade-delete" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: cascadeDelete - final Empty cascadeDelete = readEmpty(elementReader, context); + Empty cascadeDelete = readEmpty(elementReader, context); ejbRelationshipRole.cascadeDelete = cascadeDelete; - } else if (("relationship-role-source" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("relationship-role-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: relationshipRoleSource - final RelationshipRoleSource relationshipRoleSource = readRelationshipRoleSource(elementReader, context); + RelationshipRoleSource relationshipRoleSource = readRelationshipRoleSource(elementReader, context); ejbRelationshipRole.relationshipRoleSource = relationshipRoleSource; - } else if (("cmr-field" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("cmr-field" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: cmrField - final CmrField cmrField = readCmrField(elementReader, context); + CmrField cmrField = readCmrField(elementReader, context); ejbRelationshipRole.cmrField = cmrField; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-relationship-role-name"), new QName("http://java.sun.com/xml/ns/javaee", "multiplicity"), new QName("http://java.sun.com/xml/ns/javaee", "cascade-delete"), new QName("http://java.sun.com/xml/ns/javaee", "relationship-role-source"), new QName("http://java.sun.com/xml/ns/javaee", "cmr-field")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - ejbRelationshipRole.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + ejbRelationshipRole.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, EjbRelationshipRole.class, "setDescriptions", Text[].class, e); } } @@ -159,38 +165,40 @@ public final static EjbRelationshipRole _read(final XoXMLStreamReader reader, Ru return ejbRelationshipRole; } - public final EjbRelationshipRole read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final EjbRelationshipRole read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final EjbRelationshipRole ejbRelationshipRole, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, EjbRelationshipRole ejbRelationshipRole, RuntimeContext context) + throws Exception + { if (ejbRelationshipRole == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (EjbRelationshipRole.class != ejbRelationshipRole.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (EjbRelationshipRole.class!= ejbRelationshipRole.getClass()) { context.unexpectedSubclass(writer, ejbRelationshipRole, EjbRelationshipRole.class); - return; + return ; } context.beforeMarshal(ejbRelationshipRole, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = ejbRelationshipRole.id; - if (idRaw != null) { + String idRaw = ejbRelationshipRole.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbRelationshipRole, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -200,12 +208,12 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbRelatio Text[] descriptions = null; try { descriptions = ejbRelationshipRole.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(ejbRelationshipRole, "descriptions", EjbRelationshipRole.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -216,22 +224,22 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbRelatio } // ELEMENT: ejbRelationshipRoleName - final String ejbRelationshipRoleNameRaw = ejbRelationshipRole.ejbRelationshipRoleName; + String ejbRelationshipRoleNameRaw = ejbRelationshipRole.ejbRelationshipRoleName; String ejbRelationshipRoleName = null; try { ejbRelationshipRoleName = Adapters.collapsedStringAdapterAdapter.marshal(ejbRelationshipRoleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(ejbRelationshipRole, "ejbRelationshipRoleName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbRelationshipRoleName != null) { + if (ejbRelationshipRoleName!= null) { writer.writeStartElement(prefix, "ejb-relationship-role-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbRelationshipRoleName); writer.writeEndElement(); } // ELEMENT: multiplicity - final Multiplicity multiplicity = ejbRelationshipRole.multiplicity; - if (multiplicity != null) { + Multiplicity multiplicity = ejbRelationshipRole.multiplicity; + if (multiplicity!= null) { writer.writeStartElement(prefix, "multiplicity", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringMultiplicity(ejbRelationshipRole, null, context, multiplicity)); writer.writeEndElement(); @@ -240,16 +248,16 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbRelatio } // ELEMENT: cascadeDelete - final Empty cascadeDelete = ejbRelationshipRole.cascadeDelete; - if (cascadeDelete != null) { + Empty cascadeDelete = ejbRelationshipRole.cascadeDelete; + if (cascadeDelete!= null) { writer.writeStartElement(prefix, "cascade-delete", "http://java.sun.com/xml/ns/javaee"); writeEmpty(writer, cascadeDelete, context); writer.writeEndElement(); } // ELEMENT: relationshipRoleSource - final RelationshipRoleSource relationshipRoleSource = ejbRelationshipRole.relationshipRoleSource; - if (relationshipRoleSource != null) { + RelationshipRoleSource relationshipRoleSource = ejbRelationshipRole.relationshipRoleSource; + if (relationshipRoleSource!= null) { writer.writeStartElement(prefix, "relationship-role-source", "http://java.sun.com/xml/ns/javaee"); writeRelationshipRoleSource(writer, relationshipRoleSource, context); writer.writeEndElement(); @@ -258,8 +266,8 @@ public final static void _write(final XoXMLStreamWriter writer, final EjbRelatio } // ELEMENT: cmrField - final CmrField cmrField = ejbRelationshipRole.cmrField; - if (cmrField != null) { + CmrField cmrField = ejbRelationshipRole.cmrField; + if (cmrField!= null) { writer.writeStartElement(prefix, "cmr-field", "http://java.sun.com/xml/ns/javaee"); writeCmrField(writer, cmrField, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Empty$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Empty$JAXB.java index 417c1da84d1..b0e94a8ce2e 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Empty$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Empty$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class Empty$JAXB - extends JAXBObject { + extends JAXBObject +{ public Empty$JAXB() { super(Empty.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "emptyType".intern())); } - public static Empty readEmpty(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Empty readEmpty(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeEmpty(final XoXMLStreamWriter writer, final Empty empty, final RuntimeContext context) - throws Exception { + public static void writeEmpty(XoXMLStreamWriter writer, Empty empty, RuntimeContext context) + throws Exception + { _write(writer, empty, context); } - public void write(final XoXMLStreamWriter writer, final Empty empty, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Empty empty, RuntimeContext context) + throws Exception + { _write(writer, empty, context); } - public final static Empty _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Empty _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,32 +70,32 @@ public final static Empty _read(final XoXMLStreamReader reader, RuntimeContext c context = new RuntimeContext(); } - final Empty empty = new Empty(); + Empty empty = new Empty(); context.beforeUnmarshal(empty, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("emptyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("emptyType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Empty.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, empty); empty.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { context.unexpectedElement(elementReader); } @@ -99,37 +104,39 @@ public final static Empty _read(final XoXMLStreamReader reader, RuntimeContext c return empty; } - public final Empty read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Empty read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Empty empty, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Empty empty, RuntimeContext context) + throws Exception + { if (empty == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (Empty.class != empty.getClass()) { + if (Empty.class!= empty.getClass()) { context.unexpectedSubclass(writer, empty, Empty.class); - return; + return ; } context.beforeMarshal(empty, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = empty.id; - if (idRaw != null) { + String idRaw = empty.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(empty, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EntityBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EntityBean$JAXB.java index 70e23ff4efe..c459486b311 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EntityBean$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EntityBean$JAXB.java @@ -1,37 +1,41 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.CmpField$JAXB.readCmpField; import static org.apache.openejb.jee.CmpField$JAXB.writeCmpField; import static org.apache.openejb.jee.CmpVersion$JAXB.parseCmpVersion; import static org.apache.openejb.jee.CmpVersion$JAXB.toStringCmpVersion; +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; @@ -42,6 +46,10 @@ import static org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback; import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef; @@ -71,30 +79,36 @@ "StringEquality" }) public class EntityBean$JAXB - extends JAXBObject { + extends JAXBObject +{ + private static final FieldAccessor> entityBeanContextService = new FieldAccessor<>(EntityBean.class, "contextService"); public EntityBean$JAXB() { - super(EntityBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "entity-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, PersistenceType$JAXB.class, CmpVersion$JAXB.class, CmpField$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, Query$JAXB.class); + super(EntityBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "entity-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, PersistenceType$JAXB.class, CmpVersion$JAXB.class, CmpField$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, Query$JAXB.class, ContextService$JAXB.class); } - public static EntityBean readEntityBean(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static EntityBean readEntityBean(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeEntityBean(final XoXMLStreamWriter writer, final EntityBean entityBean, final RuntimeContext context) - throws Exception { + public static void writeEntityBean(XoXMLStreamWriter writer, EntityBean entityBean, RuntimeContext context) + throws Exception + { _write(writer, entityBean, context); } - public void write(final XoXMLStreamWriter writer, final EntityBean entityBean, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, EntityBean entityBean, RuntimeContext context) + throws Exception + { _write(writer, entityBean, context); } - public final static EntityBean _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final EntityBean _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -105,7 +119,7 @@ public final static EntityBean _read(final XoXMLStreamReader reader, RuntimeCont context = new RuntimeContext(); } - final EntityBean entityBean = new EntityBean(); + EntityBean entityBean = new EntityBean(); context.beforeUnmarshal(entityBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); ArrayList descriptions = null; @@ -124,500 +138,550 @@ public final static EntityBean _read(final XoXMLStreamReader reader, RuntimeCont List postConstruct = null; List preDestroy = null; KeyedCollection dataSource = null; + KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; List securityRoleRef = null; List query = null; + KeyedCollection contextService = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("entity-beanType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("entity-beanType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, EntityBean.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, entityBean); entityBean.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = entityBean.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbName - final String ejbNameRaw = elementReader.getElementAsString(); + String ejbNameRaw = elementReader.getElementText(); - final String ejbName; + String ejbName; try { ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } entityBean.ejbName = ejbName; - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } entityBean.mappedName = mappedName; - } else if (("home" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: home - final String homeRaw = elementReader.getElementAsString(); + String homeRaw = elementReader.getElementText(); - final String home; + String home; try { home = Adapters.collapsedStringAdapterAdapter.unmarshal(homeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } entityBean.home = home; - } else if (("remote" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: remote - final String remoteRaw = elementReader.getElementAsString(); + String remoteRaw = elementReader.getElementText(); - final String remote; + String remote; try { remote = Adapters.collapsedStringAdapterAdapter.unmarshal(remoteRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } entityBean.remote = remote; - } else if (("local-home" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("local-home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: localHome - final String localHomeRaw = elementReader.getElementAsString(); + String localHomeRaw = elementReader.getElementText(); - final String localHome; + String localHome; try { localHome = Adapters.collapsedStringAdapterAdapter.unmarshal(localHomeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } entityBean.localHome = localHome; - } else if (("local" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: local - final String localRaw = elementReader.getElementAsString(); + String localRaw = elementReader.getElementText(); - final String local; + String local; try { local = Adapters.collapsedStringAdapterAdapter.unmarshal(localRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } entityBean.local = local; - } else if (("ejb-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbClass - final String ejbClassRaw = elementReader.getElementAsString(); + String ejbClassRaw = elementReader.getElementText(); - final String ejbClass; + String ejbClass; try { ejbClass = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } entityBean.ejbClass = ejbClass; - } else if (("persistence-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceType - final PersistenceType persistenceType = parsePersistenceType(elementReader, context, elementReader.getElementAsString()); - if (persistenceType != null) { + PersistenceType persistenceType = parsePersistenceType(elementReader, context, elementReader.getElementText()); + if (persistenceType!= null) { entityBean.persistenceType = persistenceType; } - } else if (("prim-key-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("prim-key-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: primKeyClass - final String primKeyClassRaw = elementReader.getElementAsString(); + String primKeyClassRaw = elementReader.getElementText(); - final String primKeyClass; + String primKeyClass; try { primKeyClass = Adapters.collapsedStringAdapterAdapter.unmarshal(primKeyClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } entityBean.primKeyClass = primKeyClass; - } else if (("reentrant" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("reentrant" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: reentrant - final String reentrantRaw = elementReader.getElementAsString(); + String reentrantRaw = elementReader.getElementText(); - final Boolean reentrant; + Boolean reentrant; try { reentrant = Adapters.booleanAdapterAdapter.unmarshal(reentrantRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, BooleanAdapter.class, Boolean.class, Boolean.class, e); continue; } entityBean.reentrant = reentrant; - } else if (("cmp-version" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("cmp-version" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: cmpVersion - final CmpVersion cmpVersion = parseCmpVersion(elementReader, context, elementReader.getElementAsString()); - if (cmpVersion != null) { + CmpVersion cmpVersion = parseCmpVersion(elementReader, context, elementReader.getElementText()); + if (cmpVersion!= null) { entityBean.cmpVersion = cmpVersion; } - } else if (("abstract-schema-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("abstract-schema-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: abstractSchemaName - final String abstractSchemaNameRaw = elementReader.getElementAsString(); + String abstractSchemaNameRaw = elementReader.getElementText(); - final String abstractSchemaName; + String abstractSchemaName; try { abstractSchemaName = Adapters.collapsedStringAdapterAdapter.unmarshal(abstractSchemaNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } entityBean.abstractSchemaName = abstractSchemaName; - } else if (("cmp-field" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("cmp-field" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: cmpField - final CmpField cmpFieldItem = readCmpField(elementReader, context); + CmpField cmpFieldItem = readCmpField(elementReader, context); if (cmpField == null) { cmpField = entityBean.cmpField; - if (cmpField != null) { + if (cmpField!= null) { cmpField.clear(); } else { - cmpField = new ArrayList(); + cmpField = new ArrayList<>(); } } cmpField.add(cmpFieldItem); - } else if (("primkey-field" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("primkey-field" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: primkeyField - final String primkeyFieldRaw = elementReader.getElementAsString(); + String primkeyFieldRaw = elementReader.getElementText(); - final String primkeyField; + String primkeyField; try { primkeyField = Adapters.collapsedStringAdapterAdapter.unmarshal(primkeyFieldRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } entityBean.primkeyField = primkeyField; - } else if (("env-entry" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: envEntry - final EnvEntry envEntryItem = readEnvEntry(elementReader, context); + EnvEntry envEntryItem = readEnvEntry(elementReader, context); if (envEntry == null) { envEntry = entityBean.envEntry; - if (envEntry != null) { + if (envEntry!= null) { envEntry.clear(); } else { - envEntry = new KeyedCollection(); + envEntry = new KeyedCollection<>(); } } envEntry.add(envEntryItem); - } else if (("ejb-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRef - final EjbRef ejbRefItem = readEjbRef(elementReader, context); + EjbRef ejbRefItem = readEjbRef(elementReader, context); if (ejbRef == null) { ejbRef = entityBean.ejbRef; - if (ejbRef != null) { + if (ejbRef!= null) { ejbRef.clear(); } else { - ejbRef = new KeyedCollection(); + ejbRef = new KeyedCollection<>(); } } ejbRef.add(ejbRefItem); - } else if (("ejb-local-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbLocalRef - final EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); if (ejbLocalRef == null) { ejbLocalRef = entityBean.ejbLocalRef; - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { ejbLocalRef.clear(); } else { - ejbLocalRef = new KeyedCollection(); + ejbLocalRef = new KeyedCollection<>(); } } ejbLocalRef.add(ejbLocalRefItem); - } else if (("service-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceRef - final ServiceRef serviceRefItem = readServiceRef(elementReader, context); + ServiceRef serviceRefItem = readServiceRef(elementReader, context); if (serviceRef == null) { serviceRef = entityBean.serviceRef; - if (serviceRef != null) { + if (serviceRef!= null) { serviceRef.clear(); } else { - serviceRef = new KeyedCollection(); + serviceRef = new KeyedCollection<>(); } } serviceRef.add(serviceRefItem); - } else if (("resource-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceRef - final ResourceRef resourceRefItem = readResourceRef(elementReader, context); + ResourceRef resourceRefItem = readResourceRef(elementReader, context); if (resourceRef == null) { resourceRef = entityBean.resourceRef; - if (resourceRef != null) { + if (resourceRef!= null) { resourceRef.clear(); } else { - resourceRef = new KeyedCollection(); + resourceRef = new KeyedCollection<>(); } } resourceRef.add(resourceRefItem); - } else if (("resource-env-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceEnvRef - final ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); if (resourceEnvRef == null) { resourceEnvRef = entityBean.resourceEnvRef; - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { resourceEnvRef.clear(); } else { - resourceEnvRef = new KeyedCollection(); + resourceEnvRef = new KeyedCollection<>(); } } resourceEnvRef.add(resourceEnvRefItem); - } else if (("message-destination-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationRef - final MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); if (messageDestinationRef == null) { messageDestinationRef = entityBean.messageDestinationRef; - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { messageDestinationRef.clear(); } else { - messageDestinationRef = new KeyedCollection(); + messageDestinationRef = new KeyedCollection<>(); } } messageDestinationRef.add(messageDestinationRefItem); - } else if (("persistence-context-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceContextRef - final PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); if (persistenceContextRef == null) { persistenceContextRef = entityBean.persistenceContextRef; - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { persistenceContextRef.clear(); } else { - persistenceContextRef = new KeyedCollection(); + persistenceContextRef = new KeyedCollection<>(); } } persistenceContextRef.add(persistenceContextRefItem); - } else if (("persistence-unit-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceUnitRef - final PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); if (persistenceUnitRef == null) { persistenceUnitRef = entityBean.persistenceUnitRef; - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { persistenceUnitRef.clear(); } else { - persistenceUnitRef = new KeyedCollection(); + persistenceUnitRef = new KeyedCollection<>(); } } persistenceUnitRef.add(persistenceUnitRefItem); - } else if (("post-construct" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("post-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: postConstruct - final org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); if (postConstruct == null) { postConstruct = entityBean.postConstruct; - if (postConstruct != null) { + if (postConstruct!= null) { postConstruct.clear(); } else { - postConstruct = new ArrayList(); + postConstruct = new ArrayList<>(); } } postConstruct.add(postConstructItem); - } else if (("pre-destroy" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("pre-destroy" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: preDestroy - final org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); if (preDestroy == null) { preDestroy = entityBean.preDestroy; - if (preDestroy != null) { + if (preDestroy!= null) { preDestroy.clear(); } else { - preDestroy = new ArrayList(); + preDestroy = new ArrayList<>(); } } preDestroy.add(preDestroyItem); - } else if (("data-source" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dataSource - final DataSource dataSourceItem = readDataSource(elementReader, context); + DataSource dataSourceItem = readDataSource(elementReader, context); if (dataSource == null) { dataSource = entityBean.dataSource; - if (dataSource != null) { + if (dataSource!= null) { dataSource.clear(); } else { - dataSource = new KeyedCollection(); + dataSource = new KeyedCollection<>(); } } dataSource.add(dataSourceItem); - } else if (("security-role-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); + if (jmsConnectionFactories == null) { + jmsConnectionFactories = entityBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + jmsConnectionFactories.clear(); + } else { + jmsConnectionFactories = new KeyedCollection<>(); + } + } + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = entityBean.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("security-role-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityRoleRef - final SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); + SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); if (securityRoleRef == null) { securityRoleRef = entityBean.securityRoleRef; - if (securityRoleRef != null) { + if (securityRoleRef!= null) { securityRoleRef.clear(); } else { - securityRoleRef = new ArrayList(); + securityRoleRef = new ArrayList<>(); } } securityRoleRef.add(securityRoleRefItem); - } else if (("security-identity" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("security-identity" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityIdentity - final SecurityIdentity securityIdentity = readSecurityIdentity(elementReader, context); + SecurityIdentity securityIdentity = readSecurityIdentity(elementReader, context); entityBean.securityIdentity = securityIdentity; - } else if (("query" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("query" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: query - final Query queryItem = readQuery(elementReader, context); + Query queryItem = readQuery(elementReader, context); if (query == null) { query = entityBean.query; - if (query != null) { + if (query!= null) { query.clear(); } else { - query = new ArrayList(); + query = new ArrayList<>(); } } query.add(queryItem); + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = entityBeanContextService.getObject(reader, context, entityBean); + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } + } + contextService.add(contextServiceItem); } 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", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "home"), new QName("http://java.sun.com/xml/ns/javaee", "remote"), 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-class"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-type"), new QName("http://java.sun.com/xml/ns/javaee", "prim-key-class"), new QName("http://java.sun.com/xml/ns/javaee", "reentrant"), new QName("http://java.sun.com/xml/ns/javaee", "cmp-version"), new QName("http://java.sun.com/xml/ns/javaee", "abstract-schema-name"), new QName("http://java.sun.com/xml/ns/javaee", "cmp-field"), new QName("http://java.sun.com/xml/ns/javaee", "primkey-field"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "security-identity"), new QName("http://java.sun.com/xml/ns/javaee", "query")); + 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", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "home"), new QName("http://java.sun.com/xml/ns/javaee", "remote"), 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-class"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-type"), new QName("http://java.sun.com/xml/ns/javaee", "prim-key-class"), new QName("http://java.sun.com/xml/ns/javaee", "reentrant"), new QName("http://java.sun.com/xml/ns/javaee", "cmp-version"), new QName("http://java.sun.com/xml/ns/javaee", "abstract-schema-name"), new QName("http://java.sun.com/xml/ns/javaee", "cmp-field"), new QName("http://java.sun.com/xml/ns/javaee", "primkey-field"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "security-identity"), new QName("http://java.sun.com/xml/ns/javaee", "query"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - entityBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + entityBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, EntityBean.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - entityBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + entityBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, EntityBean.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { entityBean.icon = icon; } - if (cmpField != null) { + if (cmpField!= null) { entityBean.cmpField = cmpField; } - if (envEntry != null) { + if (envEntry!= null) { entityBean.envEntry = envEntry; } - if (ejbRef != null) { + if (ejbRef!= null) { entityBean.ejbRef = ejbRef; } - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { entityBean.ejbLocalRef = ejbLocalRef; } - if (serviceRef != null) { + if (serviceRef!= null) { entityBean.serviceRef = serviceRef; } - if (resourceRef != null) { + if (resourceRef!= null) { entityBean.resourceRef = resourceRef; } - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { entityBean.resourceEnvRef = resourceEnvRef; } - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { entityBean.messageDestinationRef = messageDestinationRef; } - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { entityBean.persistenceContextRef = persistenceContextRef; } - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { entityBean.persistenceUnitRef = persistenceUnitRef; } - if (postConstruct != null) { + if (postConstruct!= null) { entityBean.postConstruct = postConstruct; } - if (preDestroy != null) { + if (preDestroy!= null) { entityBean.preDestroy = preDestroy; } - if (dataSource != null) { + if (dataSource!= null) { entityBean.dataSource = dataSource; } - if (securityRoleRef != null) { + if (jmsConnectionFactories!= null) { + entityBean.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + entityBean.jmsDestinations = jmsDestinations; + } + if (securityRoleRef!= null) { entityBean.securityRoleRef = securityRoleRef; } - if (query != null) { + if (query!= null) { entityBean.query = query; } + if (contextService!= null) { + entityBeanContextService.setObject(reader, context, entityBean, contextService); + } context.afterUnmarshal(entityBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); return entityBean; } - public final EntityBean read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final EntityBean read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final EntityBean entityBean, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, EntityBean entityBean, RuntimeContext context) + throws Exception + { if (entityBean == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (EntityBean.class != entityBean.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (EntityBean.class!= entityBean.getClass()) { context.unexpectedSubclass(writer, entityBean, EntityBean.class); - return; + return ; } context.beforeMarshal(entityBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = entityBean.id; - if (idRaw != null) { + String idRaw = entityBean.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -627,12 +691,12 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean Text[] descriptions = null; try { descriptions = entityBean.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(entityBean, "descriptions", EntityBean.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -646,12 +710,12 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean Text[] displayNames = null; try { displayNames = entityBean.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(entityBean, "displayNames", EntityBean.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -662,10 +726,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: icon - final LocalCollection icon = entityBean.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = entityBean.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -676,14 +740,14 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: ejbName - final String ejbNameRaw = entityBean.ejbName; + String ejbNameRaw = entityBean.ejbName; String ejbName = null; try { ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbName != null) { + if (ejbName!= null) { writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbName); writer.writeEndElement(); @@ -692,84 +756,84 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: mappedName - final String mappedNameRaw = entityBean.mappedName; + String mappedNameRaw = entityBean.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + if (mappedName!= null) { writer.writeStartElement(prefix, "mapped-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(mappedName); writer.writeEndElement(); } // ELEMENT: home - final String homeRaw = entityBean.home; + String homeRaw = entityBean.home; String home = null; try { home = Adapters.collapsedStringAdapterAdapter.marshal(homeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "home", CollapsedStringAdapter.class, String.class, String.class, e); } - if (home != null) { + if (home!= null) { writer.writeStartElement(prefix, "home", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(home); writer.writeEndElement(); } // ELEMENT: remote - final String remoteRaw = entityBean.remote; + String remoteRaw = entityBean.remote; String remote = null; try { remote = Adapters.collapsedStringAdapterAdapter.marshal(remoteRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "remote", CollapsedStringAdapter.class, String.class, String.class, e); } - if (remote != null) { + if (remote!= null) { writer.writeStartElement(prefix, "remote", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(remote); writer.writeEndElement(); } // ELEMENT: localHome - final String localHomeRaw = entityBean.localHome; + String localHomeRaw = entityBean.localHome; String localHome = null; try { localHome = Adapters.collapsedStringAdapterAdapter.marshal(localHomeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "localHome", CollapsedStringAdapter.class, String.class, String.class, e); } - if (localHome != null) { + if (localHome!= null) { writer.writeStartElement(prefix, "local-home", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(localHome); writer.writeEndElement(); } // ELEMENT: local - final String localRaw = entityBean.local; + String localRaw = entityBean.local; String local = null; try { local = Adapters.collapsedStringAdapterAdapter.marshal(localRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "local", CollapsedStringAdapter.class, String.class, String.class, e); } - if (local != null) { + if (local!= null) { writer.writeStartElement(prefix, "local", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(local); writer.writeEndElement(); } // ELEMENT: ejbClass - final String ejbClassRaw = entityBean.ejbClass; + String ejbClassRaw = entityBean.ejbClass; String ejbClass = null; try { ejbClass = Adapters.collapsedStringAdapterAdapter.marshal(ejbClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "ejbClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbClass != null) { + if (ejbClass!= null) { writer.writeStartElement(prefix, "ejb-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbClass); writer.writeEndElement(); @@ -778,8 +842,8 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: persistenceType - final PersistenceType persistenceType = entityBean.persistenceType; - if (persistenceType != null) { + PersistenceType persistenceType = entityBean.persistenceType; + if (persistenceType!= null) { writer.writeStartElement(prefix, "persistence-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringPersistenceType(entityBean, null, context, persistenceType)); writer.writeEndElement(); @@ -788,14 +852,14 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: primKeyClass - final String primKeyClassRaw = entityBean.primKeyClass; + String primKeyClassRaw = entityBean.primKeyClass; String primKeyClass = null; try { primKeyClass = Adapters.collapsedStringAdapterAdapter.marshal(primKeyClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "primKeyClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (primKeyClass != null) { + if (primKeyClass!= null) { writer.writeStartElement(prefix, "prim-key-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(primKeyClass); writer.writeEndElement(); @@ -804,14 +868,14 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: reentrant - final Boolean reentrantRaw = entityBean.reentrant; + Boolean reentrantRaw = entityBean.reentrant; String reentrant = null; try { reentrant = Adapters.booleanAdapterAdapter.marshal(reentrantRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "reentrant", BooleanAdapter.class, Boolean.TYPE, Boolean.TYPE, e); } - if (reentrant != null) { + if (reentrant!= null) { writer.writeStartElement(prefix, "reentrant", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(reentrant); writer.writeEndElement(); @@ -820,32 +884,32 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: cmpVersion - final CmpVersion cmpVersion = entityBean.cmpVersion; - if (cmpVersion != null) { + CmpVersion cmpVersion = entityBean.cmpVersion; + if (cmpVersion!= null) { writer.writeStartElement(prefix, "cmp-version", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringCmpVersion(entityBean, null, context, cmpVersion)); writer.writeEndElement(); } // ELEMENT: abstractSchemaName - final String abstractSchemaNameRaw = entityBean.abstractSchemaName; + String abstractSchemaNameRaw = entityBean.abstractSchemaName; String abstractSchemaName = null; try { abstractSchemaName = Adapters.collapsedStringAdapterAdapter.marshal(abstractSchemaNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "abstractSchemaName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (abstractSchemaName != null) { + if (abstractSchemaName!= null) { writer.writeStartElement(prefix, "abstract-schema-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(abstractSchemaName); writer.writeEndElement(); } // ELEMENT: cmpField - final List cmpField = entityBean.cmpField; - if (cmpField != null) { - for (final CmpField cmpFieldItem : cmpField) { - if (cmpFieldItem != null) { + List cmpField = entityBean.cmpField; + if (cmpField!= null) { + for (CmpField cmpFieldItem: cmpField) { + if (cmpFieldItem!= null) { writer.writeStartElement(prefix, "cmp-field", "http://java.sun.com/xml/ns/javaee"); writeCmpField(writer, cmpFieldItem, context); writer.writeEndElement(); @@ -856,24 +920,24 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: primkeyField - final String primkeyFieldRaw = entityBean.primkeyField; + String primkeyFieldRaw = entityBean.primkeyField; String primkeyField = null; try { primkeyField = Adapters.collapsedStringAdapterAdapter.marshal(primkeyFieldRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(entityBean, "primkeyField", CollapsedStringAdapter.class, String.class, String.class, e); } - if (primkeyField != null) { + if (primkeyField!= null) { writer.writeStartElement(prefix, "primkey-field", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(primkeyField); writer.writeEndElement(); } // ELEMENT: envEntry - final KeyedCollection envEntry = entityBean.envEntry; - if (envEntry != null) { - for (final EnvEntry envEntryItem : envEntry) { - if (envEntryItem != null) { + KeyedCollection envEntry = entityBean.envEntry; + if (envEntry!= null) { + for (EnvEntry envEntryItem: envEntry) { + if (envEntryItem!= null) { writer.writeStartElement(prefix, "env-entry", "http://java.sun.com/xml/ns/javaee"); writeEnvEntry(writer, envEntryItem, context); writer.writeEndElement(); @@ -884,10 +948,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: ejbRef - final KeyedCollection ejbRef = entityBean.ejbRef; - if (ejbRef != null) { - for (final EjbRef ejbRefItem : ejbRef) { - if (ejbRefItem != null) { + KeyedCollection ejbRef = entityBean.ejbRef; + if (ejbRef!= null) { + for (EjbRef ejbRefItem: ejbRef) { + if (ejbRefItem!= null) { writer.writeStartElement(prefix, "ejb-ref", "http://java.sun.com/xml/ns/javaee"); writeEjbRef(writer, ejbRefItem, context); writer.writeEndElement(); @@ -898,10 +962,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: ejbLocalRef - final KeyedCollection ejbLocalRef = entityBean.ejbLocalRef; - if (ejbLocalRef != null) { - for (final EjbLocalRef ejbLocalRefItem : ejbLocalRef) { - if (ejbLocalRefItem != null) { + KeyedCollection ejbLocalRef = entityBean.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(); @@ -912,10 +976,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: serviceRef - final KeyedCollection serviceRef = entityBean.serviceRef; - if (serviceRef != null) { - for (final ServiceRef serviceRefItem : serviceRef) { - if (serviceRefItem != null) { + KeyedCollection serviceRef = entityBean.serviceRef; + if (serviceRef!= null) { + for (ServiceRef serviceRefItem: serviceRef) { + if (serviceRefItem!= null) { writer.writeStartElement(prefix, "service-ref", "http://java.sun.com/xml/ns/javaee"); writeServiceRef(writer, serviceRefItem, context); writer.writeEndElement(); @@ -926,10 +990,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: resourceRef - final KeyedCollection resourceRef = entityBean.resourceRef; - if (resourceRef != null) { - for (final ResourceRef resourceRefItem : resourceRef) { - if (resourceRefItem != null) { + KeyedCollection resourceRef = entityBean.resourceRef; + if (resourceRef!= null) { + for (ResourceRef resourceRefItem: resourceRef) { + if (resourceRefItem!= null) { writer.writeStartElement(prefix, "resource-ref", "http://java.sun.com/xml/ns/javaee"); writeResourceRef(writer, resourceRefItem, context); writer.writeEndElement(); @@ -940,10 +1004,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: resourceEnvRef - final KeyedCollection resourceEnvRef = entityBean.resourceEnvRef; - if (resourceEnvRef != null) { - for (final ResourceEnvRef resourceEnvRefItem : resourceEnvRef) { - if (resourceEnvRefItem != null) { + KeyedCollection resourceEnvRef = entityBean.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(); @@ -954,10 +1018,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: messageDestinationRef - final KeyedCollection messageDestinationRef = entityBean.messageDestinationRef; - if (messageDestinationRef != null) { - for (final MessageDestinationRef messageDestinationRefItem : messageDestinationRef) { - if (messageDestinationRefItem != null) { + KeyedCollection messageDestinationRef = entityBean.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(); @@ -968,10 +1032,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: persistenceContextRef - final KeyedCollection persistenceContextRef = entityBean.persistenceContextRef; - if (persistenceContextRef != null) { - for (final PersistenceContextRef persistenceContextRefItem : persistenceContextRef) { - if (persistenceContextRefItem != null) { + KeyedCollection persistenceContextRef = entityBean.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(); @@ -982,10 +1046,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: persistenceUnitRef - final KeyedCollection persistenceUnitRef = entityBean.persistenceUnitRef; - if (persistenceUnitRef != null) { - for (final PersistenceUnitRef persistenceUnitRefItem : persistenceUnitRef) { - if (persistenceUnitRefItem != null) { + KeyedCollection persistenceUnitRef = entityBean.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(); @@ -996,10 +1060,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: postConstruct - final List postConstruct = entityBean.postConstruct; - if (postConstruct != null) { - for (final org.apache.openejb.jee.LifecycleCallback postConstructItem : postConstruct) { - if (postConstructItem != null) { + List postConstruct = entityBean.postConstruct; + if (postConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback postConstructItem: postConstruct) { + if (postConstructItem!= null) { writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, postConstructItem, context); writer.writeEndElement(); @@ -1010,10 +1074,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: preDestroy - final List preDestroy = entityBean.preDestroy; - if (preDestroy != null) { - for (final org.apache.openejb.jee.LifecycleCallback preDestroyItem : preDestroy) { - if (preDestroyItem != null) { + List preDestroy = entityBean.preDestroy; + if (preDestroy!= null) { + for (org.apache.openejb.jee.LifecycleCallback preDestroyItem: preDestroy) { + if (preDestroyItem!= null) { writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, preDestroyItem, context); writer.writeEndElement(); @@ -1024,10 +1088,10 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: dataSource - final KeyedCollection dataSource = entityBean.dataSource; - if (dataSource != null) { - for (final DataSource dataSourceItem : dataSource) { - if (dataSourceItem != null) { + KeyedCollection dataSource = entityBean.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); writeDataSource(writer, dataSourceItem, context); writer.writeEndElement(); @@ -1035,11 +1099,37 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } } + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = entityBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(entityBean, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = entityBean.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + // ELEMENT: securityRoleRef - final List securityRoleRef = entityBean.securityRoleRef; - if (securityRoleRef != null) { - for (final SecurityRoleRef securityRoleRefItem : securityRoleRef) { - if (securityRoleRefItem != null) { + List securityRoleRef = entityBean.securityRoleRef; + if (securityRoleRef!= null) { + for (SecurityRoleRef securityRoleRefItem: securityRoleRef) { + if (securityRoleRefItem!= null) { writer.writeStartElement(prefix, "security-role-ref", "http://java.sun.com/xml/ns/javaee"); writeSecurityRoleRef(writer, securityRoleRefItem, context); writer.writeEndElement(); @@ -1050,18 +1140,18 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } // ELEMENT: securityIdentity - final SecurityIdentity securityIdentity = entityBean.securityIdentity; - if (securityIdentity != null) { + SecurityIdentity securityIdentity = entityBean.securityIdentity; + if (securityIdentity!= null) { writer.writeStartElement(prefix, "security-identity", "http://java.sun.com/xml/ns/javaee"); writeSecurityIdentity(writer, securityIdentity, context); writer.writeEndElement(); } // ELEMENT: query - final List query = entityBean.query; - if (query != null) { - for (final Query queryItem : query) { - if (queryItem != null) { + List query = entityBean.query; + if (query!= null) { + for (Query queryItem: query) { + if (queryItem!= null) { writer.writeStartElement(prefix, "query", "http://java.sun.com/xml/ns/javaee"); writeQuery(writer, queryItem, context); writer.writeEndElement(); @@ -1071,6 +1161,18 @@ public final static void _write(final XoXMLStreamWriter writer, final EntityBean } } + // ELEMENT: contextService + KeyedCollection contextService = entityBeanContextService.getObject(entityBean, context, entityBean); + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + context.afterMarshal(entityBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EnvEntry$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EnvEntry$JAXB.java index 7016255cdd1..298912b9ae3 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EnvEntry$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EnvEntry$JAXB.java @@ -1,21 +1,28 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,12 +30,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; import static org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget; import static org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget; @@ -39,30 +40,35 @@ "StringEquality" }) public class EnvEntry$JAXB - extends JAXBObject { + extends JAXBObject +{ public EnvEntry$JAXB() { super(EnvEntry.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "env-entryType".intern()), Text$JAXB.class, InjectionTarget$JAXB.class); } - public static EnvEntry readEnvEntry(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static EnvEntry readEnvEntry(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeEnvEntry(final XoXMLStreamWriter writer, final EnvEntry envEntry, final RuntimeContext context) - throws Exception { + public static void writeEnvEntry(XoXMLStreamWriter writer, EnvEntry envEntry, RuntimeContext context) + throws Exception + { _write(writer, envEntry, context); } - public void write(final XoXMLStreamWriter writer, final EnvEntry envEntry, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, EnvEntry envEntry, RuntimeContext context) + throws Exception + { _write(writer, envEntry, context); } - public final static EnvEntry _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final EnvEntry _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -73,113 +79,113 @@ public final static EnvEntry _read(final XoXMLStreamReader reader, RuntimeContex context = new RuntimeContext(); } - final EnvEntry envEntry = new EnvEntry(); + EnvEntry envEntry = new EnvEntry(); context.beforeUnmarshal(envEntry, LifecycleCallback.NONE); ArrayList descriptions = null; Set injectionTarget = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("env-entryType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("env-entryType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, EnvEntry.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, envEntry); envEntry.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("env-entry-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("env-entry-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: envEntryName - final String envEntryNameRaw = elementReader.getElementAsString(); + String envEntryNameRaw = elementReader.getElementText(); - final String envEntryName; + String envEntryName; try { envEntryName = Adapters.collapsedStringAdapterAdapter.unmarshal(envEntryNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } envEntry.envEntryName = envEntryName; - } else if (("env-entry-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("env-entry-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: envEntryType - final String envEntryTypeRaw = elementReader.getElementAsString(); + String envEntryTypeRaw = elementReader.getElementText(); - final String envEntryType; + String envEntryType; try { envEntryType = Adapters.collapsedStringAdapterAdapter.unmarshal(envEntryTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } envEntry.envEntryType = envEntryType; - } else if (("env-entry-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("env-entry-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: envEntryValue - final String envEntryValueRaw = elementReader.getElementText(); // don't trim + String envEntryValueRaw = elementReader.getElementText(); - final String envEntryValue; + String envEntryValue; try { envEntryValue = Adapters.stringAdapterAdapter.unmarshal(envEntryValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, StringAdapter.class, String.class, String.class, e); continue; } envEntry.envEntryValue = envEntryValue; - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } envEntry.mappedName = mappedName; - } else if (("injection-target" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("injection-target" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: injectionTarget - final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); + InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); if (injectionTarget == null) { injectionTarget = envEntry.injectionTarget; - if (injectionTarget != null) { + if (injectionTarget!= null) { injectionTarget.clear(); } else { - injectionTarget = new LinkedHashSet(); + injectionTarget = new LinkedHashSet<>(); } } injectionTarget.add(injectionTargetItem); - } else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lookup-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lookupName - final String lookupNameRaw = elementReader.getElementAsString(); + String lookupNameRaw = elementReader.getElementText(); - final String lookupName; + String lookupName; try { lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -189,14 +195,14 @@ public final static EnvEntry _read(final XoXMLStreamReader reader, RuntimeContex context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "env-entry-name"), new QName("http://java.sun.com/xml/ns/javaee", "env-entry-type"), new QName("http://java.sun.com/xml/ns/javaee", "env-entry-value"), 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) { + if (descriptions!= null) { try { - envEntry.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + envEntry.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, EnvEntry.class, "setDescriptions", Text[].class, e); } } - if (injectionTarget != null) { + if (injectionTarget!= null) { envEntry.injectionTarget = injectionTarget; } @@ -205,38 +211,40 @@ public final static EnvEntry _read(final XoXMLStreamReader reader, RuntimeContex return envEntry; } - public final EnvEntry read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final EnvEntry read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final EnvEntry envEntry, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, EnvEntry envEntry, RuntimeContext context) + throws Exception + { if (envEntry == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (EnvEntry.class != envEntry.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (EnvEntry.class!= envEntry.getClass()) { context.unexpectedSubclass(writer, envEntry, EnvEntry.class); - return; + return ; } context.beforeMarshal(envEntry, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = envEntry.id; - if (idRaw != null) { + String idRaw = envEntry.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(envEntry, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -246,12 +254,12 @@ public final static void _write(final XoXMLStreamWriter writer, final EnvEntry e Text[] descriptions = null; try { descriptions = envEntry.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(envEntry, "descriptions", EnvEntry.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -262,14 +270,14 @@ public final static void _write(final XoXMLStreamWriter writer, final EnvEntry e } // ELEMENT: envEntryName - final String envEntryNameRaw = envEntry.envEntryName; + String envEntryNameRaw = envEntry.envEntryName; String envEntryName = null; try { envEntryName = Adapters.collapsedStringAdapterAdapter.marshal(envEntryNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(envEntry, "envEntryName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (envEntryName != null) { + if (envEntryName!= null) { writer.writeStartElement(prefix, "env-entry-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(envEntryName); writer.writeEndElement(); @@ -278,52 +286,52 @@ public final static void _write(final XoXMLStreamWriter writer, final EnvEntry e } // ELEMENT: envEntryType - final String envEntryTypeRaw = envEntry.envEntryType; + String envEntryTypeRaw = envEntry.envEntryType; String envEntryType = null; try { envEntryType = Adapters.collapsedStringAdapterAdapter.marshal(envEntryTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(envEntry, "envEntryType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (envEntryType != null) { + if (envEntryType!= null) { writer.writeStartElement(prefix, "env-entry-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(envEntryType); writer.writeEndElement(); } // ELEMENT: envEntryValue - final String envEntryValueRaw = envEntry.envEntryValue; + String envEntryValueRaw = envEntry.envEntryValue; String envEntryValue = null; try { envEntryValue = Adapters.stringAdapterAdapter.marshal(envEntryValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(envEntry, "envEntryValue", StringAdapter.class, String.class, String.class, e); } - if (envEntryValue != null) { + if (envEntryValue!= null) { writer.writeStartElement(prefix, "env-entry-value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(envEntryValue); writer.writeEndElement(); } // ELEMENT: mappedName - final String mappedNameRaw = envEntry.mappedName; + String mappedNameRaw = envEntry.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(envEntry, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + 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 = envEntry.injectionTarget; - if (injectionTarget != null) { - for (final InjectionTarget injectionTargetItem : injectionTarget) { - if (injectionTargetItem != null) { + Set injectionTarget = envEntry.injectionTarget; + if (injectionTarget!= null) { + for (InjectionTarget injectionTargetItem: injectionTarget) { + if (injectionTargetItem!= null) { writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee"); writeInjectionTarget(writer, injectionTargetItem, context); writer.writeEndElement(); @@ -334,14 +342,14 @@ public final static void _write(final XoXMLStreamWriter writer, final EnvEntry e } // ELEMENT: lookupName - final String lookupNameRaw = envEntry.lookupName; + String lookupNameRaw = envEntry.lookupName; String lookupName = null; try { lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(envEntry, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lookupName != null) { + if (lookupName!= null) { writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lookupName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ErrorPage$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ErrorPage$JAXB.java index a254a5b3f2e..e304b188a46 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ErrorPage$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ErrorPage$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.math.BigInteger; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,39 +28,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.math.BigInteger; - @SuppressWarnings({ "StringEquality" }) public class ErrorPage$JAXB - extends JAXBObject { + extends JAXBObject +{ public ErrorPage$JAXB() { super(ErrorPage.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "error-pageType".intern())); } - public static ErrorPage readErrorPage(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ErrorPage readErrorPage(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeErrorPage(final XoXMLStreamWriter writer, final ErrorPage errorPage, final RuntimeContext context) - throws Exception { + public static void writeErrorPage(XoXMLStreamWriter writer, ErrorPage errorPage, RuntimeContext context) + throws Exception + { _write(writer, errorPage, context); } - public void write(final XoXMLStreamWriter writer, final ErrorPage errorPage, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ErrorPage errorPage, RuntimeContext context) + throws Exception + { _write(writer, errorPage, context); } - public final static ErrorPage _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ErrorPage _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -66,57 +71,57 @@ public final static ErrorPage _read(final XoXMLStreamReader reader, RuntimeConte context = new RuntimeContext(); } - final ErrorPage errorPage = new ErrorPage(); + ErrorPage errorPage = new ErrorPage(); context.beforeUnmarshal(errorPage, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("error-pageType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("error-pageType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ErrorPage.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, errorPage); errorPage.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("error-code" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("error-code" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: errorCode - final BigInteger errorCode = new BigInteger(elementReader.getElementAsString()); + BigInteger errorCode = new BigInteger(elementReader.getElementText()); errorPage.errorCode = errorCode; - } else if (("exception-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("exception-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: exceptionType - final String exceptionTypeRaw = elementReader.getElementAsString(); + String exceptionTypeRaw = elementReader.getElementText(); - final String exceptionType; + String exceptionType; try { exceptionType = Adapters.collapsedStringAdapterAdapter.unmarshal(exceptionTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } errorPage.exceptionType = exceptionType; - } else if (("location" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("location" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: location - final String locationRaw = elementReader.getElementAsString(); + String locationRaw = elementReader.getElementText(); - final String location; + String location; try { location = Adapters.collapsedStringAdapterAdapter.unmarshal(locationRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -132,74 +137,76 @@ public final static ErrorPage _read(final XoXMLStreamReader reader, RuntimeConte return errorPage; } - public final ErrorPage read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ErrorPage read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ErrorPage errorPage, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ErrorPage errorPage, RuntimeContext context) + throws Exception + { if (errorPage == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ErrorPage.class != errorPage.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ErrorPage.class!= errorPage.getClass()) { context.unexpectedSubclass(writer, errorPage, ErrorPage.class); - return; + return ; } context.beforeMarshal(errorPage, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = errorPage.id; - if (idRaw != null) { + String idRaw = errorPage.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(errorPage, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: errorCode - final BigInteger errorCode = errorPage.errorCode; - if (errorCode != null) { + BigInteger errorCode = errorPage.errorCode; + if (errorCode!= null) { writer.writeStartElement(prefix, "error-code", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(errorCode.toString()); writer.writeEndElement(); } // ELEMENT: exceptionType - final String exceptionTypeRaw = errorPage.exceptionType; + String exceptionTypeRaw = errorPage.exceptionType; String exceptionType = null; try { exceptionType = Adapters.collapsedStringAdapterAdapter.marshal(exceptionTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(errorPage, "exceptionType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (exceptionType != null) { + if (exceptionType!= null) { writer.writeStartElement(prefix, "exception-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(exceptionType); writer.writeEndElement(); } // ELEMENT: location - final String locationRaw = errorPage.location; + String locationRaw = errorPage.location; String location = null; try { location = Adapters.collapsedStringAdapterAdapter.marshal(locationRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(errorPage, "location", CollapsedStringAdapter.class, String.class, String.class, e); } - if (location != null) { + if (location!= null) { writer.writeStartElement(prefix, "location", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(location); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ExceptionMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ExceptionMapping$JAXB.java index a067a701f05..4666c3814ba 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ExceptionMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ExceptionMapping$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.ConstructorParameterOrder$JAXB.readConstructorParameterOrder; import static org.apache.openejb.jee.ConstructorParameterOrder$JAXB.writeConstructorParameterOrder; @@ -34,30 +35,35 @@ "StringEquality" }) public class ExceptionMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public ExceptionMapping$JAXB() { super(ExceptionMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "exception-mappingType".intern()), ConstructorParameterOrder$JAXB.class); } - public static ExceptionMapping readExceptionMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ExceptionMapping readExceptionMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeExceptionMapping(final XoXMLStreamWriter writer, final ExceptionMapping exceptionMapping, final RuntimeContext context) - throws Exception { + public static void writeExceptionMapping(XoXMLStreamWriter writer, ExceptionMapping exceptionMapping, RuntimeContext context) + throws Exception + { _write(writer, exceptionMapping, context); } - public void write(final XoXMLStreamWriter writer, final ExceptionMapping exceptionMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ExceptionMapping exceptionMapping, RuntimeContext context) + throws Exception + { _write(writer, exceptionMapping, context); } - public final static ExceptionMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ExceptionMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -68,65 +74,65 @@ public final static ExceptionMapping _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final ExceptionMapping exceptionMapping = new ExceptionMapping(); + ExceptionMapping exceptionMapping = new ExceptionMapping(); context.beforeUnmarshal(exceptionMapping, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("exception-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("exception-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ExceptionMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, exceptionMapping); exceptionMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("exception-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("exception-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: exceptionType - final String exceptionTypeRaw = elementReader.getElementAsString(); + String exceptionTypeRaw = elementReader.getElementText(); - final String exceptionType; + String exceptionType; try { exceptionType = Adapters.collapsedStringAdapterAdapter.unmarshal(exceptionTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } exceptionMapping.exceptionType = exceptionType; - } else if (("wsdl-message" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-message" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlMessage - final QName wsdlMessage = elementReader.getElementAsQName(); + QName wsdlMessage = elementReader.getElementAsQName(); exceptionMapping.wsdlMessage = wsdlMessage; - } else if (("wsdl-message-part-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-message-part-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlMessagePartName - final String wsdlMessagePartNameRaw = elementReader.getElementAsString(); + String wsdlMessagePartNameRaw = elementReader.getElementText(); - final String wsdlMessagePartName; + String wsdlMessagePartName; try { wsdlMessagePartName = Adapters.collapsedStringAdapterAdapter.unmarshal(wsdlMessagePartNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } exceptionMapping.wsdlMessagePartName = wsdlMessagePartName; - } else if (("constructor-parameter-order" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("constructor-parameter-order" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: constructorParameterOrder - final ConstructorParameterOrder constructorParameterOrder = readConstructorParameterOrder(elementReader, context); + ConstructorParameterOrder constructorParameterOrder = readConstructorParameterOrder(elementReader, context); exceptionMapping.constructorParameterOrder = constructorParameterOrder; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "exception-type"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-message"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-message-part-name"), new QName("http://java.sun.com/xml/ns/javaee", "constructor-parameter-order")); @@ -138,52 +144,54 @@ public final static ExceptionMapping _read(final XoXMLStreamReader reader, Runti return exceptionMapping; } - public final ExceptionMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ExceptionMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ExceptionMapping exceptionMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ExceptionMapping exceptionMapping, RuntimeContext context) + throws Exception + { if (exceptionMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ExceptionMapping.class != exceptionMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ExceptionMapping.class!= exceptionMapping.getClass()) { context.unexpectedSubclass(writer, exceptionMapping, ExceptionMapping.class); - return; + return ; } context.beforeMarshal(exceptionMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = exceptionMapping.id; - if (idRaw != null) { + String idRaw = exceptionMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(exceptionMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: exceptionType - final String exceptionTypeRaw = exceptionMapping.exceptionType; + String exceptionTypeRaw = exceptionMapping.exceptionType; String exceptionType = null; try { exceptionType = Adapters.collapsedStringAdapterAdapter.marshal(exceptionTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(exceptionMapping, "exceptionType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (exceptionType != null) { + if (exceptionType!= null) { writer.writeStartElement(prefix, "exception-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(exceptionType); writer.writeEndElement(); @@ -192,8 +200,8 @@ public final static void _write(final XoXMLStreamWriter writer, final ExceptionM } // ELEMENT: wsdlMessage - final QName wsdlMessage = exceptionMapping.wsdlMessage; - if (wsdlMessage != null) { + QName wsdlMessage = exceptionMapping.wsdlMessage; + if (wsdlMessage!= null) { writer.writeStartElement(prefix, "wsdl-message", "http://java.sun.com/xml/ns/javaee"); writer.writeQName(wsdlMessage); writer.writeEndElement(); @@ -202,22 +210,22 @@ public final static void _write(final XoXMLStreamWriter writer, final ExceptionM } // ELEMENT: wsdlMessagePartName - final String wsdlMessagePartNameRaw = exceptionMapping.wsdlMessagePartName; + String wsdlMessagePartNameRaw = exceptionMapping.wsdlMessagePartName; String wsdlMessagePartName = null; try { wsdlMessagePartName = Adapters.collapsedStringAdapterAdapter.marshal(wsdlMessagePartNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(exceptionMapping, "wsdlMessagePartName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (wsdlMessagePartName != null) { + if (wsdlMessagePartName!= null) { writer.writeStartElement(prefix, "wsdl-message-part-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(wsdlMessagePartName); writer.writeEndElement(); } // ELEMENT: constructorParameterOrder - final ConstructorParameterOrder constructorParameterOrder = exceptionMapping.constructorParameterOrder; - if (constructorParameterOrder != null) { + ConstructorParameterOrder constructorParameterOrder = exceptionMapping.constructorParameterOrder; + if (constructorParameterOrder!= null) { writer.writeStartElement(prefix, "constructor-parameter-order", "http://java.sun.com/xml/ns/javaee"); writeConstructorParameterOrder(writer, constructorParameterOrder, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ExcludeList$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ExcludeList$JAXB.java index 8b897ec55ad..e59b6e72958 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ExcludeList$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ExcludeList$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Method$JAXB.readMethod; import static org.apache.openejb.jee.Method$JAXB.writeMethod; @@ -38,30 +39,35 @@ "StringEquality" }) public class ExcludeList$JAXB - extends JAXBObject { + extends JAXBObject +{ public ExcludeList$JAXB() { super(ExcludeList.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "exclude-listType".intern()), Text$JAXB.class, Method$JAXB.class); } - public static ExcludeList readExcludeList(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ExcludeList readExcludeList(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeExcludeList(final XoXMLStreamWriter writer, final ExcludeList excludeList, final RuntimeContext context) - throws Exception { + public static void writeExcludeList(XoXMLStreamWriter writer, ExcludeList excludeList, RuntimeContext context) + throws Exception + { _write(writer, excludeList, context); } - public void write(final XoXMLStreamWriter writer, final ExcludeList excludeList, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ExcludeList excludeList, RuntimeContext context) + throws Exception + { _write(writer, excludeList, context); } - public final static ExcludeList _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ExcludeList _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,50 +78,50 @@ public final static ExcludeList _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final ExcludeList excludeList = new ExcludeList(); + ExcludeList excludeList = new ExcludeList(); context.beforeUnmarshal(excludeList, LifecycleCallback.NONE); ArrayList descriptions = null; List method = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("exclude-listType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("exclude-listType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ExcludeList.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, excludeList); excludeList.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: method - final Method methodItem = readMethod(elementReader, context); + Method methodItem = readMethod(elementReader, context); if (method == null) { method = excludeList.method; - if (method != null) { + if (method!= null) { method.clear(); } else { - method = new ArrayList(); + method = new ArrayList<>(); } } method.add(methodItem); @@ -123,14 +129,14 @@ public final static ExcludeList _read(final XoXMLStreamReader reader, RuntimeCon context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "method")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - excludeList.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + excludeList.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, ExcludeList.class, "setDescriptions", Text[].class, e); } } - if (method != null) { + if (method!= null) { excludeList.method = method; } @@ -139,38 +145,40 @@ public final static ExcludeList _read(final XoXMLStreamReader reader, RuntimeCon return excludeList; } - public final ExcludeList read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ExcludeList read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ExcludeList excludeList, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ExcludeList excludeList, RuntimeContext context) + throws Exception + { if (excludeList == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ExcludeList.class != excludeList.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ExcludeList.class!= excludeList.getClass()) { context.unexpectedSubclass(writer, excludeList, ExcludeList.class); - return; + return ; } context.beforeMarshal(excludeList, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = excludeList.id; - if (idRaw != null) { + String idRaw = excludeList.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(excludeList, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -180,12 +188,12 @@ public final static void _write(final XoXMLStreamWriter writer, final ExcludeLis Text[] descriptions = null; try { descriptions = excludeList.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(excludeList, "descriptions", ExcludeList.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -196,10 +204,10 @@ public final static void _write(final XoXMLStreamWriter writer, final ExcludeLis } // ELEMENT: method - final List method = excludeList.method; - if (method != null) { - for (final Method methodItem : method) { - if (methodItem != null) { + List method = excludeList.method; + if (method!= null) { + for (Method methodItem: method) { + if (methodItem!= null) { writer.writeStartElement(prefix, "method", "http://java.sun.com/xml/ns/javaee"); writeMethod(writer, methodItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering$JAXB.java index 4429d474cb2..d8f324a2fe8 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesOrderingOthers$JAXB.readFacesOrderingOthers; import static org.apache.openejb.jee.FacesOrderingOthers$JAXB.writeFacesOrderingOthers; @@ -35,30 +36,35 @@ "StringEquality" }) public class FacesAbsoluteOrdering$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesAbsoluteOrdering$JAXB() { super(FacesAbsoluteOrdering.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-absoluteOrderingType".intern()), FacesOrderingOthers$JAXB.class); } - public static FacesAbsoluteOrdering readFacesAbsoluteOrdering(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesAbsoluteOrdering readFacesAbsoluteOrdering(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesAbsoluteOrdering(final XoXMLStreamWriter writer, final FacesAbsoluteOrdering facesAbsoluteOrdering, final RuntimeContext context) - throws Exception { + public static void writeFacesAbsoluteOrdering(XoXMLStreamWriter writer, FacesAbsoluteOrdering facesAbsoluteOrdering, RuntimeContext context) + throws Exception + { _write(writer, facesAbsoluteOrdering, context); } - public void write(final XoXMLStreamWriter writer, final FacesAbsoluteOrdering facesAbsoluteOrdering, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesAbsoluteOrdering facesAbsoluteOrdering, RuntimeContext context) + throws Exception + { _write(writer, facesAbsoluteOrdering, context); } - public final static FacesAbsoluteOrdering _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesAbsoluteOrdering _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,59 +75,57 @@ public final static FacesAbsoluteOrdering _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final FacesAbsoluteOrdering facesAbsoluteOrdering = new FacesAbsoluteOrdering(); + FacesAbsoluteOrdering facesAbsoluteOrdering = new FacesAbsoluteOrdering(); context.beforeUnmarshal(facesAbsoluteOrdering, LifecycleCallback.NONE); List nameOrOthers = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-absoluteOrderingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-absoluteOrderingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesAbsoluteOrdering.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("others" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("others" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: nameOrOthers - final org.apache.openejb.jee.FacesOrderingOthers nameOrOthersItem = readFacesOrderingOthers(elementReader, context); + org.apache.openejb.jee.FacesOrderingOthers nameOrOthersItem = readFacesOrderingOthers(elementReader, context); if (nameOrOthers == null) { nameOrOthers = facesAbsoluteOrdering.nameOrOthers; - if (nameOrOthers != null) { + if (nameOrOthers!= null) { nameOrOthers.clear(); } else { - nameOrOthers = new ArrayList(); + nameOrOthers = new ArrayList<>(); } } nameOrOthers.add(nameOrOthersItem); - } else if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: nameOrOthers - final java.lang.String nameOrOthersItem1 = elementReader.getElementAsString(); + java.lang.String nameOrOthersItem1 = elementReader.getElementText(); if (nameOrOthers == null) { nameOrOthers = facesAbsoluteOrdering.nameOrOthers; - if (nameOrOthers != null) { + if (nameOrOthers!= null) { nameOrOthers.clear(); } else { - nameOrOthers = new ArrayList(); + nameOrOthers = new ArrayList<>(); } } nameOrOthers.add(nameOrOthersItem1); } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "others"), new QName("http://java.sun.com/xml/ns/javaee", "name")); + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "others"), new QName("http://java.sun.com/xml/ns/javaee", "name")); } } - if (nameOrOthers != null) { + if (nameOrOthers!= null) { facesAbsoluteOrdering.nameOrOthers = nameOrOthers; } @@ -130,42 +134,44 @@ public final static FacesAbsoluteOrdering _read(final XoXMLStreamReader reader, return facesAbsoluteOrdering; } - public final FacesAbsoluteOrdering read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesAbsoluteOrdering read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesAbsoluteOrdering facesAbsoluteOrdering, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesAbsoluteOrdering facesAbsoluteOrdering, RuntimeContext context) + throws Exception + { if (facesAbsoluteOrdering == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final java.lang.String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesAbsoluteOrdering.class != facesAbsoluteOrdering.getClass()) { + java.lang.String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesAbsoluteOrdering.class!= facesAbsoluteOrdering.getClass()) { context.unexpectedSubclass(writer, facesAbsoluteOrdering, FacesAbsoluteOrdering.class); - return; + return ; } context.beforeMarshal(facesAbsoluteOrdering, LifecycleCallback.NONE); // ELEMENT: nameOrOthers - final List nameOrOthers = facesAbsoluteOrdering.nameOrOthers; - if (nameOrOthers != null) { - for (final Object nameOrOthersItem : nameOrOthers) { + List nameOrOthers = facesAbsoluteOrdering.nameOrOthers; + if (nameOrOthers!= null) { + for (Object nameOrOthersItem: nameOrOthers) { if (nameOrOthersItem instanceof java.lang.String) { - final java.lang.String String = ((java.lang.String) nameOrOthersItem); + java.lang.String String = ((java.lang.String) nameOrOthersItem); writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(String); writer.writeEndElement(); } else if (nameOrOthersItem instanceof org.apache.openejb.jee.FacesOrderingOthers) { - final org.apache.openejb.jee.FacesOrderingOthers FacesOrderingOthers = ((org.apache.openejb.jee.FacesOrderingOthers) nameOrOthersItem); + org.apache.openejb.jee.FacesOrderingOthers FacesOrderingOthers = ((org.apache.openejb.jee.FacesOrderingOthers) nameOrOthersItem); writer.writeStartElement(prefix, "others", "http://java.sun.com/xml/ns/javaee"); writeFacesOrderingOthers(writer, FacesOrderingOthers, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplication$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplication$JAXB.java index e0f712d1441..9e17c33ab54 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplication$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplication$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesApplicationExtension$JAXB.readFacesApplicationExtension; import static org.apache.openejb.jee.FacesApplicationExtension$JAXB.writeFacesApplicationExtension; @@ -44,30 +45,35 @@ "StringEquality" }) public class FacesApplication$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesApplication$JAXB() { super(FacesApplication.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-applicationType".intern()), FacesSystemEventListener$JAXB.class, FacesLocaleConfig$JAXB.class, FacesApplicationResourceBundle$JAXB.class, FacesApplicationExtension$JAXB.class, FacesValidator$JAXB.class); } - public static FacesApplication readFacesApplication(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesApplication readFacesApplication(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesApplication(final XoXMLStreamWriter writer, final FacesApplication facesApplication, final RuntimeContext context) - throws Exception { + public static void writeFacesApplication(XoXMLStreamWriter writer, FacesApplication facesApplication, RuntimeContext context) + throws Exception + { _write(writer, facesApplication, context); } - public void write(final XoXMLStreamWriter writer, final FacesApplication facesApplication, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesApplication facesApplication, RuntimeContext context) + throws Exception + { _write(writer, facesApplication, context); } - public final static FacesApplication _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesApplication _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -78,7 +84,7 @@ public final static FacesApplication _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final FacesApplication facesApplication = new FacesApplication(); + FacesApplication facesApplication = new FacesApplication(); context.beforeUnmarshal(facesApplication, LifecycleCallback.NONE); List actionListener = null; @@ -97,335 +103,333 @@ public final static FacesApplication _read(final XoXMLStreamReader reader, Runti List defaultValidators = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-applicationType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-applicationType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesApplication.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesApplication); facesApplication.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("action-listener" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("action-listener" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: actionListener - final String actionListenerItemRaw = elementReader.getElementAsString(); + String actionListenerItemRaw = elementReader.getElementText(); - final String actionListenerItem; + String actionListenerItem; try { actionListenerItem = Adapters.collapsedStringAdapterAdapter.unmarshal(actionListenerItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (actionListener == null) { actionListener = facesApplication.actionListener; - if (actionListener != null) { + if (actionListener!= null) { actionListener.clear(); } else { - actionListener = new ArrayList(); + actionListener = new ArrayList<>(); } } actionListener.add(actionListenerItem); - } else if (("default-render-kit-id" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("default-render-kit-id" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: defaultRenderKitId - final String defaultRenderKitIdItemRaw = elementReader.getElementAsString(); + String defaultRenderKitIdItemRaw = elementReader.getElementText(); - final String defaultRenderKitIdItem; + String defaultRenderKitIdItem; try { defaultRenderKitIdItem = Adapters.collapsedStringAdapterAdapter.unmarshal(defaultRenderKitIdItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (defaultRenderKitId == null) { defaultRenderKitId = facesApplication.defaultRenderKitId; - if (defaultRenderKitId != null) { + if (defaultRenderKitId!= null) { defaultRenderKitId.clear(); } else { - defaultRenderKitId = new ArrayList(); + defaultRenderKitId = new ArrayList<>(); } } defaultRenderKitId.add(defaultRenderKitIdItem); - } else if (("message-bundle" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-bundle" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageBundle - final String messageBundleItemRaw = elementReader.getElementAsString(); + String messageBundleItemRaw = elementReader.getElementText(); - final String messageBundleItem; + String messageBundleItem; try { messageBundleItem = Adapters.collapsedStringAdapterAdapter.unmarshal(messageBundleItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (messageBundle == null) { messageBundle = facesApplication.messageBundle; - if (messageBundle != null) { + if (messageBundle!= null) { messageBundle.clear(); } else { - messageBundle = new ArrayList(); + messageBundle = new ArrayList<>(); } } messageBundle.add(messageBundleItem); - } else if (("navigation-handler" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("navigation-handler" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: navigationHandler - final String navigationHandlerItemRaw = elementReader.getElementAsString(); + String navigationHandlerItemRaw = elementReader.getElementText(); - final String navigationHandlerItem; + String navigationHandlerItem; try { navigationHandlerItem = Adapters.collapsedStringAdapterAdapter.unmarshal(navigationHandlerItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (navigationHandler == null) { navigationHandler = facesApplication.navigationHandler; - if (navigationHandler != null) { + if (navigationHandler!= null) { navigationHandler.clear(); } else { - navigationHandler = new ArrayList(); + navigationHandler = new ArrayList<>(); } } navigationHandler.add(navigationHandlerItem); - } else if (("view-handler" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("view-handler" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: viewHandler - final String viewHandlerItemRaw = elementReader.getElementAsString(); + String viewHandlerItemRaw = elementReader.getElementText(); - final String viewHandlerItem; + String viewHandlerItem; try { viewHandlerItem = Adapters.collapsedStringAdapterAdapter.unmarshal(viewHandlerItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (viewHandler == null) { viewHandler = facesApplication.viewHandler; - if (viewHandler != null) { + if (viewHandler!= null) { viewHandler.clear(); } else { - viewHandler = new ArrayList(); + viewHandler = new ArrayList<>(); } } viewHandler.add(viewHandlerItem); - } else if (("state-manager" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("state-manager" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: stateManager - final String stateManagerItemRaw = elementReader.getElementAsString(); + String stateManagerItemRaw = elementReader.getElementText(); - final String stateManagerItem; + String stateManagerItem; try { stateManagerItem = Adapters.collapsedStringAdapterAdapter.unmarshal(stateManagerItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (stateManager == null) { stateManager = facesApplication.stateManager; - if (stateManager != null) { + if (stateManager!= null) { stateManager.clear(); } else { - stateManager = new ArrayList(); + stateManager = new ArrayList<>(); } } stateManager.add(stateManagerItem); - } else if (("el-resolver" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("el-resolver" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: elResolver - final String elResolverItemRaw = elementReader.getElementAsString(); + String elResolverItemRaw = elementReader.getElementText(); - final String elResolverItem; + String elResolverItem; try { elResolverItem = Adapters.collapsedStringAdapterAdapter.unmarshal(elResolverItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (elResolver == null) { elResolver = facesApplication.elResolver; - if (elResolver != null) { + if (elResolver!= null) { elResolver.clear(); } else { - elResolver = new ArrayList(); + elResolver = new ArrayList<>(); } } elResolver.add(elResolverItem); - } else if (("property-resolver" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("property-resolver" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: propertyResolver - final String propertyResolverItemRaw = elementReader.getElementAsString(); + String propertyResolverItemRaw = elementReader.getElementText(); - final String propertyResolverItem; + String propertyResolverItem; try { propertyResolverItem = Adapters.collapsedStringAdapterAdapter.unmarshal(propertyResolverItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (propertyResolver == null) { propertyResolver = facesApplication.propertyResolver; - if (propertyResolver != null) { + if (propertyResolver!= null) { propertyResolver.clear(); } else { - propertyResolver = new ArrayList(); + propertyResolver = new ArrayList<>(); } } propertyResolver.add(propertyResolverItem); - } else if (("variable-resolver" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("variable-resolver" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: variableResolver - final String variableResolverItemRaw = elementReader.getElementAsString(); + String variableResolverItemRaw = elementReader.getElementText(); - final String variableResolverItem; + String variableResolverItem; try { variableResolverItem = Adapters.collapsedStringAdapterAdapter.unmarshal(variableResolverItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (variableResolver == null) { variableResolver = facesApplication.variableResolver; - if (variableResolver != null) { + if (variableResolver!= null) { variableResolver.clear(); } else { - variableResolver = new ArrayList(); + variableResolver = new ArrayList<>(); } } variableResolver.add(variableResolverItem); - } else if (("resource-handler" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-handler" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceHandler - final String resourceHandlerItemRaw = elementReader.getElementAsString(); + String resourceHandlerItemRaw = elementReader.getElementText(); - final String resourceHandlerItem; + String resourceHandlerItem; try { resourceHandlerItem = Adapters.collapsedStringAdapterAdapter.unmarshal(resourceHandlerItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (resourceHandler == null) { resourceHandler = facesApplication.resourceHandler; - if (resourceHandler != null) { + if (resourceHandler!= null) { resourceHandler.clear(); } else { - resourceHandler = new ArrayList(); + resourceHandler = new ArrayList<>(); } } resourceHandler.add(resourceHandlerItem); - } else if (("system-event-listener" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("system-event-listener" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: systemEventListener - final FacesSystemEventListener systemEventListenerItem = readFacesSystemEventListener(elementReader, context); + FacesSystemEventListener systemEventListenerItem = readFacesSystemEventListener(elementReader, context); if (systemEventListener == null) { systemEventListener = facesApplication.systemEventListener; - if (systemEventListener != null) { + if (systemEventListener!= null) { systemEventListener.clear(); } else { - systemEventListener = new ArrayList(); + systemEventListener = new ArrayList<>(); } } systemEventListener.add(systemEventListenerItem); - } else if (("locale-config" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("locale-config" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: localeConfig - final FacesLocaleConfig localeConfigItem = readFacesLocaleConfig(elementReader, context); + FacesLocaleConfig localeConfigItem = readFacesLocaleConfig(elementReader, context); if (localeConfig == null) { localeConfig = facesApplication.localeConfig; - if (localeConfig != null) { + if (localeConfig!= null) { localeConfig.clear(); } else { - localeConfig = new ArrayList(); + localeConfig = new ArrayList<>(); } } localeConfig.add(localeConfigItem); - } else if (("resource-bundle" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-bundle" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceBundle - final FacesApplicationResourceBundle resourceBundle = readFacesApplicationResourceBundle(elementReader, context); + FacesApplicationResourceBundle resourceBundle = readFacesApplicationResourceBundle(elementReader, context); facesApplication.resourceBundle = resourceBundle; - } else if (("application-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("application-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: applicationExtension - final FacesApplicationExtension applicationExtensionItem = readFacesApplicationExtension(elementReader, context); + FacesApplicationExtension applicationExtensionItem = readFacesApplicationExtension(elementReader, context); if (applicationExtension == null) { applicationExtension = facesApplication.applicationExtension; - if (applicationExtension != null) { + if (applicationExtension!= null) { applicationExtension.clear(); } else { - applicationExtension = new ArrayList(); + applicationExtension = new ArrayList<>(); } } applicationExtension.add(applicationExtensionItem); - } else if (("default-validators" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("default-validators" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: defaultValidators - final FacesValidator defaultValidatorsItem = readFacesValidator(elementReader, context); + FacesValidator defaultValidatorsItem = readFacesValidator(elementReader, context); if (defaultValidators == null) { defaultValidators = facesApplication.defaultValidators; - if (defaultValidators != null) { + if (defaultValidators!= null) { defaultValidators.clear(); } else { - defaultValidators = new ArrayList(); + defaultValidators = new ArrayList<>(); } } defaultValidators.add(defaultValidatorsItem); } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "action-listener"), new QName("http://java.sun.com/xml/ns/javaee", "default-render-kit-id"), new QName("http://java.sun.com/xml/ns/javaee", "message-bundle"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-handler"), new QName("http://java.sun.com/xml/ns/javaee", "view-handler"), new QName("http://java.sun.com/xml/ns/javaee", "state-manager"), new QName("http://java.sun.com/xml/ns/javaee", "el-resolver"), new QName("http://java.sun.com/xml/ns/javaee", "property-resolver"), new QName("http://java.sun.com/xml/ns/javaee", "variable-resolver"), new QName("http://java.sun.com/xml/ns/javaee", "resource-handler"), new QName("http://java.sun.com/xml/ns/javaee", "system-event-listener"), new QName("http://java.sun.com/xml/ns/javaee", "locale-config"), new QName("http://java.sun.com/xml/ns/javaee", "resource-bundle"), new QName("http://java.sun.com/xml/ns/javaee", "application-extension"), new QName("http://java.sun.com/xml/ns/javaee", "default-validators")); + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "action-listener"), new QName("http://java.sun.com/xml/ns/javaee", "default-render-kit-id"), new QName("http://java.sun.com/xml/ns/javaee", "message-bundle"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-handler"), new QName("http://java.sun.com/xml/ns/javaee", "view-handler"), new QName("http://java.sun.com/xml/ns/javaee", "state-manager"), new QName("http://java.sun.com/xml/ns/javaee", "el-resolver"), new QName("http://java.sun.com/xml/ns/javaee", "property-resolver"), new QName("http://java.sun.com/xml/ns/javaee", "variable-resolver"), new QName("http://java.sun.com/xml/ns/javaee", "resource-handler"), new QName("http://java.sun.com/xml/ns/javaee", "system-event-listener"), new QName("http://java.sun.com/xml/ns/javaee", "locale-config"), new QName("http://java.sun.com/xml/ns/javaee", "resource-bundle"), new QName("http://java.sun.com/xml/ns/javaee", "application-extension"), new QName("http://java.sun.com/xml/ns/javaee", "default-validators")); } } - if (actionListener != null) { + if (actionListener!= null) { facesApplication.actionListener = actionListener; } - if (defaultRenderKitId != null) { + if (defaultRenderKitId!= null) { facesApplication.defaultRenderKitId = defaultRenderKitId; } - if (messageBundle != null) { + if (messageBundle!= null) { facesApplication.messageBundle = messageBundle; } - if (navigationHandler != null) { + if (navigationHandler!= null) { facesApplication.navigationHandler = navigationHandler; } - if (viewHandler != null) { + if (viewHandler!= null) { facesApplication.viewHandler = viewHandler; } - if (stateManager != null) { + if (stateManager!= null) { facesApplication.stateManager = stateManager; } - if (elResolver != null) { + if (elResolver!= null) { facesApplication.elResolver = elResolver; } - if (propertyResolver != null) { + if (propertyResolver!= null) { facesApplication.propertyResolver = propertyResolver; } - if (variableResolver != null) { + if (variableResolver!= null) { facesApplication.variableResolver = variableResolver; } - if (resourceHandler != null) { + if (resourceHandler!= null) { facesApplication.resourceHandler = resourceHandler; } - if (systemEventListener != null) { + if (systemEventListener!= null) { facesApplication.systemEventListener = systemEventListener; } - if (localeConfig != null) { + if (localeConfig!= null) { facesApplication.localeConfig = localeConfig; } - if (applicationExtension != null) { + if (applicationExtension!= null) { facesApplication.applicationExtension = applicationExtension; } - if (defaultValidators != null) { + if (defaultValidators!= null) { facesApplication.defaultValidators = defaultValidators; } @@ -434,54 +438,56 @@ public final static FacesApplication _read(final XoXMLStreamReader reader, Runti return facesApplication; } - public final FacesApplication read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesApplication read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesApplication facesApplication, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesApplication facesApplication, RuntimeContext context) + throws Exception + { if (facesApplication == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesApplication.class != facesApplication.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesApplication.class!= facesApplication.getClass()) { context.unexpectedSubclass(writer, facesApplication, FacesApplication.class); - return; + return ; } context.beforeMarshal(facesApplication, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesApplication.id; - if (idRaw != null) { + String idRaw = facesApplication.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplication, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: actionListener - final List actionListenerRaw = facesApplication.actionListener; - if (actionListenerRaw != null) { - for (final String actionListenerItem : actionListenerRaw) { + List actionListenerRaw = facesApplication.actionListener; + if (actionListenerRaw!= null) { + for (String actionListenerItem: actionListenerRaw) { String actionListener = null; try { actionListener = Adapters.collapsedStringAdapterAdapter.marshal(actionListenerItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplication, "actionListener", CollapsedStringAdapter.class, List.class, List.class, e); } - if (actionListener != null) { + if (actionListener!= null) { writer.writeStartElement(prefix, "action-listener", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(actionListener); writer.writeEndElement(); @@ -490,16 +496,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: defaultRenderKitId - final List defaultRenderKitIdRaw = facesApplication.defaultRenderKitId; - if (defaultRenderKitIdRaw != null) { - for (final String defaultRenderKitIdItem : defaultRenderKitIdRaw) { + List defaultRenderKitIdRaw = facesApplication.defaultRenderKitId; + if (defaultRenderKitIdRaw!= null) { + for (String defaultRenderKitIdItem: defaultRenderKitIdRaw) { String defaultRenderKitId = null; try { defaultRenderKitId = Adapters.collapsedStringAdapterAdapter.marshal(defaultRenderKitIdItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplication, "defaultRenderKitId", CollapsedStringAdapter.class, List.class, List.class, e); } - if (defaultRenderKitId != null) { + if (defaultRenderKitId!= null) { writer.writeStartElement(prefix, "default-render-kit-id", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(defaultRenderKitId); writer.writeEndElement(); @@ -508,16 +514,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: messageBundle - final List messageBundleRaw = facesApplication.messageBundle; - if (messageBundleRaw != null) { - for (final String messageBundleItem : messageBundleRaw) { + List messageBundleRaw = facesApplication.messageBundle; + if (messageBundleRaw!= null) { + for (String messageBundleItem: messageBundleRaw) { String messageBundle = null; try { messageBundle = Adapters.collapsedStringAdapterAdapter.marshal(messageBundleItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplication, "messageBundle", CollapsedStringAdapter.class, List.class, List.class, e); } - if (messageBundle != null) { + if (messageBundle!= null) { writer.writeStartElement(prefix, "message-bundle", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(messageBundle); writer.writeEndElement(); @@ -526,16 +532,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: navigationHandler - final List navigationHandlerRaw = facesApplication.navigationHandler; - if (navigationHandlerRaw != null) { - for (final String navigationHandlerItem : navigationHandlerRaw) { + List navigationHandlerRaw = facesApplication.navigationHandler; + if (navigationHandlerRaw!= null) { + for (String navigationHandlerItem: navigationHandlerRaw) { String navigationHandler = null; try { navigationHandler = Adapters.collapsedStringAdapterAdapter.marshal(navigationHandlerItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplication, "navigationHandler", CollapsedStringAdapter.class, List.class, List.class, e); } - if (navigationHandler != null) { + if (navigationHandler!= null) { writer.writeStartElement(prefix, "navigation-handler", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(navigationHandler); writer.writeEndElement(); @@ -544,16 +550,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: viewHandler - final List viewHandlerRaw = facesApplication.viewHandler; - if (viewHandlerRaw != null) { - for (final String viewHandlerItem : viewHandlerRaw) { + List viewHandlerRaw = facesApplication.viewHandler; + if (viewHandlerRaw!= null) { + for (String viewHandlerItem: viewHandlerRaw) { String viewHandler = null; try { viewHandler = Adapters.collapsedStringAdapterAdapter.marshal(viewHandlerItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplication, "viewHandler", CollapsedStringAdapter.class, List.class, List.class, e); } - if (viewHandler != null) { + if (viewHandler!= null) { writer.writeStartElement(prefix, "view-handler", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(viewHandler); writer.writeEndElement(); @@ -562,16 +568,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: stateManager - final List stateManagerRaw = facesApplication.stateManager; - if (stateManagerRaw != null) { - for (final String stateManagerItem : stateManagerRaw) { + List stateManagerRaw = facesApplication.stateManager; + if (stateManagerRaw!= null) { + for (String stateManagerItem: stateManagerRaw) { String stateManager = null; try { stateManager = Adapters.collapsedStringAdapterAdapter.marshal(stateManagerItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplication, "stateManager", CollapsedStringAdapter.class, List.class, List.class, e); } - if (stateManager != null) { + if (stateManager!= null) { writer.writeStartElement(prefix, "state-manager", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(stateManager); writer.writeEndElement(); @@ -580,16 +586,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: elResolver - final List elResolverRaw = facesApplication.elResolver; - if (elResolverRaw != null) { - for (final String elResolverItem : elResolverRaw) { + List elResolverRaw = facesApplication.elResolver; + if (elResolverRaw!= null) { + for (String elResolverItem: elResolverRaw) { String elResolver = null; try { elResolver = Adapters.collapsedStringAdapterAdapter.marshal(elResolverItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplication, "elResolver", CollapsedStringAdapter.class, List.class, List.class, e); } - if (elResolver != null) { + if (elResolver!= null) { writer.writeStartElement(prefix, "el-resolver", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(elResolver); writer.writeEndElement(); @@ -598,16 +604,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: propertyResolver - final List propertyResolverRaw = facesApplication.propertyResolver; - if (propertyResolverRaw != null) { - for (final String propertyResolverItem : propertyResolverRaw) { + List propertyResolverRaw = facesApplication.propertyResolver; + if (propertyResolverRaw!= null) { + for (String propertyResolverItem: propertyResolverRaw) { String propertyResolver = null; try { propertyResolver = Adapters.collapsedStringAdapterAdapter.marshal(propertyResolverItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplication, "propertyResolver", CollapsedStringAdapter.class, List.class, List.class, e); } - if (propertyResolver != null) { + if (propertyResolver!= null) { writer.writeStartElement(prefix, "property-resolver", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(propertyResolver); writer.writeEndElement(); @@ -616,16 +622,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: variableResolver - final List variableResolverRaw = facesApplication.variableResolver; - if (variableResolverRaw != null) { - for (final String variableResolverItem : variableResolverRaw) { + List variableResolverRaw = facesApplication.variableResolver; + if (variableResolverRaw!= null) { + for (String variableResolverItem: variableResolverRaw) { String variableResolver = null; try { variableResolver = Adapters.collapsedStringAdapterAdapter.marshal(variableResolverItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplication, "variableResolver", CollapsedStringAdapter.class, List.class, List.class, e); } - if (variableResolver != null) { + if (variableResolver!= null) { writer.writeStartElement(prefix, "variable-resolver", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(variableResolver); writer.writeEndElement(); @@ -634,16 +640,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: resourceHandler - final List resourceHandlerRaw = facesApplication.resourceHandler; - if (resourceHandlerRaw != null) { - for (final String resourceHandlerItem : resourceHandlerRaw) { + List resourceHandlerRaw = facesApplication.resourceHandler; + if (resourceHandlerRaw!= null) { + for (String resourceHandlerItem: resourceHandlerRaw) { String resourceHandler = null; try { resourceHandler = Adapters.collapsedStringAdapterAdapter.marshal(resourceHandlerItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplication, "resourceHandler", CollapsedStringAdapter.class, List.class, List.class, e); } - if (resourceHandler != null) { + if (resourceHandler!= null) { writer.writeStartElement(prefix, "resource-handler", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(resourceHandler); writer.writeEndElement(); @@ -652,10 +658,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: systemEventListener - final List systemEventListener = facesApplication.systemEventListener; - if (systemEventListener != null) { - for (final FacesSystemEventListener systemEventListenerItem : systemEventListener) { - if (systemEventListenerItem != null) { + List systemEventListener = facesApplication.systemEventListener; + if (systemEventListener!= null) { + for (FacesSystemEventListener systemEventListenerItem: systemEventListener) { + if (systemEventListenerItem!= null) { writer.writeStartElement(prefix, "system-event-listener", "http://java.sun.com/xml/ns/javaee"); writeFacesSystemEventListener(writer, systemEventListenerItem, context); writer.writeEndElement(); @@ -664,10 +670,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: localeConfig - final List localeConfig = facesApplication.localeConfig; - if (localeConfig != null) { - for (final FacesLocaleConfig localeConfigItem : localeConfig) { - if (localeConfigItem != null) { + List localeConfig = facesApplication.localeConfig; + if (localeConfig!= null) { + for (FacesLocaleConfig localeConfigItem: localeConfig) { + if (localeConfigItem!= null) { writer.writeStartElement(prefix, "locale-config", "http://java.sun.com/xml/ns/javaee"); writeFacesLocaleConfig(writer, localeConfigItem, context); writer.writeEndElement(); @@ -676,8 +682,8 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: resourceBundle - final FacesApplicationResourceBundle resourceBundle = facesApplication.resourceBundle; - if (resourceBundle != null) { + FacesApplicationResourceBundle resourceBundle = facesApplication.resourceBundle; + if (resourceBundle!= null) { writer.writeStartElement(prefix, "resource-bundle", "http://java.sun.com/xml/ns/javaee"); writeFacesApplicationResourceBundle(writer, resourceBundle, context); writer.writeEndElement(); @@ -686,10 +692,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: applicationExtension - final List applicationExtension = facesApplication.applicationExtension; - if (applicationExtension != null) { - for (final FacesApplicationExtension applicationExtensionItem : applicationExtension) { - if (applicationExtensionItem != null) { + List applicationExtension = facesApplication.applicationExtension; + if (applicationExtension!= null) { + for (FacesApplicationExtension applicationExtensionItem: applicationExtension) { + if (applicationExtensionItem!= null) { writer.writeStartElement(prefix, "application-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesApplicationExtension(writer, applicationExtensionItem, context); writer.writeEndElement(); @@ -698,10 +704,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: defaultValidators - final List defaultValidators = facesApplication.defaultValidators; - if (defaultValidators != null) { - for (final FacesValidator defaultValidatorsItem : defaultValidators) { - if (defaultValidatorsItem != null) { + List defaultValidators = facesApplication.defaultValidators; + if (defaultValidators!= null) { + for (FacesValidator defaultValidatorsItem: defaultValidators) { + if (defaultValidatorsItem!= null) { writer.writeStartElement(prefix, "default-validators", "http://java.sun.com/xml/ns/javaee"); writeFacesValidator(writer, defaultValidatorsItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplicationExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplicationExtension$JAXB.java index 839dfb3bdfc..04b33ffd9b2 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplicationExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplicationExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesApplicationExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesApplicationExtension$JAXB() { super(FacesApplicationExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-application-extensionType".intern())); } - public static FacesApplicationExtension readFacesApplicationExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesApplicationExtension readFacesApplicationExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesApplicationExtension(final XoXMLStreamWriter writer, final FacesApplicationExtension facesApplicationExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesApplicationExtension(XoXMLStreamWriter writer, FacesApplicationExtension facesApplicationExtension, RuntimeContext context) + throws Exception + { _write(writer, facesApplicationExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesApplicationExtension facesApplicationExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesApplicationExtension facesApplicationExtension, RuntimeContext context) + throws Exception + { _write(writer, facesApplicationExtension, context); } - public final static FacesApplicationExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesApplicationExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesApplicationExtension _read(final XoXMLStreamReader read context = new RuntimeContext(); } - final FacesApplicationExtension facesApplicationExtension = new FacesApplicationExtension(); + FacesApplicationExtension facesApplicationExtension = new FacesApplicationExtension(); context.beforeUnmarshal(facesApplicationExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-application-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-application-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesApplicationExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesApplicationExtension); facesApplicationExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesApplicationExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesApplicationExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesApplicationExtension _read(final XoXMLStreamReader read return facesApplicationExtension; } - public final FacesApplicationExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesApplicationExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesApplicationExtension facesApplicationExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesApplicationExtension facesApplicationExtension, RuntimeContext context) + throws Exception + { if (facesApplicationExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesApplicationExtension.class != facesApplicationExtension.getClass()) { + if (FacesApplicationExtension.class!= facesApplicationExtension.getClass()) { context.unexpectedSubclass(writer, facesApplicationExtension, FacesApplicationExtension.class); - return; + return ; } context.beforeMarshal(facesApplicationExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesApplicationExtension.id; - if (idRaw != null) { + String idRaw = facesApplicationExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplicationExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesApplicationExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesApplicationExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesApplicationExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplicationResourceBundle$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplicationResourceBundle$JAXB.java index f116264364f..ba089c3724b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplicationResourceBundle$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplicationResourceBundle$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -37,30 +38,35 @@ "StringEquality" }) public class FacesApplicationResourceBundle$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesApplicationResourceBundle$JAXB() { super(FacesApplicationResourceBundle.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-application-resource-bundleType".intern()), Text$JAXB.class, Icon$JAXB.class); } - public static FacesApplicationResourceBundle readFacesApplicationResourceBundle(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesApplicationResourceBundle readFacesApplicationResourceBundle(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesApplicationResourceBundle(final XoXMLStreamWriter writer, final FacesApplicationResourceBundle facesApplicationResourceBundle, final RuntimeContext context) - throws Exception { + public static void writeFacesApplicationResourceBundle(XoXMLStreamWriter writer, FacesApplicationResourceBundle facesApplicationResourceBundle, RuntimeContext context) + throws Exception + { _write(writer, facesApplicationResourceBundle, context); } - public void write(final XoXMLStreamWriter writer, final FacesApplicationResourceBundle facesApplicationResourceBundle, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesApplicationResourceBundle facesApplicationResourceBundle, RuntimeContext context) + throws Exception + { _write(writer, facesApplicationResourceBundle, context); } - public final static FacesApplicationResourceBundle _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesApplicationResourceBundle _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -71,7 +77,7 @@ public final static FacesApplicationResourceBundle _read(final XoXMLStreamReader context = new RuntimeContext(); } - final FacesApplicationResourceBundle facesApplicationResourceBundle = new FacesApplicationResourceBundle(); + FacesApplicationResourceBundle facesApplicationResourceBundle = new FacesApplicationResourceBundle(); context.beforeUnmarshal(facesApplicationResourceBundle, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -79,74 +85,74 @@ public final static FacesApplicationResourceBundle _read(final XoXMLStreamReader LocalCollection icon = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-application-resource-bundleType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-application-resource-bundleType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesApplicationResourceBundle.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesApplicationResourceBundle); facesApplicationResourceBundle.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesApplicationResourceBundle.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("base-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("base-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: baseName - final String baseNameRaw = elementReader.getElementAsString(); + String baseNameRaw = elementReader.getElementText(); - final String baseName; + String baseName; try { baseName = Adapters.collapsedStringAdapterAdapter.unmarshal(baseNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesApplicationResourceBundle.baseName = baseName; - } else if (("var" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("var" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: var - final String varRaw = elementReader.getElementAsString(); + String varRaw = elementReader.getElementText(); - final String var; + String var; try { var = Adapters.collapsedStringAdapterAdapter.unmarshal(varRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -156,21 +162,21 @@ public final static FacesApplicationResourceBundle _read(final XoXMLStreamReader 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", "base-name"), new QName("http://java.sun.com/xml/ns/javaee", "var")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesApplicationResourceBundle.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesApplicationResourceBundle.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesApplicationResourceBundle.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesApplicationResourceBundle.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesApplicationResourceBundle.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesApplicationResourceBundle.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesApplicationResourceBundle.icon = icon; } @@ -179,38 +185,40 @@ public final static FacesApplicationResourceBundle _read(final XoXMLStreamReader return facesApplicationResourceBundle; } - public final FacesApplicationResourceBundle read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesApplicationResourceBundle read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesApplicationResourceBundle facesApplicationResourceBundle, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesApplicationResourceBundle facesApplicationResourceBundle, RuntimeContext context) + throws Exception + { if (facesApplicationResourceBundle == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesApplicationResourceBundle.class != facesApplicationResourceBundle.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesApplicationResourceBundle.class!= facesApplicationResourceBundle.getClass()) { context.unexpectedSubclass(writer, facesApplicationResourceBundle, FacesApplicationResourceBundle.class); - return; + return ; } context.beforeMarshal(facesApplicationResourceBundle, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesApplicationResourceBundle.id; - if (idRaw != null) { + String idRaw = facesApplicationResourceBundle.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplicationResourceBundle, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -220,12 +228,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli Text[] descriptions = null; try { descriptions = facesApplicationResourceBundle.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesApplicationResourceBundle, "descriptions", FacesApplicationResourceBundle.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -239,12 +247,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli Text[] displayNames = null; try { displayNames = facesApplicationResourceBundle.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesApplicationResourceBundle, "displayNames", FacesApplicationResourceBundle.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -255,10 +263,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: icon - final LocalCollection icon = facesApplicationResourceBundle.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesApplicationResourceBundle.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -269,14 +277,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: baseName - final String baseNameRaw = facesApplicationResourceBundle.baseName; + String baseNameRaw = facesApplicationResourceBundle.baseName; String baseName = null; try { baseName = Adapters.collapsedStringAdapterAdapter.marshal(baseNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplicationResourceBundle, "baseName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (baseName != null) { + if (baseName!= null) { writer.writeStartElement(prefix, "base-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(baseName); writer.writeEndElement(); @@ -285,14 +293,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAppli } // ELEMENT: var - final String varRaw = facesApplicationResourceBundle.var; + String varRaw = facesApplicationResourceBundle.var; String var = null; try { var = Adapters.collapsedStringAdapterAdapter.marshal(varRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesApplicationResourceBundle, "var", CollapsedStringAdapter.class, String.class, String.class, e); } - if (var != null) { + if (var!= null) { writer.writeStartElement(prefix, "var", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(var); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAttribute$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAttribute$JAXB.java index b2926fbaa93..c837962d170 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAttribute$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAttribute$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesAttributeExtension$JAXB.readFacesAttributeExtension; import static org.apache.openejb.jee.FacesAttributeExtension$JAXB.writeFacesAttributeExtension; @@ -40,30 +41,35 @@ "StringEquality" }) public class FacesAttribute$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesAttribute$JAXB() { super(FacesAttribute.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-attributeType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesAttributeExtension$JAXB.class); } - public static FacesAttribute readFacesAttribute(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesAttribute readFacesAttribute(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesAttribute(final XoXMLStreamWriter writer, final FacesAttribute facesAttribute, final RuntimeContext context) - throws Exception { + public static void writeFacesAttribute(XoXMLStreamWriter writer, FacesAttribute facesAttribute, RuntimeContext context) + throws Exception + { _write(writer, facesAttribute, context); } - public void write(final XoXMLStreamWriter writer, final FacesAttribute facesAttribute, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesAttribute facesAttribute, RuntimeContext context) + throws Exception + { _write(writer, facesAttribute, context); } - public final static FacesAttribute _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesAttribute _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,7 +80,7 @@ public final static FacesAttribute _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final FacesAttribute facesAttribute = new FacesAttribute(); + FacesAttribute facesAttribute = new FacesAttribute(); context.beforeUnmarshal(facesAttribute, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -83,114 +89,114 @@ public final static FacesAttribute _read(final XoXMLStreamReader reader, Runtime List attributeExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-attributeType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-attributeType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesAttribute.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesAttribute); facesAttribute.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesAttribute.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("attribute-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("attribute-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: attributeName - final String attributeNameRaw = elementReader.getElementAsString(); + String attributeNameRaw = elementReader.getElementText(); - final String attributeName; + String attributeName; try { attributeName = Adapters.collapsedStringAdapterAdapter.unmarshal(attributeNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesAttribute.attributeName = attributeName; - } else if (("attribute-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("attribute-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: attributeClass - final String attributeClassRaw = elementReader.getElementAsString(); + String attributeClassRaw = elementReader.getElementText(); - final String attributeClass; + String attributeClass; try { attributeClass = Adapters.collapsedStringAdapterAdapter.unmarshal(attributeClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesAttribute.attributeClass = attributeClass; - } else if (("default-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("default-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: defaultValue - final String defaultValueRaw = elementReader.getElementAsString(); + String defaultValueRaw = elementReader.getElementText(); - final String defaultValue; + String defaultValue; try { defaultValue = Adapters.collapsedStringAdapterAdapter.unmarshal(defaultValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesAttribute.defaultValue = defaultValue; - } else if (("suggested-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("suggested-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: suggestedValue - final String suggestedValueRaw = elementReader.getElementAsString(); + String suggestedValueRaw = elementReader.getElementText(); - final String suggestedValue; + String suggestedValue; try { suggestedValue = Adapters.collapsedStringAdapterAdapter.unmarshal(suggestedValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesAttribute.suggestedValue = suggestedValue; - } else if (("attribute-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("attribute-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: attributeExtension - final FacesAttributeExtension attributeExtensionItem = readFacesAttributeExtension(elementReader, context); + FacesAttributeExtension attributeExtensionItem = readFacesAttributeExtension(elementReader, context); if (attributeExtension == null) { attributeExtension = facesAttribute.attributeExtension; - if (attributeExtension != null) { + if (attributeExtension!= null) { attributeExtension.clear(); } else { - attributeExtension = new ArrayList(); + attributeExtension = new ArrayList<>(); } } attributeExtension.add(attributeExtensionItem); @@ -198,24 +204,24 @@ public final static FacesAttribute _read(final XoXMLStreamReader reader, Runtime 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", "attribute-name"), new QName("http://java.sun.com/xml/ns/javaee", "attribute-class"), new QName("http://java.sun.com/xml/ns/javaee", "default-value"), new QName("http://java.sun.com/xml/ns/javaee", "suggested-value"), new QName("http://java.sun.com/xml/ns/javaee", "attribute-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesAttribute.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesAttribute.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesAttribute.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesAttribute.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesAttribute.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesAttribute.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesAttribute.icon = icon; } - if (attributeExtension != null) { + if (attributeExtension!= null) { facesAttribute.attributeExtension = attributeExtension; } @@ -224,38 +230,40 @@ public final static FacesAttribute _read(final XoXMLStreamReader reader, Runtime return facesAttribute; } - public final FacesAttribute read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesAttribute read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesAttribute facesAttribute, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesAttribute facesAttribute, RuntimeContext context) + throws Exception + { if (facesAttribute == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesAttribute.class != facesAttribute.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesAttribute.class!= facesAttribute.getClass()) { context.unexpectedSubclass(writer, facesAttribute, FacesAttribute.class); - return; + return ; } context.beforeMarshal(facesAttribute, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesAttribute.id; - if (idRaw != null) { + String idRaw = facesAttribute.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesAttribute, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -265,12 +273,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAttri Text[] descriptions = null; try { descriptions = facesAttribute.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesAttribute, "descriptions", FacesAttribute.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -284,12 +292,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAttri Text[] displayNames = null; try { displayNames = facesAttribute.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesAttribute, "displayNames", FacesAttribute.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -300,10 +308,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAttri } // ELEMENT: icon - final LocalCollection icon = facesAttribute.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesAttribute.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -314,14 +322,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAttri } // ELEMENT: attributeName - final String attributeNameRaw = facesAttribute.attributeName; + String attributeNameRaw = facesAttribute.attributeName; String attributeName = null; try { attributeName = Adapters.collapsedStringAdapterAdapter.marshal(attributeNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesAttribute, "attributeName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (attributeName != null) { + if (attributeName!= null) { writer.writeStartElement(prefix, "attribute-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(attributeName); writer.writeEndElement(); @@ -330,14 +338,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAttri } // ELEMENT: attributeClass - final String attributeClassRaw = facesAttribute.attributeClass; + String attributeClassRaw = facesAttribute.attributeClass; String attributeClass = null; try { attributeClass = Adapters.collapsedStringAdapterAdapter.marshal(attributeClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesAttribute, "attributeClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (attributeClass != null) { + if (attributeClass!= null) { writer.writeStartElement(prefix, "attribute-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(attributeClass); writer.writeEndElement(); @@ -346,38 +354,38 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesAttri } // ELEMENT: defaultValue - final String defaultValueRaw = facesAttribute.defaultValue; + String defaultValueRaw = facesAttribute.defaultValue; String defaultValue = null; try { defaultValue = Adapters.collapsedStringAdapterAdapter.marshal(defaultValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesAttribute, "defaultValue", CollapsedStringAdapter.class, String.class, String.class, e); } - if (defaultValue != null) { + if (defaultValue!= null) { writer.writeStartElement(prefix, "default-value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(defaultValue); writer.writeEndElement(); } // ELEMENT: suggestedValue - final String suggestedValueRaw = facesAttribute.suggestedValue; + String suggestedValueRaw = facesAttribute.suggestedValue; String suggestedValue = null; try { suggestedValue = Adapters.collapsedStringAdapterAdapter.marshal(suggestedValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesAttribute, "suggestedValue", CollapsedStringAdapter.class, String.class, String.class, e); } - if (suggestedValue != null) { + if (suggestedValue!= null) { writer.writeStartElement(prefix, "suggested-value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(suggestedValue); writer.writeEndElement(); } // ELEMENT: attributeExtension - final List attributeExtension = facesAttribute.attributeExtension; - if (attributeExtension != null) { - for (final FacesAttributeExtension attributeExtensionItem : attributeExtension) { - if (attributeExtensionItem != null) { + List attributeExtension = facesAttribute.attributeExtension; + if (attributeExtension!= null) { + for (FacesAttributeExtension attributeExtensionItem: attributeExtension) { + if (attributeExtensionItem!= null) { writer.writeStartElement(prefix, "attribute-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesAttributeExtension(writer, attributeExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAttributeExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAttributeExtension$JAXB.java index 269a74209ad..f95abe9ef4f 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAttributeExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAttributeExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesAttributeExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesAttributeExtension$JAXB() { super(FacesAttributeExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-attribute-extensionType".intern())); } - public static FacesAttributeExtension readFacesAttributeExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesAttributeExtension readFacesAttributeExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesAttributeExtension(final XoXMLStreamWriter writer, final FacesAttributeExtension facesAttributeExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesAttributeExtension(XoXMLStreamWriter writer, FacesAttributeExtension facesAttributeExtension, RuntimeContext context) + throws Exception + { _write(writer, facesAttributeExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesAttributeExtension facesAttributeExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesAttributeExtension facesAttributeExtension, RuntimeContext context) + throws Exception + { _write(writer, facesAttributeExtension, context); } - public final static FacesAttributeExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesAttributeExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesAttributeExtension _read(final XoXMLStreamReader reader context = new RuntimeContext(); } - final FacesAttributeExtension facesAttributeExtension = new FacesAttributeExtension(); + FacesAttributeExtension facesAttributeExtension = new FacesAttributeExtension(); context.beforeUnmarshal(facesAttributeExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-attribute-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-attribute-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesAttributeExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesAttributeExtension); facesAttributeExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesAttributeExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesAttributeExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesAttributeExtension _read(final XoXMLStreamReader reader return facesAttributeExtension; } - public final FacesAttributeExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesAttributeExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesAttributeExtension facesAttributeExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesAttributeExtension facesAttributeExtension, RuntimeContext context) + throws Exception + { if (facesAttributeExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesAttributeExtension.class != facesAttributeExtension.getClass()) { + if (FacesAttributeExtension.class!= facesAttributeExtension.getClass()) { context.unexpectedSubclass(writer, facesAttributeExtension, FacesAttributeExtension.class); - return; + return ; } context.beforeMarshal(facesAttributeExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesAttributeExtension.id; - if (idRaw != null) { + String idRaw = facesAttributeExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesAttributeExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesAttributeExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesAttributeExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesAttributeExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehavior$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehavior$JAXB.java index b4e646f29c2..974f706391f 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehavior$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehavior$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesAttribute$JAXB.readFacesAttribute; import static org.apache.openejb.jee.FacesAttribute$JAXB.writeFacesAttribute; @@ -44,30 +45,35 @@ "StringEquality" }) public class FacesBehavior$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesBehavior$JAXB() { super(FacesBehavior.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-behaviorType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesAttribute$JAXB.class, FacesProperty$JAXB.class, FacesBehaviorExtension$JAXB.class); } - public static FacesBehavior readFacesBehavior(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesBehavior readFacesBehavior(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesBehavior(final XoXMLStreamWriter writer, final FacesBehavior facesBehavior, final RuntimeContext context) - throws Exception { + public static void writeFacesBehavior(XoXMLStreamWriter writer, FacesBehavior facesBehavior, RuntimeContext context) + throws Exception + { _write(writer, facesBehavior, context); } - public void write(final XoXMLStreamWriter writer, final FacesBehavior facesBehavior, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesBehavior facesBehavior, RuntimeContext context) + throws Exception + { _write(writer, facesBehavior, context); } - public final static FacesBehavior _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesBehavior _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -78,7 +84,7 @@ public final static FacesBehavior _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final FacesBehavior facesBehavior = new FacesBehavior(); + FacesBehavior facesBehavior = new FacesBehavior(); context.beforeUnmarshal(facesBehavior, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -89,140 +95,138 @@ public final static FacesBehavior _read(final XoXMLStreamReader reader, RuntimeC List behaviorExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-behaviorType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-behaviorType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesBehavior.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesBehavior.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("behavior-id" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("behavior-id" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: behaviorId - final String behaviorIdRaw = elementReader.getElementAsString(); + String behaviorIdRaw = elementReader.getElementText(); - final String behaviorId; + String behaviorId; try { behaviorId = Adapters.collapsedStringAdapterAdapter.unmarshal(behaviorIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesBehavior.behaviorId = behaviorId; - } else if (("behavior-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("behavior-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: behaviorClass - final String behaviorClassRaw = elementReader.getElementAsString(); + String behaviorClassRaw = elementReader.getElementText(); - final String behaviorClass; + String behaviorClass; try { behaviorClass = Adapters.collapsedStringAdapterAdapter.unmarshal(behaviorClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesBehavior.behaviorClass = behaviorClass; - } else if (("attribute" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("attribute" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: attribute - final FacesAttribute attributeItem = readFacesAttribute(elementReader, context); + FacesAttribute attributeItem = readFacesAttribute(elementReader, context); if (attribute1 == null) { attribute1 = facesBehavior.attribute; if (attribute1 != null) { - attribute1.clear(); + attribute1 .clear(); } else { - attribute1 = new ArrayList(); + attribute1 = new ArrayList<>(); } } - attribute1.add(attributeItem); - } else if (("property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + attribute1 .add(attributeItem); + } else if (("property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: property - final FacesProperty propertyItem = readFacesProperty(elementReader, context); + FacesProperty propertyItem = readFacesProperty(elementReader, context); if (property == null) { property = facesBehavior.property; - if (property != null) { + if (property!= null) { property.clear(); } else { - property = new ArrayList(); + property = new ArrayList<>(); } } property.add(propertyItem); - } else if (("behavior-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("behavior-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: behaviorExtension - final FacesBehaviorExtension behaviorExtensionItem = readFacesBehaviorExtension(elementReader, context); + FacesBehaviorExtension behaviorExtensionItem = readFacesBehaviorExtension(elementReader, context); if (behaviorExtension == null) { behaviorExtension = facesBehavior.behaviorExtension; - if (behaviorExtension != null) { + if (behaviorExtension!= null) { behaviorExtension.clear(); } else { - behaviorExtension = new ArrayList(); + behaviorExtension = new ArrayList<>(); } } behaviorExtension.add(behaviorExtensionItem); } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // 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", "behavior-id"), new QName("http://java.sun.com/xml/ns/javaee", "behavior-class"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "behavior-extension")); + 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", "behavior-id"), new QName("http://java.sun.com/xml/ns/javaee", "behavior-class"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "behavior-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesBehavior.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesBehavior.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesBehavior.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesBehavior.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesBehavior.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesBehavior.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesBehavior.icon = icon; } if (attribute1 != null) { facesBehavior.attribute = attribute1; } - if (property != null) { + if (property!= null) { facesBehavior.property = property; } - if (behaviorExtension != null) { + if (behaviorExtension!= null) { facesBehavior.behaviorExtension = behaviorExtension; } @@ -231,26 +235,28 @@ public final static FacesBehavior _read(final XoXMLStreamReader reader, RuntimeC return facesBehavior; } - public final FacesBehavior read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesBehavior read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesBehavior facesBehavior, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesBehavior facesBehavior, RuntimeContext context) + throws Exception + { if (facesBehavior == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesBehavior.class != facesBehavior.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesBehavior.class!= facesBehavior.getClass()) { context.unexpectedSubclass(writer, facesBehavior, FacesBehavior.class); - return; + return ; } context.beforeMarshal(facesBehavior, LifecycleCallback.NONE); @@ -260,12 +266,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesBehav Text[] descriptions = null; try { descriptions = facesBehavior.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesBehavior, "descriptions", FacesBehavior.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -279,12 +285,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesBehav Text[] displayNames = null; try { displayNames = facesBehavior.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesBehavior, "displayNames", FacesBehavior.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -295,10 +301,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesBehav } // ELEMENT: icon - final LocalCollection icon = facesBehavior.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesBehavior.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -309,14 +315,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesBehav } // ELEMENT: behaviorId - final String behaviorIdRaw = facesBehavior.behaviorId; + String behaviorIdRaw = facesBehavior.behaviorId; String behaviorId = null; try { behaviorId = Adapters.collapsedStringAdapterAdapter.marshal(behaviorIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesBehavior, "behaviorId", CollapsedStringAdapter.class, String.class, String.class, e); } - if (behaviorId != null) { + if (behaviorId!= null) { writer.writeStartElement(prefix, "behavior-id", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(behaviorId); writer.writeEndElement(); @@ -325,14 +331,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesBehav } // ELEMENT: behaviorClass - final String behaviorClassRaw = facesBehavior.behaviorClass; + String behaviorClassRaw = facesBehavior.behaviorClass; String behaviorClass = null; try { behaviorClass = Adapters.collapsedStringAdapterAdapter.marshal(behaviorClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesBehavior, "behaviorClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (behaviorClass != null) { + if (behaviorClass!= null) { writer.writeStartElement(prefix, "behavior-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(behaviorClass); writer.writeEndElement(); @@ -341,11 +347,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesBehav } // ELEMENT: attribute - final List attribute = facesBehavior.attribute; - if (attribute != null) { - for (final FacesAttribute attributeItem : attribute) { + List attribute = facesBehavior.attribute; + if (attribute!= null) { + for (FacesAttribute attributeItem: attribute) { writer.writeStartElement(prefix, "attribute", "http://java.sun.com/xml/ns/javaee"); - if (attributeItem != null) { + if (attributeItem!= null) { writeFacesAttribute(writer, attributeItem, context); } else { writer.writeXsiNil(); @@ -355,11 +361,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesBehav } // ELEMENT: property - final List property = facesBehavior.property; - if (property != null) { - for (final FacesProperty propertyItem : property) { + List property = facesBehavior.property; + if (property!= null) { + for (FacesProperty propertyItem: property) { writer.writeStartElement(prefix, "property", "http://java.sun.com/xml/ns/javaee"); - if (propertyItem != null) { + if (propertyItem!= null) { writeFacesProperty(writer, propertyItem, context); } else { writer.writeXsiNil(); @@ -369,10 +375,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesBehav } // ELEMENT: behaviorExtension - final List behaviorExtension = facesBehavior.behaviorExtension; - if (behaviorExtension != null) { - for (final FacesBehaviorExtension behaviorExtensionItem : behaviorExtension) { - if (behaviorExtensionItem != null) { + List behaviorExtension = facesBehavior.behaviorExtension; + if (behaviorExtension!= null) { + for (FacesBehaviorExtension behaviorExtensionItem: behaviorExtension) { + if (behaviorExtensionItem!= null) { writer.writeStartElement(prefix, "behavior-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesBehaviorExtension(writer, behaviorExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehaviorExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehaviorExtension$JAXB.java index e5e78b5ceb2..17044ec22ff 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehaviorExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehaviorExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesBehaviorExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesBehaviorExtension$JAXB() { super(FacesBehaviorExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-behavior-extensionType".intern())); } - public static FacesBehaviorExtension readFacesBehaviorExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesBehaviorExtension readFacesBehaviorExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesBehaviorExtension(final XoXMLStreamWriter writer, final FacesBehaviorExtension facesBehaviorExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesBehaviorExtension(XoXMLStreamWriter writer, FacesBehaviorExtension facesBehaviorExtension, RuntimeContext context) + throws Exception + { _write(writer, facesBehaviorExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesBehaviorExtension facesBehaviorExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesBehaviorExtension facesBehaviorExtension, RuntimeContext context) + throws Exception + { _write(writer, facesBehaviorExtension, context); } - public final static FacesBehaviorExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesBehaviorExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesBehaviorExtension _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final FacesBehaviorExtension facesBehaviorExtension = new FacesBehaviorExtension(); + FacesBehaviorExtension facesBehaviorExtension = new FacesBehaviorExtension(); context.beforeUnmarshal(facesBehaviorExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-behavior-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-behavior-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesBehaviorExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesBehaviorExtension); facesBehaviorExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesBehaviorExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesBehaviorExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesBehaviorExtension _read(final XoXMLStreamReader reader, return facesBehaviorExtension; } - public final FacesBehaviorExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesBehaviorExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesBehaviorExtension facesBehaviorExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesBehaviorExtension facesBehaviorExtension, RuntimeContext context) + throws Exception + { if (facesBehaviorExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesBehaviorExtension.class != facesBehaviorExtension.getClass()) { + if (FacesBehaviorExtension.class!= facesBehaviorExtension.getClass()) { context.unexpectedSubclass(writer, facesBehaviorExtension, FacesBehaviorExtension.class); - return; + return ; } context.beforeMarshal(facesBehaviorExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesBehaviorExtension.id; - if (idRaw != null) { + String idRaw = facesBehaviorExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesBehaviorExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesBehaviorExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesBehaviorExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesBehaviorExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesClientBehaviorRenderer$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesClientBehaviorRenderer$JAXB.java index c00337dcb60..e98cf1c6137 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesClientBehaviorRenderer$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesClientBehaviorRenderer$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class FacesClientBehaviorRenderer$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesClientBehaviorRenderer$JAXB() { super(FacesClientBehaviorRenderer.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-client-behavior-rendererType".intern())); } - public static FacesClientBehaviorRenderer readFacesClientBehaviorRenderer(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesClientBehaviorRenderer readFacesClientBehaviorRenderer(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesClientBehaviorRenderer(final XoXMLStreamWriter writer, final FacesClientBehaviorRenderer facesClientBehaviorRenderer, final RuntimeContext context) - throws Exception { + public static void writeFacesClientBehaviorRenderer(XoXMLStreamWriter writer, FacesClientBehaviorRenderer facesClientBehaviorRenderer, RuntimeContext context) + throws Exception + { _write(writer, facesClientBehaviorRenderer, context); } - public void write(final XoXMLStreamWriter writer, final FacesClientBehaviorRenderer facesClientBehaviorRenderer, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesClientBehaviorRenderer facesClientBehaviorRenderer, RuntimeContext context) + throws Exception + { _write(writer, facesClientBehaviorRenderer, context); } - public final static FacesClientBehaviorRenderer _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesClientBehaviorRenderer _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,48 +70,48 @@ public final static FacesClientBehaviorRenderer _read(final XoXMLStreamReader re context = new RuntimeContext(); } - final FacesClientBehaviorRenderer facesClientBehaviorRenderer = new FacesClientBehaviorRenderer(); + FacesClientBehaviorRenderer facesClientBehaviorRenderer = new FacesClientBehaviorRenderer(); context.beforeUnmarshal(facesClientBehaviorRenderer, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-client-behavior-rendererType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-client-behavior-rendererType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesClientBehaviorRenderer.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("client-behavior-renderer-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("client-behavior-renderer-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: clientBehaviorRendererType - final String clientBehaviorRendererTypeRaw = elementReader.getElementAsString(); + String clientBehaviorRendererTypeRaw = elementReader.getElementText(); - final String clientBehaviorRendererType; + String clientBehaviorRendererType; try { clientBehaviorRendererType = Adapters.collapsedStringAdapterAdapter.unmarshal(clientBehaviorRendererTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesClientBehaviorRenderer.clientBehaviorRendererType = clientBehaviorRendererType; - } else if (("client-behavior-renderer-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("client-behavior-renderer-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: clientBehaviorRendererClass - final String clientBehaviorRendererClassRaw = elementReader.getElementAsString(); + String clientBehaviorRendererClassRaw = elementReader.getElementText(); - final String clientBehaviorRendererClass; + String clientBehaviorRendererClass; try { clientBehaviorRendererClass = Adapters.collapsedStringAdapterAdapter.unmarshal(clientBehaviorRendererClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -122,40 +127,42 @@ public final static FacesClientBehaviorRenderer _read(final XoXMLStreamReader re return facesClientBehaviorRenderer; } - public final FacesClientBehaviorRenderer read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesClientBehaviorRenderer read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesClientBehaviorRenderer facesClientBehaviorRenderer, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesClientBehaviorRenderer facesClientBehaviorRenderer, RuntimeContext context) + throws Exception + { if (facesClientBehaviorRenderer == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesClientBehaviorRenderer.class != facesClientBehaviorRenderer.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesClientBehaviorRenderer.class!= facesClientBehaviorRenderer.getClass()) { context.unexpectedSubclass(writer, facesClientBehaviorRenderer, FacesClientBehaviorRenderer.class); - return; + return ; } context.beforeMarshal(facesClientBehaviorRenderer, LifecycleCallback.NONE); // ELEMENT: clientBehaviorRendererType - final String clientBehaviorRendererTypeRaw = facesClientBehaviorRenderer.clientBehaviorRendererType; + String clientBehaviorRendererTypeRaw = facesClientBehaviorRenderer.clientBehaviorRendererType; String clientBehaviorRendererType = null; try { clientBehaviorRendererType = Adapters.collapsedStringAdapterAdapter.marshal(clientBehaviorRendererTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesClientBehaviorRenderer, "clientBehaviorRendererType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (clientBehaviorRendererType != null) { + if (clientBehaviorRendererType!= null) { writer.writeStartElement(prefix, "client-behavior-renderer-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(clientBehaviorRendererType); writer.writeEndElement(); @@ -164,14 +171,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesClien } // ELEMENT: clientBehaviorRendererClass - final String clientBehaviorRendererClassRaw = facesClientBehaviorRenderer.clientBehaviorRendererClass; + String clientBehaviorRendererClassRaw = facesClientBehaviorRenderer.clientBehaviorRendererClass; String clientBehaviorRendererClass = null; try { clientBehaviorRendererClass = Adapters.collapsedStringAdapterAdapter.marshal(clientBehaviorRendererClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesClientBehaviorRenderer, "clientBehaviorRendererClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (clientBehaviorRendererClass != null) { + if (clientBehaviorRendererClass!= null) { writer.writeStartElement(prefix, "client-behavior-renderer-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(clientBehaviorRendererClass); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponent$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponent$JAXB.java index 853db7a9b8b..a58bacff47a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponent$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponent$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesAttribute$JAXB.readFacesAttribute; import static org.apache.openejb.jee.FacesAttribute$JAXB.writeFacesAttribute; @@ -46,30 +47,35 @@ "StringEquality" }) public class FacesComponent$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesComponent$JAXB() { super(FacesComponent.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-componentType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesFacet$JAXB.class, FacesAttribute$JAXB.class, FacesProperty$JAXB.class, FacesComponentExtension$JAXB.class); } - public static FacesComponent readFacesComponent(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesComponent readFacesComponent(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesComponent(final XoXMLStreamWriter writer, final FacesComponent facesComponent, final RuntimeContext context) - throws Exception { + public static void writeFacesComponent(XoXMLStreamWriter writer, FacesComponent facesComponent, RuntimeContext context) + throws Exception + { _write(writer, facesComponent, context); } - public void write(final XoXMLStreamWriter writer, final FacesComponent facesComponent, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesComponent facesComponent, RuntimeContext context) + throws Exception + { _write(writer, facesComponent, context); } - public final static FacesComponent _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesComponent _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -80,7 +86,7 @@ public final static FacesComponent _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final FacesComponent facesComponent = new FacesComponent(); + FacesComponent facesComponent = new FacesComponent(); context.beforeUnmarshal(facesComponent, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -92,160 +98,158 @@ public final static FacesComponent _read(final XoXMLStreamReader reader, Runtime List componentExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-componentType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-componentType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesComponent.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesComponent); facesComponent.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesComponent.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("component-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("component-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: componentType - final String componentTypeRaw = elementReader.getElementAsString(); + String componentTypeRaw = elementReader.getElementText(); - final String componentType; + String componentType; try { componentType = Adapters.collapsedStringAdapterAdapter.unmarshal(componentTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesComponent.componentType = componentType; - } else if (("component-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("component-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: componentClass - final String componentClassRaw = elementReader.getElementAsString(); + String componentClassRaw = elementReader.getElementText(); - final String componentClass; + String componentClass; try { componentClass = Adapters.collapsedStringAdapterAdapter.unmarshal(componentClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesComponent.componentClass = componentClass; - } else if (("facet" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("facet" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: facet - final FacesFacet facetItem = readFacesFacet(elementReader, context); + FacesFacet facetItem = readFacesFacet(elementReader, context); if (facet == null) { facet = facesComponent.facet; - if (facet != null) { + if (facet!= null) { facet.clear(); } else { - facet = new ArrayList(); + facet = new ArrayList<>(); } } facet.add(facetItem); - } else if (("attribute" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("attribute" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: attribute - final FacesAttribute attributeItem = readFacesAttribute(elementReader, context); + FacesAttribute attributeItem = readFacesAttribute(elementReader, context); if (attribute1 == null) { attribute1 = facesComponent.attribute; if (attribute1 != null) { - attribute1.clear(); + attribute1 .clear(); } else { - attribute1 = new ArrayList(); + attribute1 = new ArrayList<>(); } } - attribute1.add(attributeItem); - } else if (("property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + attribute1 .add(attributeItem); + } else if (("property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: property - final FacesProperty propertyItem = readFacesProperty(elementReader, context); + FacesProperty propertyItem = readFacesProperty(elementReader, context); if (property == null) { property = facesComponent.property; - if (property != null) { + if (property!= null) { property.clear(); } else { - property = new ArrayList(); + property = new ArrayList<>(); } } property.add(propertyItem); - } else if (("component-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("component-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: componentExtension - final FacesComponentExtension componentExtensionItem = readFacesComponentExtension(elementReader, context); + FacesComponentExtension componentExtensionItem = readFacesComponentExtension(elementReader, context); if (componentExtension == null) { componentExtension = facesComponent.componentExtension; - if (componentExtension != null) { + if (componentExtension!= null) { componentExtension.clear(); } else { - componentExtension = new ArrayList(); + componentExtension = new ArrayList<>(); } } componentExtension.add(componentExtensionItem); } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // 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", "component-type"), new QName("http://java.sun.com/xml/ns/javaee", "component-class"), new QName("http://java.sun.com/xml/ns/javaee", "facet"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "component-extension")); + 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", "component-type"), new QName("http://java.sun.com/xml/ns/javaee", "component-class"), new QName("http://java.sun.com/xml/ns/javaee", "facet"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "component-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesComponent.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesComponent.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesComponent.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesComponent.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesComponent.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesComponent.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesComponent.icon = icon; } - if (facet != null) { + if (facet!= null) { facesComponent.facet = facet; } if (attribute1 != null) { facesComponent.attribute = attribute1; } - if (property != null) { + if (property!= null) { facesComponent.property = property; } - if (componentExtension != null) { + if (componentExtension!= null) { facesComponent.componentExtension = componentExtension; } @@ -254,38 +258,40 @@ public final static FacesComponent _read(final XoXMLStreamReader reader, Runtime return facesComponent; } - public final FacesComponent read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesComponent read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesComponent facesComponent, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesComponent facesComponent, RuntimeContext context) + throws Exception + { if (facesComponent == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesComponent.class != facesComponent.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesComponent.class!= facesComponent.getClass()) { context.unexpectedSubclass(writer, facesComponent, FacesComponent.class); - return; + return ; } context.beforeMarshal(facesComponent, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesComponent.id; - if (idRaw != null) { + String idRaw = facesComponent.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesComponent, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -295,12 +301,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesCompo Text[] descriptions = null; try { descriptions = facesComponent.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesComponent, "descriptions", FacesComponent.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -314,12 +320,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesCompo Text[] displayNames = null; try { displayNames = facesComponent.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesComponent, "displayNames", FacesComponent.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -330,10 +336,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesCompo } // ELEMENT: icon - final LocalCollection icon = facesComponent.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesComponent.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -344,14 +350,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesCompo } // ELEMENT: componentType - final String componentTypeRaw = facesComponent.componentType; + String componentTypeRaw = facesComponent.componentType; String componentType = null; try { componentType = Adapters.collapsedStringAdapterAdapter.marshal(componentTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesComponent, "componentType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (componentType != null) { + if (componentType!= null) { writer.writeStartElement(prefix, "component-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(componentType); writer.writeEndElement(); @@ -360,14 +366,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesCompo } // ELEMENT: componentClass - final String componentClassRaw = facesComponent.componentClass; + String componentClassRaw = facesComponent.componentClass; String componentClass = null; try { componentClass = Adapters.collapsedStringAdapterAdapter.marshal(componentClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesComponent, "componentClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (componentClass != null) { + if (componentClass!= null) { writer.writeStartElement(prefix, "component-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(componentClass); writer.writeEndElement(); @@ -376,11 +382,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesCompo } // ELEMENT: facet - final List facet = facesComponent.facet; - if (facet != null) { - for (final FacesFacet facetItem : facet) { + List facet = facesComponent.facet; + if (facet!= null) { + for (FacesFacet facetItem: facet) { writer.writeStartElement(prefix, "facet", "http://java.sun.com/xml/ns/javaee"); - if (facetItem != null) { + if (facetItem!= null) { writeFacesFacet(writer, facetItem, context); } else { writer.writeXsiNil(); @@ -390,11 +396,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesCompo } // ELEMENT: attribute - final List attribute = facesComponent.attribute; - if (attribute != null) { - for (final FacesAttribute attributeItem : attribute) { + List attribute = facesComponent.attribute; + if (attribute!= null) { + for (FacesAttribute attributeItem: attribute) { writer.writeStartElement(prefix, "attribute", "http://java.sun.com/xml/ns/javaee"); - if (attributeItem != null) { + if (attributeItem!= null) { writeFacesAttribute(writer, attributeItem, context); } else { writer.writeXsiNil(); @@ -404,11 +410,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesCompo } // ELEMENT: property - final List property = facesComponent.property; - if (property != null) { - for (final FacesProperty propertyItem : property) { + List property = facesComponent.property; + if (property!= null) { + for (FacesProperty propertyItem: property) { writer.writeStartElement(prefix, "property", "http://java.sun.com/xml/ns/javaee"); - if (propertyItem != null) { + if (propertyItem!= null) { writeFacesProperty(writer, propertyItem, context); } else { writer.writeXsiNil(); @@ -418,10 +424,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesCompo } // ELEMENT: componentExtension - final List componentExtension = facesComponent.componentExtension; - if (componentExtension != null) { - for (final FacesComponentExtension componentExtensionItem : componentExtension) { - if (componentExtensionItem != null) { + List componentExtension = facesComponent.componentExtension; + if (componentExtension!= null) { + for (FacesComponentExtension componentExtensionItem: componentExtension) { + if (componentExtensionItem!= null) { writer.writeStartElement(prefix, "component-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesComponentExtension(writer, componentExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponentExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponentExtension$JAXB.java index b2be5c15d6d..6a46c726404 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponentExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponentExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesComponentExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesComponentExtension$JAXB() { super(FacesComponentExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-component-extensionType".intern())); } - public static FacesComponentExtension readFacesComponentExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesComponentExtension readFacesComponentExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesComponentExtension(final XoXMLStreamWriter writer, final FacesComponentExtension facesComponentExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesComponentExtension(XoXMLStreamWriter writer, FacesComponentExtension facesComponentExtension, RuntimeContext context) + throws Exception + { _write(writer, facesComponentExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesComponentExtension facesComponentExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesComponentExtension facesComponentExtension, RuntimeContext context) + throws Exception + { _write(writer, facesComponentExtension, context); } - public final static FacesComponentExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesComponentExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesComponentExtension _read(final XoXMLStreamReader reader context = new RuntimeContext(); } - final FacesComponentExtension facesComponentExtension = new FacesComponentExtension(); + FacesComponentExtension facesComponentExtension = new FacesComponentExtension(); context.beforeUnmarshal(facesComponentExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-component-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-component-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesComponentExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesComponentExtension); facesComponentExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesComponentExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesComponentExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesComponentExtension _read(final XoXMLStreamReader reader return facesComponentExtension; } - public final FacesComponentExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesComponentExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesComponentExtension facesComponentExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesComponentExtension facesComponentExtension, RuntimeContext context) + throws Exception + { if (facesComponentExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesComponentExtension.class != facesComponentExtension.getClass()) { + if (FacesComponentExtension.class!= facesComponentExtension.getClass()) { context.unexpectedSubclass(writer, facesComponentExtension, FacesComponentExtension.class); - return; + return ; } context.beforeMarshal(facesComponentExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesComponentExtension.id; - if (idRaw != null) { + String idRaw = facesComponentExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesComponentExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesComponentExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesComponentExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesComponentExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfig$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfig$JAXB.java index a5abe9942bf..0b3dc9d3ea0 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfig$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfig$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesAbsoluteOrdering$JAXB.readFacesAbsoluteOrdering; import static org.apache.openejb.jee.FacesAbsoluteOrdering$JAXB.writeFacesAbsoluteOrdering; @@ -37,6 +38,10 @@ import static org.apache.openejb.jee.FacesBehavior$JAXB.writeFacesBehavior; import static org.apache.openejb.jee.FacesComponent$JAXB.readFacesComponent; import static org.apache.openejb.jee.FacesComponent$JAXB.writeFacesComponent; +import static org.apache.openejb.jee.FacesConfigFlowDefinition$JAXB.readFacesConfigFlowDefinition; +import static org.apache.openejb.jee.FacesConfigFlowDefinition$JAXB.writeFacesConfigFlowDefinition; +import static org.apache.openejb.jee.FacesConfigProtectedViews$JAXB.readFacesConfigProtectedViews; +import static org.apache.openejb.jee.FacesConfigProtectedViews$JAXB.writeFacesConfigProtectedViews; import static org.apache.openejb.jee.FacesConverter$JAXB.readFacesConverter; import static org.apache.openejb.jee.FacesConverter$JAXB.writeFacesConverter; import static org.apache.openejb.jee.FacesExtension$JAXB.readFacesExtension; @@ -62,30 +67,35 @@ "StringEquality" }) public class FacesConfig$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesConfig$JAXB() { - super(FacesConfig.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-configType".intern()), FacesApplication$JAXB.class, FacesOrdering$JAXB.class, FacesAbsoluteOrdering$JAXB.class, FacesFactory$JAXB.class, FacesComponent$JAXB.class, FacesConverter$JAXB.class, FacesManagedBean$JAXB.class, FacesNavigationRule$JAXB.class, FacesReferencedBean$JAXB.class, FacesRenderKit$JAXB.class, FacesLifecycle$JAXB.class, FacesValidator$JAXB.class, FacesBehavior$JAXB.class, FacesExtension$JAXB.class); + super(FacesConfig.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-configType".intern()), FacesApplication$JAXB.class, FacesOrdering$JAXB.class, FacesAbsoluteOrdering$JAXB.class, FacesFactory$JAXB.class, FacesComponent$JAXB.class, FacesConverter$JAXB.class, FacesManagedBean$JAXB.class, FacesNavigationRule$JAXB.class, FacesReferencedBean$JAXB.class, FacesRenderKit$JAXB.class, FacesLifecycle$JAXB.class, FacesValidator$JAXB.class, FacesBehavior$JAXB.class, FacesExtension$JAXB.class, FacesConfigFlowDefinition$JAXB.class, FacesConfigProtectedViews$JAXB.class); } - public static FacesConfig readFacesConfig(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesConfig readFacesConfig(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesConfig(final XoXMLStreamWriter writer, final FacesConfig facesConfig, final RuntimeContext context) - throws Exception { + public static void writeFacesConfig(XoXMLStreamWriter writer, FacesConfig facesConfig, RuntimeContext context) + throws Exception + { _write(writer, facesConfig, context); } - public void write(final XoXMLStreamWriter writer, final FacesConfig facesConfig, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesConfig facesConfig, RuntimeContext context) + throws Exception + { _write(writer, facesConfig, context); } - public final static FacesConfig _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesConfig _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -96,7 +106,7 @@ public final static FacesConfig _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final FacesConfig facesConfig = new FacesConfig(); + FacesConfig facesConfig = new FacesConfig(); context.beforeUnmarshal(facesConfig, LifecycleCallback.NONE); List application = null; @@ -114,347 +124,378 @@ public final static FacesConfig _read(final XoXMLStreamReader reader, RuntimeCon List validator = null; List behavior = null; List facesConfigExtension = null; + List flowDefinitions = null; + List protectedViews = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-configType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesConfig.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesConfig); facesConfig.id = id; - } else if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("version" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: version facesConfig.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); - } else if (("metadata-complete" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("metadata-complete" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: metadataComplete - final Boolean metadataComplete = ("1".equals(attribute.getValue()) || "true".equals(attribute.getValue())); + Boolean metadataComplete = ("1".equals(attribute.getValue())||"true".equals(attribute.getValue())); facesConfig.metadataComplete = metadataComplete; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "version"), new QName("", "metadata-complete")); } } // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("application" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("application" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: application - final FacesApplication applicationItem = readFacesApplication(elementReader, context); + FacesApplication applicationItem = readFacesApplication(elementReader, context); if (application == null) { application = facesConfig.application; - if (application != null) { + if (application!= null) { application.clear(); } else { - application = new ArrayList(); + application = new ArrayList<>(); } } application.add(applicationItem); - } else if (("ordering" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ordering" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ordering - final FacesOrdering orderingItem = readFacesOrdering(elementReader, context); + FacesOrdering orderingItem = readFacesOrdering(elementReader, context); if (ordering == null) { ordering = facesConfig.ordering; - if (ordering != null) { + if (ordering!= null) { ordering.clear(); } else { - ordering = new ArrayList(); + ordering = new ArrayList<>(); } } ordering.add(orderingItem); - } else if (("absolute-ordering" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("absolute-ordering" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: absoluteOrdering - final FacesAbsoluteOrdering absoluteOrderingItem = readFacesAbsoluteOrdering(elementReader, context); + FacesAbsoluteOrdering absoluteOrderingItem = readFacesAbsoluteOrdering(elementReader, context); if (absoluteOrdering == null) { absoluteOrdering = facesConfig.absoluteOrdering; - if (absoluteOrdering != null) { + if (absoluteOrdering!= null) { absoluteOrdering.clear(); } else { - absoluteOrdering = new ArrayList(); + absoluteOrdering = new ArrayList<>(); } } absoluteOrdering.add(absoluteOrderingItem); - } else if (("factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: factory - final FacesFactory factoryItem = readFacesFactory(elementReader, context); + FacesFactory factoryItem = readFacesFactory(elementReader, context); if (factory == null) { factory = facesConfig.factory; - if (factory != null) { + if (factory!= null) { factory.clear(); } else { - factory = new ArrayList(); + factory = new ArrayList<>(); } } factory.add(factoryItem); - } else if (("component" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("component" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: component - final FacesComponent componentItem = readFacesComponent(elementReader, context); + FacesComponent componentItem = readFacesComponent(elementReader, context); if (component == null) { component = facesConfig.component; - if (component != null) { + if (component!= null) { component.clear(); } else { - component = new ArrayList(); + component = new ArrayList<>(); } } component.add(componentItem); - } else if (("converter" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("converter" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: converter - final FacesConverter converterItem = readFacesConverter(elementReader, context); + FacesConverter converterItem = readFacesConverter(elementReader, context); if (converter == null) { converter = facesConfig.converter; - if (converter != null) { + if (converter!= null) { converter.clear(); } else { - converter = new ArrayList(); + converter = new ArrayList<>(); } } converter.add(converterItem); - } else if (("managed-bean" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("managed-bean" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: managedBean - final FacesManagedBean managedBeanItem = readFacesManagedBean(elementReader, context); + FacesManagedBean managedBeanItem = readFacesManagedBean(elementReader, context); if (managedBean == null) { managedBean = facesConfig.managedBean; - if (managedBean != null) { + if (managedBean!= null) { managedBean.clear(); } else { - managedBean = new ArrayList(); + managedBean = new ArrayList<>(); } } managedBean.add(managedBeanItem); - } else if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: name String nameItemRaw = null; if (!elementReader.isXsiNil()) { - nameItemRaw = elementReader.getElementAsString(); + nameItemRaw = elementReader.getElementText(); } - final String nameItem; + String nameItem; try { nameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(nameItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (name == null) { name = facesConfig.name; - if (name != null) { + if (name!= null) { name.clear(); } else { - name = new ArrayList(); + name = new ArrayList<>(); } } name.add(nameItem); - } else if (("navigation-rule" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("navigation-rule" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: navigationRule - final FacesNavigationRule navigationRuleItem = readFacesNavigationRule(elementReader, context); + FacesNavigationRule navigationRuleItem = readFacesNavigationRule(elementReader, context); if (navigationRule == null) { navigationRule = facesConfig.navigationRule; - if (navigationRule != null) { + if (navigationRule!= null) { navigationRule.clear(); } else { - navigationRule = new ArrayList(); + navigationRule = new ArrayList<>(); } } navigationRule.add(navigationRuleItem); - } else if (("referenced-bean" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("referenced-bean" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: referencedBean - final FacesReferencedBean referencedBeanItem = readFacesReferencedBean(elementReader, context); + FacesReferencedBean referencedBeanItem = readFacesReferencedBean(elementReader, context); if (referencedBean == null) { referencedBean = facesConfig.referencedBean; - if (referencedBean != null) { + if (referencedBean!= null) { referencedBean.clear(); } else { - referencedBean = new ArrayList(); + referencedBean = new ArrayList<>(); } } referencedBean.add(referencedBeanItem); - } else if (("render-kit" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("render-kit" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: renderKit - final FacesRenderKit renderKitItem = readFacesRenderKit(elementReader, context); + FacesRenderKit renderKitItem = readFacesRenderKit(elementReader, context); if (renderKit == null) { renderKit = facesConfig.renderKit; - if (renderKit != null) { + if (renderKit!= null) { renderKit.clear(); } else { - renderKit = new ArrayList(); + renderKit = new ArrayList<>(); } } renderKit.add(renderKitItem); - } else if (("lifecycle" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lifecycle" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lifecycle - final FacesLifecycle lifecycleItem = readFacesLifecycle(elementReader, context); + FacesLifecycle lifecycleItem = readFacesLifecycle(elementReader, context); if (lifecycle == null) { lifecycle = facesConfig.lifecycle; - if (lifecycle != null) { + if (lifecycle!= null) { lifecycle.clear(); } else { - lifecycle = new ArrayList(); + lifecycle = new ArrayList<>(); } } lifecycle.add(lifecycleItem); - } else if (("validator" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("validator" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: validator - final FacesValidator validatorItem = readFacesValidator(elementReader, context); + FacesValidator validatorItem = readFacesValidator(elementReader, context); if (validator == null) { validator = facesConfig.validator; - if (validator != null) { + if (validator!= null) { validator.clear(); } else { - validator = new ArrayList(); + validator = new ArrayList<>(); } } validator.add(validatorItem); - } else if (("behavior" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("behavior" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: behavior - final FacesBehavior behaviorItem = readFacesBehavior(elementReader, context); + FacesBehavior behaviorItem = readFacesBehavior(elementReader, context); if (behavior == null) { behavior = facesConfig.behavior; - if (behavior != null) { + if (behavior!= null) { behavior.clear(); } else { - behavior = new ArrayList(); + behavior = new ArrayList<>(); } } behavior.add(behaviorItem); - } else if (("faces-config-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("faces-config-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: facesConfigExtension - final FacesExtension facesConfigExtensionItem = readFacesExtension(elementReader, context); + FacesExtension facesConfigExtensionItem = readFacesExtension(elementReader, context); if (facesConfigExtension == null) { facesConfigExtension = facesConfig.facesConfigExtension; - if (facesConfigExtension != null) { + if (facesConfigExtension!= null) { facesConfigExtension.clear(); } else { - facesConfigExtension = new ArrayList(); + facesConfigExtension = new ArrayList<>(); } } facesConfigExtension.add(facesConfigExtensionItem); - } else if ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI()) { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: read it if we need it (= classes to add to injectable classes, other file to parse to find them etc...) + } else if (("flow-definition" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: flowDefinitions + FacesConfigFlowDefinition flowDefinitionsItem = readFacesConfigFlowDefinition(elementReader, context); + if (flowDefinitions == null) { + flowDefinitions = facesConfig.flowDefinitions; + if (flowDefinitions!= null) { + flowDefinitions.clear(); + } else { + flowDefinitions = new ArrayList<>(); + } + } + flowDefinitions.add(flowDefinitionsItem); + } else if (("protected-views" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: protectedViews + FacesConfigProtectedViews protectedViewsItem = readFacesConfigProtectedViews(elementReader, context); + if (protectedViews == null) { + protectedViews = facesConfig.protectedViews; + if (protectedViews!= null) { + protectedViews.clear(); + } else { + protectedViews = new ArrayList<>(); + } + } + protectedViews.add(protectedViewsItem); } else { - context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "application"), new QName("http://java.sun.com/xml/ns/javaee", "ordering"), new QName("http://java.sun.com/xml/ns/javaee", "absolute-ordering"), new QName("http://java.sun.com/xml/ns/javaee", "factory"), new QName("http://java.sun.com/xml/ns/javaee", "component"), new QName("http://java.sun.com/xml/ns/javaee", "converter"), new QName("http://java.sun.com/xml/ns/javaee", "managed-bean"), new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-rule"), new QName("http://java.sun.com/xml/ns/javaee", "referenced-bean"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit"), new QName("http://java.sun.com/xml/ns/javaee", "lifecycle"), new QName("http://java.sun.com/xml/ns/javaee", "validator"), new QName("http://java.sun.com/xml/ns/javaee", "behavior"), new QName("http://java.sun.com/xml/ns/javaee", "faces-config-extension")); + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "application"), new QName("http://java.sun.com/xml/ns/javaee", "ordering"), new QName("http://java.sun.com/xml/ns/javaee", "absolute-ordering"), new QName("http://java.sun.com/xml/ns/javaee", "factory"), new QName("http://java.sun.com/xml/ns/javaee", "component"), new QName("http://java.sun.com/xml/ns/javaee", "converter"), new QName("http://java.sun.com/xml/ns/javaee", "managed-bean"), new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-rule"), new QName("http://java.sun.com/xml/ns/javaee", "referenced-bean"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit"), new QName("http://java.sun.com/xml/ns/javaee", "lifecycle"), new QName("http://java.sun.com/xml/ns/javaee", "validator"), new QName("http://java.sun.com/xml/ns/javaee", "behavior"), new QName("http://java.sun.com/xml/ns/javaee", "faces-config-extension"), new QName("http://java.sun.com/xml/ns/javaee", "flow-definition"), new QName("http://java.sun.com/xml/ns/javaee", "protected-views")); } } - if (application != null) { + if (application!= null) { facesConfig.application = application; } - if (ordering != null) { + if (ordering!= null) { facesConfig.ordering = ordering; } - if (absoluteOrdering != null) { + if (absoluteOrdering!= null) { facesConfig.absoluteOrdering = absoluteOrdering; } - if (factory != null) { + if (factory!= null) { facesConfig.factory = factory; } - if (component != null) { + if (component!= null) { facesConfig.component = component; } - if (converter != null) { + if (converter!= null) { facesConfig.converter = converter; } - if (managedBean != null) { + if (managedBean!= null) { facesConfig.managedBean = managedBean; } - if (name != null) { + if (name!= null) { facesConfig.name = name; } - if (navigationRule != null) { + if (navigationRule!= null) { facesConfig.navigationRule = navigationRule; } - if (referencedBean != null) { + if (referencedBean!= null) { facesConfig.referencedBean = referencedBean; } - if (renderKit != null) { + if (renderKit!= null) { facesConfig.renderKit = renderKit; } - if (lifecycle != null) { + if (lifecycle!= null) { facesConfig.lifecycle = lifecycle; } - if (validator != null) { + if (validator!= null) { facesConfig.validator = validator; } - if (behavior != null) { + if (behavior!= null) { facesConfig.behavior = behavior; } - if (facesConfigExtension != null) { + if (facesConfigExtension!= null) { facesConfig.facesConfigExtension = facesConfigExtension; } + if (flowDefinitions!= null) { + facesConfig.flowDefinitions = flowDefinitions; + } + if (protectedViews!= null) { + facesConfig.protectedViews = protectedViews; + } context.afterUnmarshal(facesConfig, LifecycleCallback.NONE); return facesConfig; } - public final FacesConfig read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesConfig read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesConfig facesConfig, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesConfig facesConfig, RuntimeContext context) + throws Exception + { if (facesConfig == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesConfig.class != facesConfig.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesConfig.class!= facesConfig.getClass()) { context.unexpectedSubclass(writer, facesConfig, FacesConfig.class); - return; + return ; } context.beforeMarshal(facesConfig, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesConfig.id; - if (idRaw != null) { + String idRaw = facesConfig.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesConfig, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: version - final String versionRaw = facesConfig.version; - if (versionRaw != null) { + String versionRaw = facesConfig.version; + if (versionRaw!= null) { String version = null; try { version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesConfig, "version", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "version", version); } // ATTRIBUTE: metadataComplete - final Boolean metadataComplete = facesConfig.metadataComplete; - if (metadataComplete != null) { + Boolean metadataComplete = facesConfig.metadataComplete; + if (metadataComplete!= null) { writer.writeAttribute("", "", "metadata-complete", Boolean.toString(metadataComplete)); } // ELEMENT: application - final List application = facesConfig.application; - if (application != null) { - for (final FacesApplication applicationItem : application) { + List application = facesConfig.application; + if (application!= null) { + for (FacesApplication applicationItem: application) { writer.writeStartElement(prefix, "application", "http://java.sun.com/xml/ns/javaee"); - if (applicationItem != null) { + if (applicationItem!= null) { writeFacesApplication(writer, applicationItem, context); } else { writer.writeXsiNil(); @@ -464,11 +505,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: ordering - final List ordering = facesConfig.ordering; - if (ordering != null) { - for (final FacesOrdering orderingItem : ordering) { + List ordering = facesConfig.ordering; + if (ordering!= null) { + for (FacesOrdering orderingItem: ordering) { writer.writeStartElement(prefix, "ordering", "http://java.sun.com/xml/ns/javaee"); - if (orderingItem != null) { + if (orderingItem!= null) { writeFacesOrdering(writer, orderingItem, context); } else { writer.writeXsiNil(); @@ -478,10 +519,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: absoluteOrdering - final List absoluteOrdering = facesConfig.absoluteOrdering; - if (absoluteOrdering != null) { - for (final FacesAbsoluteOrdering absoluteOrderingItem : absoluteOrdering) { - if (absoluteOrderingItem != null) { + List absoluteOrdering = facesConfig.absoluteOrdering; + if (absoluteOrdering!= null) { + for (FacesAbsoluteOrdering absoluteOrderingItem: absoluteOrdering) { + if (absoluteOrderingItem!= null) { writer.writeStartElement(prefix, "absolute-ordering", "http://java.sun.com/xml/ns/javaee"); writeFacesAbsoluteOrdering(writer, absoluteOrderingItem, context); writer.writeEndElement(); @@ -490,11 +531,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: factory - final List factory = facesConfig.factory; - if (factory != null) { - for (final FacesFactory factoryItem : factory) { + List factory = facesConfig.factory; + if (factory!= null) { + for (FacesFactory factoryItem: factory) { writer.writeStartElement(prefix, "factory", "http://java.sun.com/xml/ns/javaee"); - if (factoryItem != null) { + if (factoryItem!= null) { writeFacesFactory(writer, factoryItem, context); } else { writer.writeXsiNil(); @@ -504,11 +545,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: component - final List component = facesConfig.component; - if (component != null) { - for (final FacesComponent componentItem : component) { + List component = facesConfig.component; + if (component!= null) { + for (FacesComponent componentItem: component) { writer.writeStartElement(prefix, "component", "http://java.sun.com/xml/ns/javaee"); - if (componentItem != null) { + if (componentItem!= null) { writeFacesComponent(writer, componentItem, context); } else { writer.writeXsiNil(); @@ -518,11 +559,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: converter - final List converter = facesConfig.converter; - if (converter != null) { - for (final FacesConverter converterItem : converter) { + List converter = facesConfig.converter; + if (converter!= null) { + for (FacesConverter converterItem: converter) { writer.writeStartElement(prefix, "converter", "http://java.sun.com/xml/ns/javaee"); - if (converterItem != null) { + if (converterItem!= null) { writeFacesConverter(writer, converterItem, context); } else { writer.writeXsiNil(); @@ -532,10 +573,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: managedBean - final List managedBean = facesConfig.managedBean; - if (managedBean != null) { - for (final FacesManagedBean managedBeanItem : managedBean) { - if (managedBeanItem != null) { + List managedBean = facesConfig.managedBean; + if (managedBean!= null) { + for (FacesManagedBean managedBeanItem: managedBean) { + if (managedBeanItem!= null) { writer.writeStartElement(prefix, "managed-bean", "http://java.sun.com/xml/ns/javaee"); writeFacesManagedBean(writer, managedBeanItem, context); writer.writeEndElement(); @@ -544,17 +585,17 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: name - final List nameRaw = facesConfig.name; - if (nameRaw != null) { - for (final String nameItem : nameRaw) { + List nameRaw = facesConfig.name; + if (nameRaw!= null) { + for (String nameItem: nameRaw) { String name = null; try { name = Adapters.collapsedStringAdapterAdapter.marshal(nameItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesConfig, "name", CollapsedStringAdapter.class, List.class, List.class, e); } writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); - if (name != null) { + if (name!= null) { writer.writeCharacters(name); } else { writer.writeXsiNil(); @@ -564,10 +605,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: navigationRule - final List navigationRule = facesConfig.navigationRule; - if (navigationRule != null) { - for (final FacesNavigationRule navigationRuleItem : navigationRule) { - if (navigationRuleItem != null) { + List navigationRule = facesConfig.navigationRule; + if (navigationRule!= null) { + for (FacesNavigationRule navigationRuleItem: navigationRule) { + if (navigationRuleItem!= null) { writer.writeStartElement(prefix, "navigation-rule", "http://java.sun.com/xml/ns/javaee"); writeFacesNavigationRule(writer, navigationRuleItem, context); writer.writeEndElement(); @@ -576,10 +617,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: referencedBean - final List referencedBean = facesConfig.referencedBean; - if (referencedBean != null) { - for (final FacesReferencedBean referencedBeanItem : referencedBean) { - if (referencedBeanItem != null) { + List referencedBean = facesConfig.referencedBean; + if (referencedBean!= null) { + for (FacesReferencedBean referencedBeanItem: referencedBean) { + if (referencedBeanItem!= null) { writer.writeStartElement(prefix, "referenced-bean", "http://java.sun.com/xml/ns/javaee"); writeFacesReferencedBean(writer, referencedBeanItem, context); writer.writeEndElement(); @@ -588,10 +629,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: renderKit - final List renderKit = facesConfig.renderKit; - if (renderKit != null) { - for (final FacesRenderKit renderKitItem : renderKit) { - if (renderKitItem != null) { + List renderKit = facesConfig.renderKit; + if (renderKit!= null) { + for (FacesRenderKit renderKitItem: renderKit) { + if (renderKitItem!= null) { writer.writeStartElement(prefix, "render-kit", "http://java.sun.com/xml/ns/javaee"); writeFacesRenderKit(writer, renderKitItem, context); writer.writeEndElement(); @@ -600,11 +641,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: lifecycle - final List lifecycle = facesConfig.lifecycle; - if (lifecycle != null) { - for (final FacesLifecycle lifecycleItem : lifecycle) { + List lifecycle = facesConfig.lifecycle; + if (lifecycle!= null) { + for (FacesLifecycle lifecycleItem: lifecycle) { writer.writeStartElement(prefix, "lifecycle", "http://java.sun.com/xml/ns/javaee"); - if (lifecycleItem != null) { + if (lifecycleItem!= null) { writeFacesLifecycle(writer, lifecycleItem, context); } else { writer.writeXsiNil(); @@ -614,11 +655,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: validator - final List validator = facesConfig.validator; - if (validator != null) { - for (final FacesValidator validatorItem : validator) { + List validator = facesConfig.validator; + if (validator!= null) { + for (FacesValidator validatorItem: validator) { writer.writeStartElement(prefix, "validator", "http://java.sun.com/xml/ns/javaee"); - if (validatorItem != null) { + if (validatorItem!= null) { writeFacesValidator(writer, validatorItem, context); } else { writer.writeXsiNil(); @@ -628,11 +669,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: behavior - final List behavior = facesConfig.behavior; - if (behavior != null) { - for (final FacesBehavior behaviorItem : behavior) { + List behavior = facesConfig.behavior; + if (behavior!= null) { + for (FacesBehavior behaviorItem: behavior) { writer.writeStartElement(prefix, "behavior", "http://java.sun.com/xml/ns/javaee"); - if (behaviorItem != null) { + if (behaviorItem!= null) { writeFacesBehavior(writer, behaviorItem, context); } else { writer.writeXsiNil(); @@ -642,10 +683,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } // ELEMENT: facesConfigExtension - final List facesConfigExtension = facesConfig.facesConfigExtension; - if (facesConfigExtension != null) { - for (final FacesExtension facesConfigExtensionItem : facesConfigExtension) { - if (facesConfigExtensionItem != null) { + List facesConfigExtension = facesConfig.facesConfigExtension; + if (facesConfigExtension!= null) { + for (FacesExtension facesConfigExtensionItem: facesConfigExtension) { + if (facesConfigExtensionItem!= null) { writer.writeStartElement(prefix, "faces-config-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesExtension(writer, facesConfigExtensionItem, context); writer.writeEndElement(); @@ -653,6 +694,30 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConfi } } + // ELEMENT: flowDefinitions + List flowDefinitions = facesConfig.flowDefinitions; + if (flowDefinitions!= null) { + for (FacesConfigFlowDefinition flowDefinitionsItem: flowDefinitions) { + if (flowDefinitionsItem!= null) { + writer.writeStartElement(prefix, "flow-definition", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinition(writer, flowDefinitionsItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: protectedViews + List protectedViews = facesConfig.protectedViews; + if (protectedViews!= null) { + for (FacesConfigProtectedViews protectedViewsItem: protectedViews) { + if (protectedViewsItem!= null) { + writer.writeStartElement(prefix, "protected-views", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigProtectedViews(writer, protectedViewsItem, context); + writer.writeEndElement(); + } + } + } + context.afterMarshal(facesConfig, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinition$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinition$JAXB.java new file mode 100644 index 00000000000..9b77ca3b2f9 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinition$JAXB.java @@ -0,0 +1,503 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.Description$JAXB.readDescription; +import static org.apache.openejb.jee.Description$JAXB.writeDescription; +import static org.apache.openejb.jee.DisplayName$JAXB.readDisplayName; +import static org.apache.openejb.jee.DisplayName$JAXB.writeDisplayName; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFacesMethodCall$JAXB.readFacesConfigFlowDefinitionFacesMethodCall; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFacesMethodCall$JAXB.writeFacesConfigFlowDefinitionFacesMethodCall; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFinalizer$JAXB.readFacesConfigFlowDefinitionFinalizer; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFinalizer$JAXB.writeFacesConfigFlowDefinitionFinalizer; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFlowCall$JAXB.readFacesConfigFlowDefinitionFlowCall; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFlowCall$JAXB.writeFacesConfigFlowDefinitionFlowCall; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFlowReturn$JAXB.readFacesConfigFlowDefinitionFlowReturn; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFlowReturn$JAXB.writeFacesConfigFlowDefinitionFlowReturn; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionInboundParameter$JAXB.readFacesConfigFlowDefinitionInboundParameter; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionInboundParameter$JAXB.writeFacesConfigFlowDefinitionInboundParameter; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionInitializer$JAXB.readFacesConfigFlowDefinitionInitializer; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionInitializer$JAXB.writeFacesConfigFlowDefinitionInitializer; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionSwitch$JAXB.readFacesConfigFlowDefinitionSwitch; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionSwitch$JAXB.writeFacesConfigFlowDefinitionSwitch; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionView$JAXB.readFacesConfigFlowDefinitionView; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionView$JAXB.writeFacesConfigFlowDefinitionView; +import static org.apache.openejb.jee.FacesNavigationRule$JAXB.readFacesNavigationRule; +import static org.apache.openejb.jee.FacesNavigationRule$JAXB.writeFacesNavigationRule; +import static org.apache.openejb.jee.Icon$JAXB.readIcon; +import static org.apache.openejb.jee.Icon$JAXB.writeIcon; +import static org.apache.openejb.jee.JavaIdentifier$JAXB.readJavaIdentifier; +import static org.apache.openejb.jee.JavaIdentifier$JAXB.writeJavaIdentifier; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinition$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinition$JAXB() { + super(FacesConfigFlowDefinition.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definitionType".intern()), Description$JAXB.class, DisplayName$JAXB.class, Icon$JAXB.class, JavaIdentifier$JAXB.class, FacesConfigFlowDefinitionView$JAXB.class, FacesConfigFlowDefinitionSwitch$JAXB.class, FacesConfigFlowDefinitionFlowReturn$JAXB.class, FacesNavigationRule$JAXB.class, FacesConfigFlowDefinitionFlowCall$JAXB.class, FacesConfigFlowDefinitionFacesMethodCall$JAXB.class, FacesConfigFlowDefinitionInitializer$JAXB.class, FacesConfigFlowDefinitionFinalizer$JAXB.class, FacesConfigFlowDefinitionInboundParameter$JAXB.class); + } + + public static FacesConfigFlowDefinition readFacesConfigFlowDefinition(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinition(XoXMLStreamWriter writer, FacesConfigFlowDefinition facesConfigFlowDefinition, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinition, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinition facesConfigFlowDefinition, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinition, context); + } + + public static final FacesConfigFlowDefinition _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinition facesConfigFlowDefinition = new FacesConfigFlowDefinition(); + context.beforeUnmarshal(facesConfigFlowDefinition, LifecycleCallback.NONE); + + List description = null; + List displayName = null; + List icon = null; + List view = null; + List _switch = null; + List flowReturn = null; + List navigationRule = null; + List flowCall = null; + List methodCall = null; + List inboundParameter = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definitionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinition.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, facesConfigFlowDefinition); + facesConfigFlowDefinition.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 (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: description + Description descriptionItem = readDescription(elementReader, context); + if (description == null) { + description = facesConfigFlowDefinition.description; + if (description!= null) { + description.clear(); + } else { + description = new ArrayList<>(); + } + } + description.add(descriptionItem); + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: displayName + DisplayName displayNameItem = readDisplayName(elementReader, context); + if (displayName == null) { + displayName = facesConfigFlowDefinition.displayName; + if (displayName!= null) { + displayName.clear(); + } else { + displayName = new ArrayList<>(); + } + } + displayName.add(displayNameItem); + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: icon + Icon iconItem = readIcon(elementReader, context); + if (icon == null) { + icon = facesConfigFlowDefinition.icon; + if (icon!= null) { + icon.clear(); + } else { + icon = new ArrayList<>(); + } + } + icon.add(iconItem); + } else if (("start-node" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: startNode + JavaIdentifier startNode = readJavaIdentifier(elementReader, context); + facesConfigFlowDefinition.startNode = startNode; + } else if (("view" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: view + FacesConfigFlowDefinitionView viewItem = readFacesConfigFlowDefinitionView(elementReader, context); + if (view == null) { + view = facesConfigFlowDefinition.view; + if (view!= null) { + view.clear(); + } else { + view = new ArrayList<>(); + } + } + view.add(viewItem); + } else if (("switch" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: _switch + FacesConfigFlowDefinitionSwitch _switchItem = readFacesConfigFlowDefinitionSwitch(elementReader, context); + if (_switch == null) { + _switch = facesConfigFlowDefinition._switch; + if (_switch!= null) { + _switch.clear(); + } else { + _switch = new ArrayList<>(); + } + } + _switch.add(_switchItem); + } else if (("flow-return" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: flowReturn + FacesConfigFlowDefinitionFlowReturn flowReturnItem = readFacesConfigFlowDefinitionFlowReturn(elementReader, context); + if (flowReturn == null) { + flowReturn = facesConfigFlowDefinition.flowReturn; + if (flowReturn!= null) { + flowReturn.clear(); + } else { + flowReturn = new ArrayList<>(); + } + } + flowReturn.add(flowReturnItem); + } else if (("navigation-rule" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: navigationRule + FacesNavigationRule navigationRuleItem = readFacesNavigationRule(elementReader, context); + if (navigationRule == null) { + navigationRule = facesConfigFlowDefinition.navigationRule; + if (navigationRule!= null) { + navigationRule.clear(); + } else { + navigationRule = new ArrayList<>(); + } + } + navigationRule.add(navigationRuleItem); + } else if (("flow-call" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: flowCall + FacesConfigFlowDefinitionFlowCall flowCallItem = readFacesConfigFlowDefinitionFlowCall(elementReader, context); + if (flowCall == null) { + flowCall = facesConfigFlowDefinition.flowCall; + if (flowCall!= null) { + flowCall.clear(); + } else { + flowCall = new ArrayList<>(); + } + } + flowCall.add(flowCallItem); + } else if (("method-call" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: methodCall + FacesConfigFlowDefinitionFacesMethodCall methodCallItem = readFacesConfigFlowDefinitionFacesMethodCall(elementReader, context); + if (methodCall == null) { + methodCall = facesConfigFlowDefinition.methodCall; + if (methodCall!= null) { + methodCall.clear(); + } else { + methodCall = new ArrayList<>(); + } + } + methodCall.add(methodCallItem); + } else if (("initializer" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: initializer + FacesConfigFlowDefinitionInitializer initializer = readFacesConfigFlowDefinitionInitializer(elementReader, context); + facesConfigFlowDefinition.initializer = initializer; + } else if (("finalizer" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: finalizer + FacesConfigFlowDefinitionFinalizer finalizer = readFacesConfigFlowDefinitionFinalizer(elementReader, context); + facesConfigFlowDefinition.finalizer = finalizer; + } else if (("inbound-parameter" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: inboundParameter + FacesConfigFlowDefinitionInboundParameter inboundParameterItem = readFacesConfigFlowDefinitionInboundParameter(elementReader, context); + if (inboundParameter == null) { + inboundParameter = facesConfigFlowDefinition.inboundParameter; + if (inboundParameter!= null) { + inboundParameter.clear(); + } else { + inboundParameter = new ArrayList<>(); + } + } + inboundParameter.add(inboundParameterItem); + } 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", "start-node"), new QName("http://java.sun.com/xml/ns/javaee", "view"), new QName("http://java.sun.com/xml/ns/javaee", "switch"), new QName("http://java.sun.com/xml/ns/javaee", "flow-return"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-rule"), new QName("http://java.sun.com/xml/ns/javaee", "flow-call"), new QName("http://java.sun.com/xml/ns/javaee", "method-call"), new QName("http://java.sun.com/xml/ns/javaee", "initializer"), new QName("http://java.sun.com/xml/ns/javaee", "finalizer"), new QName("http://java.sun.com/xml/ns/javaee", "inbound-parameter")); + } + } + if (description!= null) { + facesConfigFlowDefinition.description = description; + } + if (displayName!= null) { + facesConfigFlowDefinition.displayName = displayName; + } + if (icon!= null) { + facesConfigFlowDefinition.icon = icon; + } + if (view!= null) { + facesConfigFlowDefinition.view = view; + } + if (_switch!= null) { + facesConfigFlowDefinition._switch = _switch; + } + if (flowReturn!= null) { + facesConfigFlowDefinition.flowReturn = flowReturn; + } + if (navigationRule!= null) { + facesConfigFlowDefinition.navigationRule = navigationRule; + } + if (flowCall!= null) { + facesConfigFlowDefinition.flowCall = flowCall; + } + if (methodCall!= null) { + facesConfigFlowDefinition.methodCall = methodCall; + } + if (inboundParameter!= null) { + facesConfigFlowDefinition.inboundParameter = inboundParameter; + } + + context.afterUnmarshal(facesConfigFlowDefinition, LifecycleCallback.NONE); + + return facesConfigFlowDefinition; + } + + public final FacesConfigFlowDefinition read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinition facesConfigFlowDefinition, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinition == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesConfigFlowDefinition.class!= facesConfigFlowDefinition.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinition, FacesConfigFlowDefinition.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinition, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = facesConfigFlowDefinition.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinition, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: description + List description = facesConfigFlowDefinition.description; + if (description!= null) { + for (Description descriptionItem: description) { + writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); + if (descriptionItem!= null) { + writeDescription(writer, descriptionItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + // ELEMENT: displayName + List displayName = facesConfigFlowDefinition.displayName; + if (displayName!= null) { + for (DisplayName displayNameItem: displayName) { + if (displayNameItem!= null) { + writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); + writeDisplayName(writer, displayNameItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: icon + List icon = facesConfigFlowDefinition.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); + if (iconItem!= null) { + writeIcon(writer, iconItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + // ELEMENT: startNode + JavaIdentifier startNode = facesConfigFlowDefinition.startNode; + if (startNode!= null) { + writer.writeStartElement(prefix, "start-node", "http://java.sun.com/xml/ns/javaee"); + writeJavaIdentifier(writer, startNode, context); + writer.writeEndElement(); + } + + // ELEMENT: view + List view = facesConfigFlowDefinition.view; + if (view!= null) { + for (FacesConfigFlowDefinitionView viewItem: view) { + writer.writeStartElement(prefix, "view", "http://java.sun.com/xml/ns/javaee"); + if (viewItem!= null) { + writeFacesConfigFlowDefinitionView(writer, viewItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + // ELEMENT: _switch + List _switch = facesConfigFlowDefinition._switch; + if (_switch!= null) { + for (FacesConfigFlowDefinitionSwitch _switchItem: _switch) { + if (_switchItem!= null) { + writer.writeStartElement(prefix, "switch", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionSwitch(writer, _switchItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: flowReturn + List flowReturn = facesConfigFlowDefinition.flowReturn; + if (flowReturn!= null) { + for (FacesConfigFlowDefinitionFlowReturn flowReturnItem: flowReturn) { + if (flowReturnItem!= null) { + writer.writeStartElement(prefix, "flow-return", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionFlowReturn(writer, flowReturnItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: navigationRule + List navigationRule = facesConfigFlowDefinition.navigationRule; + if (navigationRule!= null) { + for (FacesNavigationRule navigationRuleItem: navigationRule) { + if (navigationRuleItem!= null) { + writer.writeStartElement(prefix, "navigation-rule", "http://java.sun.com/xml/ns/javaee"); + writeFacesNavigationRule(writer, navigationRuleItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: flowCall + List flowCall = facesConfigFlowDefinition.flowCall; + if (flowCall!= null) { + for (FacesConfigFlowDefinitionFlowCall flowCallItem: flowCall) { + if (flowCallItem!= null) { + writer.writeStartElement(prefix, "flow-call", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionFlowCall(writer, flowCallItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: methodCall + List methodCall = facesConfigFlowDefinition.methodCall; + if (methodCall!= null) { + for (FacesConfigFlowDefinitionFacesMethodCall methodCallItem: methodCall) { + if (methodCallItem!= null) { + writer.writeStartElement(prefix, "method-call", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionFacesMethodCall(writer, methodCallItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: initializer + FacesConfigFlowDefinitionInitializer initializer = facesConfigFlowDefinition.initializer; + if (initializer!= null) { + writer.writeStartElement(prefix, "initializer", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionInitializer(writer, initializer, context); + writer.writeEndElement(); + } + + // ELEMENT: finalizer + FacesConfigFlowDefinitionFinalizer finalizer = facesConfigFlowDefinition.finalizer; + if (finalizer!= null) { + writer.writeStartElement(prefix, "finalizer", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionFinalizer(writer, finalizer, context); + writer.writeEndElement(); + } + + // ELEMENT: inboundParameter + List inboundParameter = facesConfigFlowDefinition.inboundParameter; + if (inboundParameter!= null) { + for (FacesConfigFlowDefinitionInboundParameter inboundParameterItem: inboundParameter) { + if (inboundParameterItem!= null) { + writer.writeStartElement(prefix, "inbound-parameter", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionInboundParameter(writer, inboundParameterItem, context); + writer.writeEndElement(); + } + } + } + + context.afterMarshal(facesConfigFlowDefinition, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFacesMethodCall$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFacesMethodCall$JAXB.java new file mode 100644 index 00000000000..5b5ba913275 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFacesMethodCall$JAXB.java @@ -0,0 +1,215 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFacesMethodCallMethod$JAXB.readFacesConfigFlowDefinitionFacesMethodCallMethod; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFacesMethodCallMethod$JAXB.writeFacesConfigFlowDefinitionFacesMethodCallMethod; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFlowCallParameter$JAXB.readFacesConfigFlowDefinitionFlowCallParameter; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFlowCallParameter$JAXB.writeFacesConfigFlowDefinitionFlowCallParameter; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionFacesMethodCall$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionFacesMethodCall$JAXB() { + super(FacesConfigFlowDefinitionFacesMethodCall.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-faces-method-callType".intern()), FacesConfigFlowDefinitionFacesMethodCallMethod$JAXB.class, FacesConfigFlowDefinitionFlowCallParameter$JAXB.class); + } + + public static FacesConfigFlowDefinitionFacesMethodCall readFacesConfigFlowDefinitionFacesMethodCall(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionFacesMethodCall(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFacesMethodCall facesConfigFlowDefinitionFacesMethodCall, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFacesMethodCall, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFacesMethodCall facesConfigFlowDefinitionFacesMethodCall, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFacesMethodCall, context); + } + + public static final FacesConfigFlowDefinitionFacesMethodCall _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionFacesMethodCall facesConfigFlowDefinitionFacesMethodCall = new FacesConfigFlowDefinitionFacesMethodCall(); + context.beforeUnmarshal(facesConfigFlowDefinitionFacesMethodCall, LifecycleCallback.NONE); + + List parameter = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-faces-method-callType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionFacesMethodCall.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: method + FacesConfigFlowDefinitionFacesMethodCallMethod method = readFacesConfigFlowDefinitionFacesMethodCallMethod(elementReader, context); + facesConfigFlowDefinitionFacesMethodCall.method = method; + } else if (("default-outcome" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: defaultOutcome + String defaultOutcomeRaw = elementReader.getElementText(); + + String defaultOutcome; + try { + defaultOutcome = Adapters.collapsedStringAdapterAdapter.unmarshal(defaultOutcomeRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + facesConfigFlowDefinitionFacesMethodCall.defaultOutcome = defaultOutcome; + } else if (("parameter" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: parameter + FacesConfigFlowDefinitionFlowCallParameter parameterItem = readFacesConfigFlowDefinitionFlowCallParameter(elementReader, context); + if (parameter == null) { + parameter = facesConfigFlowDefinitionFacesMethodCall.parameter; + if (parameter!= null) { + parameter.clear(); + } else { + parameter = new ArrayList<>(); + } + } + parameter.add(parameterItem); + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "method"), new QName("http://java.sun.com/xml/ns/javaee", "default-outcome"), new QName("http://java.sun.com/xml/ns/javaee", "parameter")); + } + } + if (parameter!= null) { + facesConfigFlowDefinitionFacesMethodCall.parameter = parameter; + } + + context.afterUnmarshal(facesConfigFlowDefinitionFacesMethodCall, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionFacesMethodCall; + } + + public final FacesConfigFlowDefinitionFacesMethodCall read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFacesMethodCall facesConfigFlowDefinitionFacesMethodCall, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionFacesMethodCall == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesConfigFlowDefinitionFacesMethodCall.class!= facesConfigFlowDefinitionFacesMethodCall.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionFacesMethodCall, FacesConfigFlowDefinitionFacesMethodCall.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionFacesMethodCall, LifecycleCallback.NONE); + + + // ELEMENT: method + FacesConfigFlowDefinitionFacesMethodCallMethod method = facesConfigFlowDefinitionFacesMethodCall.method; + if (method!= null) { + writer.writeStartElement(prefix, "method", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionFacesMethodCallMethod(writer, method, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigFlowDefinitionFacesMethodCall, "method"); + } + + // ELEMENT: defaultOutcome + String defaultOutcomeRaw = facesConfigFlowDefinitionFacesMethodCall.defaultOutcome; + String defaultOutcome = null; + try { + defaultOutcome = Adapters.collapsedStringAdapterAdapter.marshal(defaultOutcomeRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionFacesMethodCall, "defaultOutcome", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (defaultOutcome!= null) { + writer.writeStartElement(prefix, "default-outcome", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(defaultOutcome); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigFlowDefinitionFacesMethodCall, "defaultOutcome"); + } + + // ELEMENT: parameter + List parameter = facesConfigFlowDefinitionFacesMethodCall.parameter; + if (parameter!= null) { + for (FacesConfigFlowDefinitionFlowCallParameter parameterItem: parameter) { + writer.writeStartElement(prefix, "parameter", "http://java.sun.com/xml/ns/javaee"); + if (parameterItem!= null) { + writeFacesConfigFlowDefinitionFlowCallParameter(writer, parameterItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + context.afterMarshal(facesConfigFlowDefinitionFacesMethodCall, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFacesMethodCallMethod$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFacesMethodCallMethod$JAXB.java new file mode 100644 index 00000000000..24851b0c0e7 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFacesMethodCallMethod$JAXB.java @@ -0,0 +1,170 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionFacesMethodCallMethod$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionFacesMethodCallMethod$JAXB() { + super(FacesConfigFlowDefinitionFacesMethodCallMethod.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-faces-method-call-methodType".intern())); + } + + public static FacesConfigFlowDefinitionFacesMethodCallMethod readFacesConfigFlowDefinitionFacesMethodCallMethod(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionFacesMethodCallMethod(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFacesMethodCallMethod facesConfigFlowDefinitionFacesMethodCallMethod, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFacesMethodCallMethod, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFacesMethodCallMethod facesConfigFlowDefinitionFacesMethodCallMethod, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFacesMethodCallMethod, context); + } + + public static final FacesConfigFlowDefinitionFacesMethodCallMethod _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionFacesMethodCallMethod facesConfigFlowDefinitionFacesMethodCallMethod = new FacesConfigFlowDefinitionFacesMethodCallMethod(); + context.beforeUnmarshal(facesConfigFlowDefinitionFacesMethodCallMethod, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-faces-method-call-methodType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionFacesMethodCallMethod.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, facesConfigFlowDefinitionFacesMethodCallMethod); + facesConfigFlowDefinitionFacesMethodCallMethod.id = id; + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "id")); + } + } + + // VALUE: value + String valueRaw = reader.getElementText(); + + String value = null; + boolean valueConverted; + try { + value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); + valueConverted = true; + } catch (Exception e) { + context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); + valueConverted = false; + } + + if (valueConverted) { + facesConfigFlowDefinitionFacesMethodCallMethod.value = value; + } + + context.afterUnmarshal(facesConfigFlowDefinitionFacesMethodCallMethod, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionFacesMethodCallMethod; + } + + public final FacesConfigFlowDefinitionFacesMethodCallMethod read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFacesMethodCallMethod facesConfigFlowDefinitionFacesMethodCallMethod, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionFacesMethodCallMethod == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (FacesConfigFlowDefinitionFacesMethodCallMethod.class!= facesConfigFlowDefinitionFacesMethodCallMethod.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionFacesMethodCallMethod, FacesConfigFlowDefinitionFacesMethodCallMethod.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionFacesMethodCallMethod, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = facesConfigFlowDefinitionFacesMethodCallMethod.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionFacesMethodCallMethod, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // VALUE: value + String valueRaw = facesConfigFlowDefinitionFacesMethodCallMethod.value; + String value = null; + try { + value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionFacesMethodCallMethod, "value", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeCharacters(value); + + context.afterMarshal(facesConfigFlowDefinitionFacesMethodCallMethod, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFinalizer$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFinalizer$JAXB.java new file mode 100644 index 00000000000..0b7087702e0 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFinalizer$JAXB.java @@ -0,0 +1,170 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionFinalizer$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionFinalizer$JAXB() { + super(FacesConfigFlowDefinitionFinalizer.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-finalizerType".intern())); + } + + public static FacesConfigFlowDefinitionFinalizer readFacesConfigFlowDefinitionFinalizer(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionFinalizer(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFinalizer facesConfigFlowDefinitionFinalizer, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFinalizer, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFinalizer facesConfigFlowDefinitionFinalizer, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFinalizer, context); + } + + public static final FacesConfigFlowDefinitionFinalizer _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionFinalizer facesConfigFlowDefinitionFinalizer = new FacesConfigFlowDefinitionFinalizer(); + context.beforeUnmarshal(facesConfigFlowDefinitionFinalizer, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-finalizerType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionFinalizer.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, facesConfigFlowDefinitionFinalizer); + facesConfigFlowDefinitionFinalizer.id = id; + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "id")); + } + } + + // VALUE: value + String valueRaw = reader.getElementText(); + + String value = null; + boolean valueConverted; + try { + value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); + valueConverted = true; + } catch (Exception e) { + context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); + valueConverted = false; + } + + if (valueConverted) { + facesConfigFlowDefinitionFinalizer.value = value; + } + + context.afterUnmarshal(facesConfigFlowDefinitionFinalizer, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionFinalizer; + } + + public final FacesConfigFlowDefinitionFinalizer read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFinalizer facesConfigFlowDefinitionFinalizer, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionFinalizer == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (FacesConfigFlowDefinitionFinalizer.class!= facesConfigFlowDefinitionFinalizer.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionFinalizer, FacesConfigFlowDefinitionFinalizer.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionFinalizer, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = facesConfigFlowDefinitionFinalizer.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionFinalizer, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // VALUE: value + String valueRaw = facesConfigFlowDefinitionFinalizer.value; + String value = null; + try { + value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionFinalizer, "value", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeCharacters(value); + + context.afterMarshal(facesConfigFlowDefinitionFinalizer, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCall$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCall$JAXB.java new file mode 100644 index 00000000000..e1adbec8578 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCall$JAXB.java @@ -0,0 +1,201 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFlowCallFlowReference$JAXB.readFacesConfigFlowDefinitionFlowCallFlowReference; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFlowCallFlowReference$JAXB.writeFacesConfigFlowDefinitionFlowCallFlowReference; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFlowCallOutboundParameter$JAXB.readFacesConfigFlowDefinitionFlowCallOutboundParameter; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionFlowCallOutboundParameter$JAXB.writeFacesConfigFlowDefinitionFlowCallOutboundParameter; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionFlowCall$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionFlowCall$JAXB() { + super(FacesConfigFlowDefinitionFlowCall.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-flow-callType".intern()), FacesConfigFlowDefinitionFlowCallFlowReference$JAXB.class, FacesConfigFlowDefinitionFlowCallOutboundParameter$JAXB.class); + } + + public static FacesConfigFlowDefinitionFlowCall readFacesConfigFlowDefinitionFlowCall(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionFlowCall(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCall facesConfigFlowDefinitionFlowCall, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFlowCall, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCall facesConfigFlowDefinitionFlowCall, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFlowCall, context); + } + + public static final FacesConfigFlowDefinitionFlowCall _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionFlowCall facesConfigFlowDefinitionFlowCall = new FacesConfigFlowDefinitionFlowCall(); + context.beforeUnmarshal(facesConfigFlowDefinitionFlowCall, LifecycleCallback.NONE); + + List outboundParameter = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-flow-callType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionFlowCall.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, facesConfigFlowDefinitionFlowCall); + facesConfigFlowDefinitionFlowCall.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 (("flow-reference" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: flowReference + FacesConfigFlowDefinitionFlowCallFlowReference flowReference = readFacesConfigFlowDefinitionFlowCallFlowReference(elementReader, context); + facesConfigFlowDefinitionFlowCall.flowReference = flowReference; + } else if (("outbound-parameter" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: outboundParameter + FacesConfigFlowDefinitionFlowCallOutboundParameter outboundParameterItem = readFacesConfigFlowDefinitionFlowCallOutboundParameter(elementReader, context); + if (outboundParameter == null) { + outboundParameter = facesConfigFlowDefinitionFlowCall.outboundParameter; + if (outboundParameter!= null) { + outboundParameter.clear(); + } else { + outboundParameter = new ArrayList<>(); + } + } + outboundParameter.add(outboundParameterItem); + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "flow-reference"), new QName("http://java.sun.com/xml/ns/javaee", "outbound-parameter")); + } + } + if (outboundParameter!= null) { + facesConfigFlowDefinitionFlowCall.outboundParameter = outboundParameter; + } + + context.afterUnmarshal(facesConfigFlowDefinitionFlowCall, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionFlowCall; + } + + public final FacesConfigFlowDefinitionFlowCall read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCall facesConfigFlowDefinitionFlowCall, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionFlowCall == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesConfigFlowDefinitionFlowCall.class!= facesConfigFlowDefinitionFlowCall.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionFlowCall, FacesConfigFlowDefinitionFlowCall.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionFlowCall, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = facesConfigFlowDefinitionFlowCall.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionFlowCall, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: flowReference + FacesConfigFlowDefinitionFlowCallFlowReference flowReference = facesConfigFlowDefinitionFlowCall.flowReference; + if (flowReference!= null) { + writer.writeStartElement(prefix, "flow-reference", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionFlowCallFlowReference(writer, flowReference, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigFlowDefinitionFlowCall, "flowReference"); + } + + // ELEMENT: outboundParameter + List outboundParameter = facesConfigFlowDefinitionFlowCall.outboundParameter; + if (outboundParameter!= null) { + for (FacesConfigFlowDefinitionFlowCallOutboundParameter outboundParameterItem: outboundParameter) { + if (outboundParameterItem!= null) { + writer.writeStartElement(prefix, "outbound-parameter", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionFlowCallOutboundParameter(writer, outboundParameterItem, context); + writer.writeEndElement(); + } + } + } + + context.afterMarshal(facesConfigFlowDefinitionFlowCall, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallFlowReference$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallFlowReference$JAXB.java new file mode 100644 index 00000000000..5f3bcaf4548 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallFlowReference$JAXB.java @@ -0,0 +1,163 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.JavaIdentifier$JAXB.readJavaIdentifier; +import static org.apache.openejb.jee.JavaIdentifier$JAXB.writeJavaIdentifier; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionFlowCallFlowReference$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionFlowCallFlowReference$JAXB() { + super(FacesConfigFlowDefinitionFlowCallFlowReference.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-flow-call-flow-referenceType".intern()), JavaIdentifier$JAXB.class); + } + + public static FacesConfigFlowDefinitionFlowCallFlowReference readFacesConfigFlowDefinitionFlowCallFlowReference(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionFlowCallFlowReference(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCallFlowReference facesConfigFlowDefinitionFlowCallFlowReference, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFlowCallFlowReference, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCallFlowReference facesConfigFlowDefinitionFlowCallFlowReference, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFlowCallFlowReference, context); + } + + public static final FacesConfigFlowDefinitionFlowCallFlowReference _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionFlowCallFlowReference facesConfigFlowDefinitionFlowCallFlowReference = new FacesConfigFlowDefinitionFlowCallFlowReference(); + context.beforeUnmarshal(facesConfigFlowDefinitionFlowCallFlowReference, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-flow-call-flow-referenceType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionFlowCallFlowReference.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("flow-document-id" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: flowDocumentId + JavaIdentifier flowDocumentId = readJavaIdentifier(elementReader, context); + facesConfigFlowDefinitionFlowCallFlowReference.flowDocumentId = flowDocumentId; + } else if (("flow-id" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: flowId + JavaIdentifier flowId = readJavaIdentifier(elementReader, context); + facesConfigFlowDefinitionFlowCallFlowReference.flowId = flowId; + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "flow-document-id"), new QName("http://java.sun.com/xml/ns/javaee", "flow-id")); + } + } + + context.afterUnmarshal(facesConfigFlowDefinitionFlowCallFlowReference, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionFlowCallFlowReference; + } + + public final FacesConfigFlowDefinitionFlowCallFlowReference read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCallFlowReference facesConfigFlowDefinitionFlowCallFlowReference, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionFlowCallFlowReference == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesConfigFlowDefinitionFlowCallFlowReference.class!= facesConfigFlowDefinitionFlowCallFlowReference.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionFlowCallFlowReference, FacesConfigFlowDefinitionFlowCallFlowReference.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionFlowCallFlowReference, LifecycleCallback.NONE); + + + // ELEMENT: flowDocumentId + JavaIdentifier flowDocumentId = facesConfigFlowDefinitionFlowCallFlowReference.flowDocumentId; + if (flowDocumentId!= null) { + writer.writeStartElement(prefix, "flow-document-id", "http://java.sun.com/xml/ns/javaee"); + writeJavaIdentifier(writer, flowDocumentId, context); + writer.writeEndElement(); + } + + // ELEMENT: flowId + JavaIdentifier flowId = facesConfigFlowDefinitionFlowCallFlowReference.flowId; + if (flowId!= null) { + writer.writeStartElement(prefix, "flow-id", "http://java.sun.com/xml/ns/javaee"); + writeJavaIdentifier(writer, flowId, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigFlowDefinitionFlowCallFlowReference, "flowId"); + } + + context.afterMarshal(facesConfigFlowDefinitionFlowCallFlowReference, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallOutboundParameter$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallOutboundParameter$JAXB.java new file mode 100644 index 00000000000..280d39d7145 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallOutboundParameter$JAXB.java @@ -0,0 +1,167 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.FacesConfigFlowDefinitionParameterValue$JAXB.readFacesConfigFlowDefinitionParameterValue; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionParameterValue$JAXB.writeFacesConfigFlowDefinitionParameterValue; +import static org.apache.openejb.jee.JavaIdentifier$JAXB.readJavaIdentifier; +import static org.apache.openejb.jee.JavaIdentifier$JAXB.writeJavaIdentifier; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionFlowCallOutboundParameter$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionFlowCallOutboundParameter$JAXB() { + super(FacesConfigFlowDefinitionFlowCallOutboundParameter.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-flow-call-outbound-parameterType".intern()), JavaIdentifier$JAXB.class, FacesConfigFlowDefinitionParameterValue$JAXB.class); + } + + public static FacesConfigFlowDefinitionFlowCallOutboundParameter readFacesConfigFlowDefinitionFlowCallOutboundParameter(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionFlowCallOutboundParameter(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCallOutboundParameter facesConfigFlowDefinitionFlowCallOutboundParameter, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFlowCallOutboundParameter, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCallOutboundParameter facesConfigFlowDefinitionFlowCallOutboundParameter, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFlowCallOutboundParameter, context); + } + + public static final FacesConfigFlowDefinitionFlowCallOutboundParameter _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionFlowCallOutboundParameter facesConfigFlowDefinitionFlowCallOutboundParameter = new FacesConfigFlowDefinitionFlowCallOutboundParameter(); + context.beforeUnmarshal(facesConfigFlowDefinitionFlowCallOutboundParameter, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-flow-call-outbound-parameterType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionFlowCallOutboundParameter.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: name + JavaIdentifier name = readJavaIdentifier(elementReader, context); + facesConfigFlowDefinitionFlowCallOutboundParameter.name = name; + } else if (("value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: value + FacesConfigFlowDefinitionParameterValue value = readFacesConfigFlowDefinitionParameterValue(elementReader, context); + facesConfigFlowDefinitionFlowCallOutboundParameter.value = value; + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "value")); + } + } + + context.afterUnmarshal(facesConfigFlowDefinitionFlowCallOutboundParameter, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionFlowCallOutboundParameter; + } + + public final FacesConfigFlowDefinitionFlowCallOutboundParameter read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCallOutboundParameter facesConfigFlowDefinitionFlowCallOutboundParameter, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionFlowCallOutboundParameter == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesConfigFlowDefinitionFlowCallOutboundParameter.class!= facesConfigFlowDefinitionFlowCallOutboundParameter.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionFlowCallOutboundParameter, FacesConfigFlowDefinitionFlowCallOutboundParameter.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionFlowCallOutboundParameter, LifecycleCallback.NONE); + + + // ELEMENT: name + JavaIdentifier name = facesConfigFlowDefinitionFlowCallOutboundParameter.name; + if (name!= null) { + writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); + writeJavaIdentifier(writer, name, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigFlowDefinitionFlowCallOutboundParameter, "name"); + } + + // ELEMENT: value + FacesConfigFlowDefinitionParameterValue value = facesConfigFlowDefinitionFlowCallOutboundParameter.value; + if (value!= null) { + writer.writeStartElement(prefix, "value", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionParameterValue(writer, value, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigFlowDefinitionFlowCallOutboundParameter, "value"); + } + + context.afterMarshal(facesConfigFlowDefinitionFlowCallOutboundParameter, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallParameter$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallParameter$JAXB.java new file mode 100644 index 00000000000..b27797d931c --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowCallParameter$JAXB.java @@ -0,0 +1,179 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.FacesConfigFlowDefinitionParameterValue$JAXB.readFacesConfigFlowDefinitionParameterValue; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionParameterValue$JAXB.writeFacesConfigFlowDefinitionParameterValue; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionFlowCallParameter$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionFlowCallParameter$JAXB() { + super(FacesConfigFlowDefinitionFlowCallParameter.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-flow-call-parameterType".intern()), FacesConfigFlowDefinitionParameterValue$JAXB.class); + } + + public static FacesConfigFlowDefinitionFlowCallParameter readFacesConfigFlowDefinitionFlowCallParameter(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionFlowCallParameter(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCallParameter facesConfigFlowDefinitionFlowCallParameter, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFlowCallParameter, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCallParameter facesConfigFlowDefinitionFlowCallParameter, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFlowCallParameter, context); + } + + public static final FacesConfigFlowDefinitionFlowCallParameter _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionFlowCallParameter facesConfigFlowDefinitionFlowCallParameter = new FacesConfigFlowDefinitionFlowCallParameter(); + context.beforeUnmarshal(facesConfigFlowDefinitionFlowCallParameter, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-flow-call-parameterType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionFlowCallParameter.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: clazz + String clazzRaw = elementReader.getElementText(); + + String clazz; + try { + clazz = Adapters.collapsedStringAdapterAdapter.unmarshal(clazzRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + facesConfigFlowDefinitionFlowCallParameter.clazz = clazz; + } else if (("value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: value + FacesConfigFlowDefinitionParameterValue value = readFacesConfigFlowDefinitionParameterValue(elementReader, context); + facesConfigFlowDefinitionFlowCallParameter.value = value; + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "class"), new QName("http://java.sun.com/xml/ns/javaee", "value")); + } + } + + context.afterUnmarshal(facesConfigFlowDefinitionFlowCallParameter, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionFlowCallParameter; + } + + public final FacesConfigFlowDefinitionFlowCallParameter read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowCallParameter facesConfigFlowDefinitionFlowCallParameter, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionFlowCallParameter == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesConfigFlowDefinitionFlowCallParameter.class!= facesConfigFlowDefinitionFlowCallParameter.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionFlowCallParameter, FacesConfigFlowDefinitionFlowCallParameter.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionFlowCallParameter, LifecycleCallback.NONE); + + + // ELEMENT: clazz + String clazzRaw = facesConfigFlowDefinitionFlowCallParameter.clazz; + String clazz = null; + try { + clazz = Adapters.collapsedStringAdapterAdapter.marshal(clazzRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionFlowCallParameter, "clazz", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (clazz!= null) { + writer.writeStartElement(prefix, "class", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(clazz); + writer.writeEndElement(); + } + + // ELEMENT: value + FacesConfigFlowDefinitionParameterValue value = facesConfigFlowDefinitionFlowCallParameter.value; + if (value!= null) { + writer.writeStartElement(prefix, "value", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionParameterValue(writer, value, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigFlowDefinitionFlowCallParameter, "value"); + } + + context.afterMarshal(facesConfigFlowDefinitionFlowCallParameter, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowReturn$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowReturn$JAXB.java new file mode 100644 index 00000000000..bd018033d5f --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionFlowReturn$JAXB.java @@ -0,0 +1,168 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.XmlString$JAXB.readXmlString; +import static org.apache.openejb.jee.XmlString$JAXB.writeXmlString; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionFlowReturn$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionFlowReturn$JAXB() { + super(FacesConfigFlowDefinitionFlowReturn.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-flow-returnType".intern()), XmlString$JAXB.class); + } + + public static FacesConfigFlowDefinitionFlowReturn readFacesConfigFlowDefinitionFlowReturn(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionFlowReturn(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowReturn facesConfigFlowDefinitionFlowReturn, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFlowReturn, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowReturn facesConfigFlowDefinitionFlowReturn, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionFlowReturn, context); + } + + public static final FacesConfigFlowDefinitionFlowReturn _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionFlowReturn facesConfigFlowDefinitionFlowReturn = new FacesConfigFlowDefinitionFlowReturn(); + context.beforeUnmarshal(facesConfigFlowDefinitionFlowReturn, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-flow-returnType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionFlowReturn.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, facesConfigFlowDefinitionFlowReturn); + facesConfigFlowDefinitionFlowReturn.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 (("from-outcome" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: fromOutcome + XmlString fromOutcome = readXmlString(elementReader, context); + facesConfigFlowDefinitionFlowReturn.fromOutcome = fromOutcome; + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "from-outcome")); + } + } + + context.afterUnmarshal(facesConfigFlowDefinitionFlowReturn, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionFlowReturn; + } + + public final FacesConfigFlowDefinitionFlowReturn read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionFlowReturn facesConfigFlowDefinitionFlowReturn, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionFlowReturn == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (FacesConfigFlowDefinitionFlowReturn.class!= facesConfigFlowDefinitionFlowReturn.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionFlowReturn, FacesConfigFlowDefinitionFlowReturn.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionFlowReturn, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = facesConfigFlowDefinitionFlowReturn.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionFlowReturn, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: fromOutcome + XmlString fromOutcome = facesConfigFlowDefinitionFlowReturn.fromOutcome; + if (fromOutcome!= null) { + writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "from-outcome"); + writeXmlString(writer, fromOutcome, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigFlowDefinitionFlowReturn, "fromOutcome"); + } + + context.afterMarshal(facesConfigFlowDefinitionFlowReturn, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionInboundParameter$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionInboundParameter$JAXB.java new file mode 100644 index 00000000000..abdc7768c1b --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionInboundParameter$JAXB.java @@ -0,0 +1,167 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.FacesConfigFlowDefinitionParameterValue$JAXB.readFacesConfigFlowDefinitionParameterValue; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionParameterValue$JAXB.writeFacesConfigFlowDefinitionParameterValue; +import static org.apache.openejb.jee.JavaIdentifier$JAXB.readJavaIdentifier; +import static org.apache.openejb.jee.JavaIdentifier$JAXB.writeJavaIdentifier; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionInboundParameter$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionInboundParameter$JAXB() { + super(FacesConfigFlowDefinitionInboundParameter.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-inbound-parameterType".intern()), JavaIdentifier$JAXB.class, FacesConfigFlowDefinitionParameterValue$JAXB.class); + } + + public static FacesConfigFlowDefinitionInboundParameter readFacesConfigFlowDefinitionInboundParameter(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionInboundParameter(XoXMLStreamWriter writer, FacesConfigFlowDefinitionInboundParameter facesConfigFlowDefinitionInboundParameter, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionInboundParameter, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionInboundParameter facesConfigFlowDefinitionInboundParameter, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionInboundParameter, context); + } + + public static final FacesConfigFlowDefinitionInboundParameter _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionInboundParameter facesConfigFlowDefinitionInboundParameter = new FacesConfigFlowDefinitionInboundParameter(); + context.beforeUnmarshal(facesConfigFlowDefinitionInboundParameter, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-inbound-parameterType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionInboundParameter.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: name + JavaIdentifier name = readJavaIdentifier(elementReader, context); + facesConfigFlowDefinitionInboundParameter.name = name; + } else if (("value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: value + FacesConfigFlowDefinitionParameterValue value = readFacesConfigFlowDefinitionParameterValue(elementReader, context); + facesConfigFlowDefinitionInboundParameter.value = value; + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "value")); + } + } + + context.afterUnmarshal(facesConfigFlowDefinitionInboundParameter, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionInboundParameter; + } + + public final FacesConfigFlowDefinitionInboundParameter read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionInboundParameter facesConfigFlowDefinitionInboundParameter, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionInboundParameter == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesConfigFlowDefinitionInboundParameter.class!= facesConfigFlowDefinitionInboundParameter.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionInboundParameter, FacesConfigFlowDefinitionInboundParameter.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionInboundParameter, LifecycleCallback.NONE); + + + // ELEMENT: name + JavaIdentifier name = facesConfigFlowDefinitionInboundParameter.name; + if (name!= null) { + writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); + writeJavaIdentifier(writer, name, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigFlowDefinitionInboundParameter, "name"); + } + + // ELEMENT: value + FacesConfigFlowDefinitionParameterValue value = facesConfigFlowDefinitionInboundParameter.value; + if (value!= null) { + writer.writeStartElement(prefix, "value", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionParameterValue(writer, value, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigFlowDefinitionInboundParameter, "value"); + } + + context.afterMarshal(facesConfigFlowDefinitionInboundParameter, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionInitializer$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionInitializer$JAXB.java new file mode 100644 index 00000000000..15c51b2a600 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionInitializer$JAXB.java @@ -0,0 +1,170 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionInitializer$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionInitializer$JAXB() { + super(FacesConfigFlowDefinitionInitializer.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-initializerType".intern())); + } + + public static FacesConfigFlowDefinitionInitializer readFacesConfigFlowDefinitionInitializer(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionInitializer(XoXMLStreamWriter writer, FacesConfigFlowDefinitionInitializer facesConfigFlowDefinitionInitializer, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionInitializer, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionInitializer facesConfigFlowDefinitionInitializer, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionInitializer, context); + } + + public static final FacesConfigFlowDefinitionInitializer _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionInitializer facesConfigFlowDefinitionInitializer = new FacesConfigFlowDefinitionInitializer(); + context.beforeUnmarshal(facesConfigFlowDefinitionInitializer, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-initializerType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionInitializer.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, facesConfigFlowDefinitionInitializer); + facesConfigFlowDefinitionInitializer.id = id; + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "id")); + } + } + + // VALUE: value + String valueRaw = reader.getElementText(); + + String value = null; + boolean valueConverted; + try { + value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); + valueConverted = true; + } catch (Exception e) { + context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); + valueConverted = false; + } + + if (valueConverted) { + facesConfigFlowDefinitionInitializer.value = value; + } + + context.afterUnmarshal(facesConfigFlowDefinitionInitializer, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionInitializer; + } + + public final FacesConfigFlowDefinitionInitializer read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionInitializer facesConfigFlowDefinitionInitializer, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionInitializer == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (FacesConfigFlowDefinitionInitializer.class!= facesConfigFlowDefinitionInitializer.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionInitializer, FacesConfigFlowDefinitionInitializer.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionInitializer, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = facesConfigFlowDefinitionInitializer.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionInitializer, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // VALUE: value + String valueRaw = facesConfigFlowDefinitionInitializer.value; + String value = null; + try { + value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionInitializer, "value", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeCharacters(value); + + context.afterMarshal(facesConfigFlowDefinitionInitializer, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionParameterValue$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionParameterValue$JAXB.java new file mode 100644 index 00000000000..3e488675b74 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionParameterValue$JAXB.java @@ -0,0 +1,170 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionParameterValue$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionParameterValue$JAXB() { + super(FacesConfigFlowDefinitionParameterValue.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-parameter-valueType".intern())); + } + + public static FacesConfigFlowDefinitionParameterValue readFacesConfigFlowDefinitionParameterValue(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionParameterValue(XoXMLStreamWriter writer, FacesConfigFlowDefinitionParameterValue facesConfigFlowDefinitionParameterValue, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionParameterValue, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionParameterValue facesConfigFlowDefinitionParameterValue, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionParameterValue, context); + } + + public static final FacesConfigFlowDefinitionParameterValue _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionParameterValue facesConfigFlowDefinitionParameterValue = new FacesConfigFlowDefinitionParameterValue(); + context.beforeUnmarshal(facesConfigFlowDefinitionParameterValue, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-parameter-valueType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionParameterValue.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, facesConfigFlowDefinitionParameterValue); + facesConfigFlowDefinitionParameterValue.id = id; + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "id")); + } + } + + // VALUE: value + String valueRaw = reader.getElementText(); + + String value = null; + boolean valueConverted; + try { + value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); + valueConverted = true; + } catch (Exception e) { + context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); + valueConverted = false; + } + + if (valueConverted) { + facesConfigFlowDefinitionParameterValue.value = value; + } + + context.afterUnmarshal(facesConfigFlowDefinitionParameterValue, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionParameterValue; + } + + public final FacesConfigFlowDefinitionParameterValue read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionParameterValue facesConfigFlowDefinitionParameterValue, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionParameterValue == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (FacesConfigFlowDefinitionParameterValue.class!= facesConfigFlowDefinitionParameterValue.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionParameterValue, FacesConfigFlowDefinitionParameterValue.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionParameterValue, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = facesConfigFlowDefinitionParameterValue.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionParameterValue, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // VALUE: value + String valueRaw = facesConfigFlowDefinitionParameterValue.value; + String value = null; + try { + value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionParameterValue, "value", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeCharacters(value); + + context.afterMarshal(facesConfigFlowDefinitionParameterValue, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionSwitch$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionSwitch$JAXB.java new file mode 100644 index 00000000000..46494980114 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionSwitch$JAXB.java @@ -0,0 +1,199 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.FacesConfigFlowDefinitionSwitchCase$JAXB.readFacesConfigFlowDefinitionSwitchCase; +import static org.apache.openejb.jee.FacesConfigFlowDefinitionSwitchCase$JAXB.writeFacesConfigFlowDefinitionSwitchCase; +import static org.apache.openejb.jee.XmlString$JAXB.readXmlString; +import static org.apache.openejb.jee.XmlString$JAXB.writeXmlString; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionSwitch$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionSwitch$JAXB() { + super(FacesConfigFlowDefinitionSwitch.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-switchType".intern()), FacesConfigFlowDefinitionSwitchCase$JAXB.class, XmlString$JAXB.class); + } + + public static FacesConfigFlowDefinitionSwitch readFacesConfigFlowDefinitionSwitch(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionSwitch(XoXMLStreamWriter writer, FacesConfigFlowDefinitionSwitch facesConfigFlowDefinitionSwitch, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionSwitch, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionSwitch facesConfigFlowDefinitionSwitch, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionSwitch, context); + } + + public static final FacesConfigFlowDefinitionSwitch _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionSwitch facesConfigFlowDefinitionSwitch = new FacesConfigFlowDefinitionSwitch(); + context.beforeUnmarshal(facesConfigFlowDefinitionSwitch, LifecycleCallback.NONE); + + List _case = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-switchType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionSwitch.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, facesConfigFlowDefinitionSwitch); + facesConfigFlowDefinitionSwitch.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 (("case" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: _case + FacesConfigFlowDefinitionSwitchCase _caseItem = readFacesConfigFlowDefinitionSwitchCase(elementReader, context); + if (_case == null) { + _case = facesConfigFlowDefinitionSwitch._case; + if (_case!= null) { + _case.clear(); + } else { + _case = new ArrayList<>(); + } + } + _case.add(_caseItem); + } else if (("default-outcome" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: defaultOutcome + XmlString defaultOutcome = readXmlString(elementReader, context); + facesConfigFlowDefinitionSwitch.defaultOutcome = defaultOutcome; + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "case"), new QName("http://java.sun.com/xml/ns/javaee", "default-outcome")); + } + } + if (_case!= null) { + facesConfigFlowDefinitionSwitch._case = _case; + } + + context.afterUnmarshal(facesConfigFlowDefinitionSwitch, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionSwitch; + } + + public final FacesConfigFlowDefinitionSwitch read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionSwitch facesConfigFlowDefinitionSwitch, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionSwitch == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesConfigFlowDefinitionSwitch.class!= facesConfigFlowDefinitionSwitch.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionSwitch, FacesConfigFlowDefinitionSwitch.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionSwitch, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = facesConfigFlowDefinitionSwitch.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionSwitch, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: _case + List _case = facesConfigFlowDefinitionSwitch._case; + if (_case!= null) { + for (FacesConfigFlowDefinitionSwitchCase _caseItem: _case) { + if (_caseItem!= null) { + writer.writeStartElement(prefix, "case", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigFlowDefinitionSwitchCase(writer, _caseItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: defaultOutcome + XmlString defaultOutcome = facesConfigFlowDefinitionSwitch.defaultOutcome; + if (defaultOutcome!= null) { + writer.writeStartElement(prefix, "default-outcome", "http://java.sun.com/xml/ns/javaee"); + writeXmlString(writer, defaultOutcome, context); + writer.writeEndElement(); + } + + context.afterMarshal(facesConfigFlowDefinitionSwitch, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionSwitchCase$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionSwitchCase$JAXB.java new file mode 100644 index 00000000000..c62359f8f21 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionSwitchCase$JAXB.java @@ -0,0 +1,277 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.Description$JAXB.readDescription; +import static org.apache.openejb.jee.Description$JAXB.writeDescription; +import static org.apache.openejb.jee.DisplayName$JAXB.readDisplayName; +import static org.apache.openejb.jee.DisplayName$JAXB.writeDisplayName; +import static org.apache.openejb.jee.FacesConfigIf$JAXB.readFacesConfigIf; +import static org.apache.openejb.jee.FacesConfigIf$JAXB.writeFacesConfigIf; +import static org.apache.openejb.jee.Icon$JAXB.readIcon; +import static org.apache.openejb.jee.Icon$JAXB.writeIcon; +import static org.apache.openejb.jee.XmlString$JAXB.readXmlString; +import static org.apache.openejb.jee.XmlString$JAXB.writeXmlString; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionSwitchCase$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionSwitchCase$JAXB() { + super(FacesConfigFlowDefinitionSwitchCase.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-switch-caseType".intern()), Description$JAXB.class, DisplayName$JAXB.class, Icon$JAXB.class, FacesConfigIf$JAXB.class, XmlString$JAXB.class); + } + + public static FacesConfigFlowDefinitionSwitchCase readFacesConfigFlowDefinitionSwitchCase(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionSwitchCase(XoXMLStreamWriter writer, FacesConfigFlowDefinitionSwitchCase facesConfigFlowDefinitionSwitchCase, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionSwitchCase, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionSwitchCase facesConfigFlowDefinitionSwitchCase, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionSwitchCase, context); + } + + public static final FacesConfigFlowDefinitionSwitchCase _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionSwitchCase facesConfigFlowDefinitionSwitchCase = new FacesConfigFlowDefinitionSwitchCase(); + context.beforeUnmarshal(facesConfigFlowDefinitionSwitchCase, LifecycleCallback.NONE); + + List description = null; + List displayName = null; + List icon = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-switch-caseType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionSwitchCase.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, facesConfigFlowDefinitionSwitchCase); + facesConfigFlowDefinitionSwitchCase.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 (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: description + Description descriptionItem = readDescription(elementReader, context); + if (description == null) { + description = facesConfigFlowDefinitionSwitchCase.description; + if (description!= null) { + description.clear(); + } else { + description = new ArrayList<>(); + } + } + description.add(descriptionItem); + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: displayName + DisplayName displayNameItem = readDisplayName(elementReader, context); + if (displayName == null) { + displayName = facesConfigFlowDefinitionSwitchCase.displayName; + if (displayName!= null) { + displayName.clear(); + } else { + displayName = new ArrayList<>(); + } + } + displayName.add(displayNameItem); + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: icon + Icon iconItem = readIcon(elementReader, context); + if (icon == null) { + icon = facesConfigFlowDefinitionSwitchCase.icon; + if (icon!= null) { + icon.clear(); + } else { + icon = new ArrayList<>(); + } + } + icon.add(iconItem); + } else if (("if" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: _if + FacesConfigIf _if = readFacesConfigIf(elementReader, context); + facesConfigFlowDefinitionSwitchCase._if = _if; + } else if (("from-outcome" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: fromOutcome + XmlString fromOutcome = readXmlString(elementReader, context); + facesConfigFlowDefinitionSwitchCase.fromOutcome = fromOutcome; + } 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", "if"), new QName("http://java.sun.com/xml/ns/javaee", "from-outcome")); + } + } + if (description!= null) { + facesConfigFlowDefinitionSwitchCase.description = description; + } + if (displayName!= null) { + facesConfigFlowDefinitionSwitchCase.displayName = displayName; + } + if (icon!= null) { + facesConfigFlowDefinitionSwitchCase.icon = icon; + } + + context.afterUnmarshal(facesConfigFlowDefinitionSwitchCase, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionSwitchCase; + } + + public final FacesConfigFlowDefinitionSwitchCase read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionSwitchCase facesConfigFlowDefinitionSwitchCase, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionSwitchCase == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesConfigFlowDefinitionSwitchCase.class!= facesConfigFlowDefinitionSwitchCase.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionSwitchCase, FacesConfigFlowDefinitionSwitchCase.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionSwitchCase, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = facesConfigFlowDefinitionSwitchCase.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionSwitchCase, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: description + List description = facesConfigFlowDefinitionSwitchCase.description; + if (description!= null) { + for (Description descriptionItem: description) { + writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); + if (descriptionItem!= null) { + writeDescription(writer, descriptionItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + // ELEMENT: displayName + List displayName = facesConfigFlowDefinitionSwitchCase.displayName; + if (displayName!= null) { + for (DisplayName displayNameItem: displayName) { + if (displayNameItem!= null) { + writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); + writeDisplayName(writer, displayNameItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: icon + List icon = facesConfigFlowDefinitionSwitchCase.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); + if (iconItem!= null) { + writeIcon(writer, iconItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + // ELEMENT: _if + FacesConfigIf _if = facesConfigFlowDefinitionSwitchCase._if; + if (_if!= null) { + writer.writeStartElement(prefix, "if", "http://java.sun.com/xml/ns/javaee"); + writeFacesConfigIf(writer, _if, context); + writer.writeEndElement(); + } + + // ELEMENT: fromOutcome + XmlString fromOutcome = facesConfigFlowDefinitionSwitchCase.fromOutcome; + if (fromOutcome!= null) { + writer.writeStartElement(prefix, "from-outcome", "http://java.sun.com/xml/ns/javaee"); + writeXmlString(writer, fromOutcome, context); + writer.writeEndElement(); + } + + context.afterMarshal(facesConfigFlowDefinitionSwitchCase, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionView$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionView$JAXB.java new file mode 100644 index 00000000000..502a835d9bd --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigFlowDefinitionView$JAXB.java @@ -0,0 +1,168 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.JavaIdentifier$JAXB.readJavaIdentifier; +import static org.apache.openejb.jee.JavaIdentifier$JAXB.writeJavaIdentifier; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigFlowDefinitionView$JAXB + extends JAXBObject +{ + + + public FacesConfigFlowDefinitionView$JAXB() { + super(FacesConfigFlowDefinitionView.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-flow-definition-viewType".intern()), JavaIdentifier$JAXB.class); + } + + public static FacesConfigFlowDefinitionView readFacesConfigFlowDefinitionView(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigFlowDefinitionView(XoXMLStreamWriter writer, FacesConfigFlowDefinitionView facesConfigFlowDefinitionView, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionView, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionView facesConfigFlowDefinitionView, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigFlowDefinitionView, context); + } + + public static final FacesConfigFlowDefinitionView _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigFlowDefinitionView facesConfigFlowDefinitionView = new FacesConfigFlowDefinitionView(); + context.beforeUnmarshal(facesConfigFlowDefinitionView, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-flow-definition-viewType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigFlowDefinitionView.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, facesConfigFlowDefinitionView); + facesConfigFlowDefinitionView.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 (("vdl-document" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: vdlDocument + JavaIdentifier vdlDocument = readJavaIdentifier(elementReader, context); + facesConfigFlowDefinitionView.vdlDocument = vdlDocument; + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "vdl-document")); + } + } + + context.afterUnmarshal(facesConfigFlowDefinitionView, LifecycleCallback.NONE); + + return facesConfigFlowDefinitionView; + } + + public final FacesConfigFlowDefinitionView read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigFlowDefinitionView facesConfigFlowDefinitionView, RuntimeContext context) + throws Exception + { + if (facesConfigFlowDefinitionView == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (FacesConfigFlowDefinitionView.class!= facesConfigFlowDefinitionView.getClass()) { + context.unexpectedSubclass(writer, facesConfigFlowDefinitionView, FacesConfigFlowDefinitionView.class); + return ; + } + + context.beforeMarshal(facesConfigFlowDefinitionView, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = facesConfigFlowDefinitionView.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigFlowDefinitionView, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: vdlDocument + JavaIdentifier vdlDocument = facesConfigFlowDefinitionView.vdlDocument; + if (vdlDocument!= null) { + writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "vdl-document"); + writeJavaIdentifier(writer, vdlDocument, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigFlowDefinitionView, "vdlDocument"); + } + + context.afterMarshal(facesConfigFlowDefinitionView, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigIf$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigIf$JAXB.java new file mode 100644 index 00000000000..10d30d90345 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigIf$JAXB.java @@ -0,0 +1,170 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigIf$JAXB + extends JAXBObject +{ + + + public FacesConfigIf$JAXB() { + super(FacesConfigIf.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-ifType".intern())); + } + + public static FacesConfigIf readFacesConfigIf(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigIf(XoXMLStreamWriter writer, FacesConfigIf facesConfigIf, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigIf, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigIf facesConfigIf, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigIf, context); + } + + public static final FacesConfigIf _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigIf facesConfigIf = new FacesConfigIf(); + context.beforeUnmarshal(facesConfigIf, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-ifType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigIf.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, facesConfigIf); + facesConfigIf.id = id; + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "id")); + } + } + + // VALUE: value + String valueRaw = reader.getElementText(); + + String value = null; + boolean valueConverted; + try { + value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); + valueConverted = true; + } catch (Exception e) { + context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); + valueConverted = false; + } + + if (valueConverted) { + facesConfigIf.value = value; + } + + context.afterUnmarshal(facesConfigIf, LifecycleCallback.NONE); + + return facesConfigIf; + } + + public final FacesConfigIf read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigIf facesConfigIf, RuntimeContext context) + throws Exception + { + if (facesConfigIf == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (FacesConfigIf.class!= facesConfigIf.getClass()) { + context.unexpectedSubclass(writer, facesConfigIf, FacesConfigIf.class); + return ; + } + + context.beforeMarshal(facesConfigIf, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = facesConfigIf.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigIf, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // VALUE: value + String valueRaw = facesConfigIf.value; + String value = null; + try { + value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); + } catch (Exception e) { + context.xmlAdapterError(facesConfigIf, "value", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeCharacters(value); + + context.afterMarshal(facesConfigIf, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigProtectedViews$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigProtectedViews$JAXB.java new file mode 100644 index 00000000000..ef7333140d5 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfigProtectedViews$JAXB.java @@ -0,0 +1,168 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.UrlPattern$JAXB.readUrlPattern; +import static org.apache.openejb.jee.UrlPattern$JAXB.writeUrlPattern; + +@SuppressWarnings({ + "StringEquality" +}) +public class FacesConfigProtectedViews$JAXB + extends JAXBObject +{ + + + public FacesConfigProtectedViews$JAXB() { + super(FacesConfigProtectedViews.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-protected-viewsType".intern()), UrlPattern$JAXB.class); + } + + public static FacesConfigProtectedViews readFacesConfigProtectedViews(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeFacesConfigProtectedViews(XoXMLStreamWriter writer, FacesConfigProtectedViews facesConfigProtectedViews, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigProtectedViews, context); + } + + public void write(XoXMLStreamWriter writer, FacesConfigProtectedViews facesConfigProtectedViews, RuntimeContext context) + throws Exception + { + _write(writer, facesConfigProtectedViews, context); + } + + public static final FacesConfigProtectedViews _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + FacesConfigProtectedViews facesConfigProtectedViews = new FacesConfigProtectedViews(); + context.beforeUnmarshal(facesConfigProtectedViews, LifecycleCallback.NONE); + + List urlPattern = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-protected-viewsType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, FacesConfigProtectedViews.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("url-pattern" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: urlPattern + UrlPattern urlPatternItem = readUrlPattern(elementReader, context); + if (urlPattern == null) { + urlPattern = facesConfigProtectedViews.urlPattern; + if (urlPattern!= null) { + urlPattern.clear(); + } else { + urlPattern = new ArrayList<>(); + } + } + urlPattern.add(urlPatternItem); + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "url-pattern")); + } + } + if (urlPattern!= null) { + facesConfigProtectedViews.urlPattern = urlPattern; + } + + context.afterUnmarshal(facesConfigProtectedViews, LifecycleCallback.NONE); + + return facesConfigProtectedViews; + } + + public final FacesConfigProtectedViews read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, FacesConfigProtectedViews facesConfigProtectedViews, RuntimeContext context) + throws Exception + { + if (facesConfigProtectedViews == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (FacesConfigProtectedViews.class!= facesConfigProtectedViews.getClass()) { + context.unexpectedSubclass(writer, facesConfigProtectedViews, FacesConfigProtectedViews.class); + return ; + } + + context.beforeMarshal(facesConfigProtectedViews, LifecycleCallback.NONE); + + + // ELEMENT: urlPattern + List urlPattern = facesConfigProtectedViews.urlPattern; + if (urlPattern!= null) { + for (UrlPattern urlPatternItem: urlPattern) { + if (urlPatternItem!= null) { + writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "url-pattern"); + writeUrlPattern(writer, urlPatternItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(facesConfigProtectedViews, "urlPattern"); + } + } + } + + context.afterMarshal(facesConfigProtectedViews, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverter$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverter$JAXB.java index 05d6d058259..536b58f7146 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverter$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverter$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesAttribute$JAXB.readFacesAttribute; import static org.apache.openejb.jee.FacesAttribute$JAXB.writeFacesAttribute; @@ -44,30 +45,35 @@ "StringEquality" }) public class FacesConverter$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesConverter$JAXB() { super(FacesConverter.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-converterType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesAttribute$JAXB.class, FacesProperty$JAXB.class, FacesConverterExtension$JAXB.class); } - public static FacesConverter readFacesConverter(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesConverter readFacesConverter(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesConverter(final XoXMLStreamWriter writer, final FacesConverter facesConverter, final RuntimeContext context) - throws Exception { + public static void writeFacesConverter(XoXMLStreamWriter writer, FacesConverter facesConverter, RuntimeContext context) + throws Exception + { _write(writer, facesConverter, context); } - public void write(final XoXMLStreamWriter writer, final FacesConverter facesConverter, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesConverter facesConverter, RuntimeContext context) + throws Exception + { _write(writer, facesConverter, context); } - public final static FacesConverter _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesConverter _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -78,7 +84,7 @@ public final static FacesConverter _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final FacesConverter facesConverter = new FacesConverter(); + FacesConverter facesConverter = new FacesConverter(); context.beforeUnmarshal(facesConverter, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -89,158 +95,156 @@ public final static FacesConverter _read(final XoXMLStreamReader reader, Runtime List converterExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-converterType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-converterType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesConverter.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesConverter); facesConverter.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesConverter.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("converter-id" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("converter-id" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: converterId - final String converterIdRaw = elementReader.getElementAsString(); + String converterIdRaw = elementReader.getElementText(); - final String converterId; + String converterId; try { converterId = Adapters.collapsedStringAdapterAdapter.unmarshal(converterIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesConverter.converterId = converterId; - } else if (("converter-for-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("converter-for-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: converterForClass - final String converterForClassRaw = elementReader.getElementAsString(); + String converterForClassRaw = elementReader.getElementText(); - final String converterForClass; + String converterForClass; try { converterForClass = Adapters.collapsedStringAdapterAdapter.unmarshal(converterForClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesConverter.converterForClass = converterForClass; - } else if (("converter-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("converter-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: converterClass - final String converterClassRaw = elementReader.getElementAsString(); + String converterClassRaw = elementReader.getElementText(); - final String converterClass; + String converterClass; try { converterClass = Adapters.collapsedStringAdapterAdapter.unmarshal(converterClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesConverter.converterClass = converterClass; - } else if (("attribute" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("attribute" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: attribute - final FacesAttribute attributeItem = readFacesAttribute(elementReader, context); + FacesAttribute attributeItem = readFacesAttribute(elementReader, context); if (attribute1 == null) { attribute1 = facesConverter.attribute; if (attribute1 != null) { - attribute1.clear(); + attribute1 .clear(); } else { - attribute1 = new ArrayList(); + attribute1 = new ArrayList<>(); } } - attribute1.add(attributeItem); - } else if (("property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + attribute1 .add(attributeItem); + } else if (("property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: property - final FacesProperty propertyItem = readFacesProperty(elementReader, context); + FacesProperty propertyItem = readFacesProperty(elementReader, context); if (property == null) { property = facesConverter.property; - if (property != null) { + if (property!= null) { property.clear(); } else { - property = new ArrayList(); + property = new ArrayList<>(); } } property.add(propertyItem); - } else if (("converter-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("converter-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: converterExtension - final FacesConverterExtension converterExtensionItem = readFacesConverterExtension(elementReader, context); + FacesConverterExtension converterExtensionItem = readFacesConverterExtension(elementReader, context); if (converterExtension == null) { converterExtension = facesConverter.converterExtension; - if (converterExtension != null) { + if (converterExtension!= null) { converterExtension.clear(); } else { - converterExtension = new ArrayList(); + converterExtension = new ArrayList<>(); } } converterExtension.add(converterExtensionItem); } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // 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", "converter-id"), new QName("http://java.sun.com/xml/ns/javaee", "converter-for-class"), new QName("http://java.sun.com/xml/ns/javaee", "converter-class"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "converter-extension")); + 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", "converter-id"), new QName("http://java.sun.com/xml/ns/javaee", "converter-for-class"), new QName("http://java.sun.com/xml/ns/javaee", "converter-class"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "converter-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesConverter.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesConverter.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesConverter.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesConverter.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesConverter.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesConverter.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesConverter.icon = icon; } if (attribute1 != null) { facesConverter.attribute = attribute1; } - if (property != null) { + if (property!= null) { facesConverter.property = property; } - if (converterExtension != null) { + if (converterExtension!= null) { facesConverter.converterExtension = converterExtension; } @@ -249,38 +253,40 @@ public final static FacesConverter _read(final XoXMLStreamReader reader, Runtime return facesConverter; } - public final FacesConverter read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesConverter read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesConverter facesConverter, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesConverter facesConverter, RuntimeContext context) + throws Exception + { if (facesConverter == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesConverter.class != facesConverter.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesConverter.class!= facesConverter.getClass()) { context.unexpectedSubclass(writer, facesConverter, FacesConverter.class); - return; + return ; } context.beforeMarshal(facesConverter, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesConverter.id; - if (idRaw != null) { + String idRaw = facesConverter.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesConverter, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -290,12 +296,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConve Text[] descriptions = null; try { descriptions = facesConverter.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesConverter, "descriptions", FacesConverter.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -309,12 +315,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConve Text[] displayNames = null; try { displayNames = facesConverter.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesConverter, "displayNames", FacesConverter.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -325,10 +331,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConve } // ELEMENT: icon - final LocalCollection icon = facesConverter.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesConverter.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -339,42 +345,42 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConve } // ELEMENT: converterId - final String converterIdRaw = facesConverter.converterId; + String converterIdRaw = facesConverter.converterId; String converterId = null; try { converterId = Adapters.collapsedStringAdapterAdapter.marshal(converterIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesConverter, "converterId", CollapsedStringAdapter.class, String.class, String.class, e); } - if (converterId != null) { + if (converterId!= null) { writer.writeStartElement(prefix, "converter-id", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(converterId); writer.writeEndElement(); } // ELEMENT: converterForClass - final String converterForClassRaw = facesConverter.converterForClass; + String converterForClassRaw = facesConverter.converterForClass; String converterForClass = null; try { converterForClass = Adapters.collapsedStringAdapterAdapter.marshal(converterForClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesConverter, "converterForClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (converterForClass != null) { + if (converterForClass!= null) { writer.writeStartElement(prefix, "converter-for-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(converterForClass); writer.writeEndElement(); } // ELEMENT: converterClass - final String converterClassRaw = facesConverter.converterClass; + String converterClassRaw = facesConverter.converterClass; String converterClass = null; try { converterClass = Adapters.collapsedStringAdapterAdapter.marshal(converterClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesConverter, "converterClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (converterClass != null) { + if (converterClass!= null) { writer.writeStartElement(prefix, "converter-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(converterClass); writer.writeEndElement(); @@ -383,11 +389,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConve } // ELEMENT: attribute - final List attribute = facesConverter.attribute; - if (attribute != null) { - for (final FacesAttribute attributeItem : attribute) { + List attribute = facesConverter.attribute; + if (attribute!= null) { + for (FacesAttribute attributeItem: attribute) { writer.writeStartElement(prefix, "attribute", "http://java.sun.com/xml/ns/javaee"); - if (attributeItem != null) { + if (attributeItem!= null) { writeFacesAttribute(writer, attributeItem, context); } else { writer.writeXsiNil(); @@ -397,11 +403,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConve } // ELEMENT: property - final List property = facesConverter.property; - if (property != null) { - for (final FacesProperty propertyItem : property) { + List property = facesConverter.property; + if (property!= null) { + for (FacesProperty propertyItem: property) { writer.writeStartElement(prefix, "property", "http://java.sun.com/xml/ns/javaee"); - if (propertyItem != null) { + if (propertyItem!= null) { writeFacesProperty(writer, propertyItem, context); } else { writer.writeXsiNil(); @@ -411,10 +417,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesConve } // ELEMENT: converterExtension - final List converterExtension = facesConverter.converterExtension; - if (converterExtension != null) { - for (final FacesConverterExtension converterExtensionItem : converterExtension) { - if (converterExtensionItem != null) { + List converterExtension = facesConverter.converterExtension; + if (converterExtension!= null) { + for (FacesConverterExtension converterExtensionItem: converterExtension) { + if (converterExtensionItem!= null) { writer.writeStartElement(prefix, "converter-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesConverterExtension(writer, converterExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverterExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverterExtension$JAXB.java index 9bb4afc4951..1a32b7fea63 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverterExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverterExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesConverterExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesConverterExtension$JAXB() { super(FacesConverterExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-converter-extensionType".intern())); } - public static FacesConverterExtension readFacesConverterExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesConverterExtension readFacesConverterExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesConverterExtension(final XoXMLStreamWriter writer, final FacesConverterExtension facesConverterExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesConverterExtension(XoXMLStreamWriter writer, FacesConverterExtension facesConverterExtension, RuntimeContext context) + throws Exception + { _write(writer, facesConverterExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesConverterExtension facesConverterExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesConverterExtension facesConverterExtension, RuntimeContext context) + throws Exception + { _write(writer, facesConverterExtension, context); } - public final static FacesConverterExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesConverterExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesConverterExtension _read(final XoXMLStreamReader reader context = new RuntimeContext(); } - final FacesConverterExtension facesConverterExtension = new FacesConverterExtension(); + FacesConverterExtension facesConverterExtension = new FacesConverterExtension(); context.beforeUnmarshal(facesConverterExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-converter-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-converter-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesConverterExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesConverterExtension); facesConverterExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesConverterExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesConverterExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesConverterExtension _read(final XoXMLStreamReader reader return facesConverterExtension; } - public final FacesConverterExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesConverterExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesConverterExtension facesConverterExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesConverterExtension facesConverterExtension, RuntimeContext context) + throws Exception + { if (facesConverterExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesConverterExtension.class != facesConverterExtension.getClass()) { + if (FacesConverterExtension.class!= facesConverterExtension.getClass()) { context.unexpectedSubclass(writer, facesConverterExtension, FacesConverterExtension.class); - return; + return ; } context.beforeMarshal(facesConverterExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesConverterExtension.id; - if (idRaw != null) { + String idRaw = facesConverterExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesConverterExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesConverterExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesConverterExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesConverterExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesDefaultLocale$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesDefaultLocale$JAXB.java index fb938f1f4db..1675828933a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesDefaultLocale$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesDefaultLocale$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class FacesDefaultLocale$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesDefaultLocale$JAXB() { super(FacesDefaultLocale.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-default-localeType".intern())); } - public static FacesDefaultLocale readFacesDefaultLocale(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesDefaultLocale readFacesDefaultLocale(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesDefaultLocale(final XoXMLStreamWriter writer, final FacesDefaultLocale facesDefaultLocale, final RuntimeContext context) - throws Exception { + public static void writeFacesDefaultLocale(XoXMLStreamWriter writer, FacesDefaultLocale facesDefaultLocale, RuntimeContext context) + throws Exception + { _write(writer, facesDefaultLocale, context); } - public void write(final XoXMLStreamWriter writer, final FacesDefaultLocale facesDefaultLocale, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesDefaultLocale facesDefaultLocale, RuntimeContext context) + throws Exception + { _write(writer, facesDefaultLocale, context); } - public final static FacesDefaultLocale _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesDefaultLocale _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,26 +70,26 @@ public final static FacesDefaultLocale _read(final XoXMLStreamReader reader, Run context = new RuntimeContext(); } - final FacesDefaultLocale facesDefaultLocale = new FacesDefaultLocale(); + FacesDefaultLocale facesDefaultLocale = new FacesDefaultLocale(); context.beforeUnmarshal(facesDefaultLocale, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-default-localeType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-default-localeType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesDefaultLocale.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesDefaultLocale); facesDefaultLocale.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id")); } } @@ -97,44 +102,46 @@ public final static FacesDefaultLocale _read(final XoXMLStreamReader reader, Run return facesDefaultLocale; } - public final FacesDefaultLocale read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesDefaultLocale read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesDefaultLocale facesDefaultLocale, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesDefaultLocale facesDefaultLocale, RuntimeContext context) + throws Exception + { if (facesDefaultLocale == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesDefaultLocale.class != facesDefaultLocale.getClass()) { + if (FacesDefaultLocale.class!= facesDefaultLocale.getClass()) { context.unexpectedSubclass(writer, facesDefaultLocale, FacesDefaultLocale.class); - return; + return ; } context.beforeMarshal(facesDefaultLocale, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesDefaultLocale.id; - if (idRaw != null) { + String idRaw = facesDefaultLocale.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesDefaultLocale, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // VALUE: value - final FacesLocale value = facesDefaultLocale.value; + FacesLocale value = facesDefaultLocale.value; context.afterMarshal(facesDefaultLocale, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesELExpression$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesELExpression$JAXB.java index a4a74c1153d..ea19e9ff6ee 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesELExpression$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesELExpression$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class FacesELExpression$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesELExpression$JAXB() { super(FacesELExpression.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-el-expressionType".intern())); } - public static FacesELExpression readFacesELExpression(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesELExpression readFacesELExpression(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesELExpression(final XoXMLStreamWriter writer, final FacesELExpression facesELExpression, final RuntimeContext context) - throws Exception { + public static void writeFacesELExpression(XoXMLStreamWriter writer, FacesELExpression facesELExpression, RuntimeContext context) + throws Exception + { _write(writer, facesELExpression, context); } - public void write(final XoXMLStreamWriter writer, final FacesELExpression facesELExpression, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesELExpression facesELExpression, RuntimeContext context) + throws Exception + { _write(writer, facesELExpression, context); } - public final static FacesELExpression _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesELExpression _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,34 +70,34 @@ public final static FacesELExpression _read(final XoXMLStreamReader reader, Runt context = new RuntimeContext(); } - final FacesELExpression facesELExpression = new FacesELExpression(); + FacesELExpression facesELExpression = new FacesELExpression(); context.beforeUnmarshal(facesELExpression, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-el-expressionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-el-expressionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesELExpression.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute); } } // VALUE: value - final String valueRaw = reader.getElementText(); + String valueRaw = reader.getElementText(); String value = null; boolean valueConverted; try { value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); valueConverted = true; - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); valueConverted = false; } @@ -106,36 +111,38 @@ public final static FacesELExpression _read(final XoXMLStreamReader reader, Runt return facesELExpression; } - public final FacesELExpression read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesELExpression read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesELExpression facesELExpression, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesELExpression facesELExpression, RuntimeContext context) + throws Exception + { if (facesELExpression == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesELExpression.class != facesELExpression.getClass()) { + if (FacesELExpression.class!= facesELExpression.getClass()) { context.unexpectedSubclass(writer, facesELExpression, FacesELExpression.class); - return; + return ; } context.beforeMarshal(facesELExpression, LifecycleCallback.NONE); // VALUE: value - final String valueRaw = facesELExpression.value; + String valueRaw = facesELExpression.value; String value = null; try { value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesELExpression, "value", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeCharacters(value); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesExtension$JAXB.java index 6cc3d53940a..fedc8c25e18 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesExtension$JAXB() { super(FacesExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-extensionType".intern())); } - public static FacesExtension readFacesExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesExtension readFacesExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesExtension(final XoXMLStreamWriter writer, final FacesExtension facesExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesExtension(XoXMLStreamWriter writer, FacesExtension facesExtension, RuntimeContext context) + throws Exception + { _write(writer, facesExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesExtension facesExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesExtension facesExtension, RuntimeContext context) + throws Exception + { _write(writer, facesExtension, context); } - public final static FacesExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesExtension _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final FacesExtension facesExtension = new FacesExtension(); + FacesExtension facesExtension = new FacesExtension(); context.beforeUnmarshal(facesExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesExtension); facesExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesExtension _read(final XoXMLStreamReader reader, Runtime return facesExtension; } - public final FacesExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesExtension facesExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesExtension facesExtension, RuntimeContext context) + throws Exception + { if (facesExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesExtension.class != facesExtension.getClass()) { + if (FacesExtension.class!= facesExtension.getClass()) { context.unexpectedSubclass(writer, facesExtension, FacesExtension.class); - return; + return ; } context.beforeMarshal(facesExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesExtension.id; - if (idRaw != null) { + String idRaw = facesExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFacet$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFacet$JAXB.java index c54c2a0448b..ae1151c714c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFacet$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFacet$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesFacetExtension$JAXB.readFacesFacetExtension; import static org.apache.openejb.jee.FacesFacetExtension$JAXB.writeFacesFacetExtension; @@ -40,30 +41,35 @@ "StringEquality" }) public class FacesFacet$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesFacet$JAXB() { super(FacesFacet.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-facetType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesFacetExtension$JAXB.class); } - public static FacesFacet readFacesFacet(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesFacet readFacesFacet(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesFacet(final XoXMLStreamWriter writer, final FacesFacet facesFacet, final RuntimeContext context) - throws Exception { + public static void writeFacesFacet(XoXMLStreamWriter writer, FacesFacet facesFacet, RuntimeContext context) + throws Exception + { _write(writer, facesFacet, context); } - public void write(final XoXMLStreamWriter writer, final FacesFacet facesFacet, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesFacet facesFacet, RuntimeContext context) + throws Exception + { _write(writer, facesFacet, context); } - public final static FacesFacet _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesFacet _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,7 +80,7 @@ public final static FacesFacet _read(final XoXMLStreamReader reader, RuntimeCont context = new RuntimeContext(); } - final FacesFacet facesFacet = new FacesFacet(); + FacesFacet facesFacet = new FacesFacet(); context.beforeUnmarshal(facesFacet, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -83,75 +89,75 @@ public final static FacesFacet _read(final XoXMLStreamReader reader, RuntimeCont List facetExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-facetType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-facetType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesFacet.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesFacet); facesFacet.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesFacet.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("facet-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("facet-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: facetName - final String facetNameRaw = elementReader.getElementAsString(); + String facetNameRaw = elementReader.getElementText(); - final String facetName; + String facetName; try { facetName = Adapters.collapsedStringAdapterAdapter.unmarshal(facetNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesFacet.facetName = facetName; - } else if (("facet-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("facet-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: facetExtension - final FacesFacetExtension facetExtensionItem = readFacesFacetExtension(elementReader, context); + FacesFacetExtension facetExtensionItem = readFacesFacetExtension(elementReader, context); if (facetExtension == null) { facetExtension = facesFacet.facetExtension; - if (facetExtension != null) { + if (facetExtension!= null) { facetExtension.clear(); } else { - facetExtension = new ArrayList(); + facetExtension = new ArrayList<>(); } } facetExtension.add(facetExtensionItem); @@ -159,24 +165,24 @@ public final static FacesFacet _read(final XoXMLStreamReader reader, RuntimeCont 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", "facet-name"), new QName("http://java.sun.com/xml/ns/javaee", "facet-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesFacet.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesFacet.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesFacet.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesFacet.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesFacet.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesFacet.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesFacet.icon = icon; } - if (facetExtension != null) { + if (facetExtension!= null) { facesFacet.facetExtension = facetExtension; } @@ -185,38 +191,40 @@ public final static FacesFacet _read(final XoXMLStreamReader reader, RuntimeCont return facesFacet; } - public final FacesFacet read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesFacet read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesFacet facesFacet, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesFacet facesFacet, RuntimeContext context) + throws Exception + { if (facesFacet == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesFacet.class != facesFacet.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesFacet.class!= facesFacet.getClass()) { context.unexpectedSubclass(writer, facesFacet, FacesFacet.class); - return; + return ; } context.beforeMarshal(facesFacet, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesFacet.id; - if (idRaw != null) { + String idRaw = facesFacet.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFacet, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -226,12 +234,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacet Text[] descriptions = null; try { descriptions = facesFacet.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesFacet, "descriptions", FacesFacet.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -245,12 +253,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacet Text[] displayNames = null; try { displayNames = facesFacet.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesFacet, "displayNames", FacesFacet.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -261,10 +269,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacet } // ELEMENT: icon - final LocalCollection icon = facesFacet.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesFacet.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -275,14 +283,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacet } // ELEMENT: facetName - final String facetNameRaw = facesFacet.facetName; + String facetNameRaw = facesFacet.facetName; String facetName = null; try { facetName = Adapters.collapsedStringAdapterAdapter.marshal(facetNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFacet, "facetName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (facetName != null) { + if (facetName!= null) { writer.writeStartElement(prefix, "facet-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(facetName); writer.writeEndElement(); @@ -291,10 +299,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacet } // ELEMENT: facetExtension - final List facetExtension = facesFacet.facetExtension; - if (facetExtension != null) { - for (final FacesFacetExtension facetExtensionItem : facetExtension) { - if (facetExtensionItem != null) { + List facetExtension = facesFacet.facetExtension; + if (facetExtension!= null) { + for (FacesFacetExtension facetExtensionItem: facetExtension) { + if (facetExtensionItem!= null) { writer.writeStartElement(prefix, "facet-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesFacetExtension(writer, facetExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFacetExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFacetExtension$JAXB.java index c30ddfd4c13..f752b3d344e 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFacetExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFacetExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesFacetExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesFacetExtension$JAXB() { super(FacesFacetExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-facet-extensionType".intern())); } - public static FacesFacetExtension readFacesFacetExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesFacetExtension readFacesFacetExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesFacetExtension(final XoXMLStreamWriter writer, final FacesFacetExtension facesFacetExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesFacetExtension(XoXMLStreamWriter writer, FacesFacetExtension facesFacetExtension, RuntimeContext context) + throws Exception + { _write(writer, facesFacetExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesFacetExtension facesFacetExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesFacetExtension facesFacetExtension, RuntimeContext context) + throws Exception + { _write(writer, facesFacetExtension, context); } - public final static FacesFacetExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesFacetExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesFacetExtension _read(final XoXMLStreamReader reader, Ru context = new RuntimeContext(); } - final FacesFacetExtension facesFacetExtension = new FacesFacetExtension(); + FacesFacetExtension facesFacetExtension = new FacesFacetExtension(); context.beforeUnmarshal(facesFacetExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-facet-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-facet-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesFacetExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesFacetExtension); facesFacetExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesFacetExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesFacetExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesFacetExtension _read(final XoXMLStreamReader reader, Ru return facesFacetExtension; } - public final FacesFacetExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesFacetExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesFacetExtension facesFacetExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesFacetExtension facesFacetExtension, RuntimeContext context) + throws Exception + { if (facesFacetExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesFacetExtension.class != facesFacetExtension.getClass()) { + if (FacesFacetExtension.class!= facesFacetExtension.getClass()) { context.unexpectedSubclass(writer, facesFacetExtension, FacesFacetExtension.class); - return; + return ; } context.beforeMarshal(facesFacetExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesFacetExtension.id; - if (idRaw != null) { + String idRaw = facesFacetExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFacetExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesFacetExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesFacetExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesFacetExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactory$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactory$JAXB.java index 2e9c5e9249d..e3d4d1c3fc5 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactory$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactory$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesFactoryExtension$JAXB.readFacesFactoryExtension; import static org.apache.openejb.jee.FacesFactoryExtension$JAXB.writeFacesFactoryExtension; @@ -36,30 +37,35 @@ "StringEquality" }) public class FacesFactory$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesFactory$JAXB() { super(FacesFactory.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-factoryType".intern()), FacesFactoryExtension$JAXB.class); } - public static FacesFactory readFacesFactory(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesFactory readFacesFactory(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesFactory(final XoXMLStreamWriter writer, final FacesFactory facesFactory, final RuntimeContext context) - throws Exception { + public static void writeFacesFactory(XoXMLStreamWriter writer, FacesFactory facesFactory, RuntimeContext context) + throws Exception + { _write(writer, facesFactory, context); } - public void write(final XoXMLStreamWriter writer, final FacesFactory facesFactory, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesFactory facesFactory, RuntimeContext context) + throws Exception + { _write(writer, facesFactory, context); } - public final static FacesFactory _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesFactory _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,7 +76,7 @@ public final static FacesFactory _read(final XoXMLStreamReader reader, RuntimeCo context = new RuntimeContext(); } - final FacesFactory facesFactory = new FacesFactory(); + FacesFactory facesFactory = new FacesFactory(); context.beforeUnmarshal(facesFactory, LifecycleCallback.NONE); List applicationFactory = null; @@ -86,286 +92,284 @@ public final static FacesFactory _read(final XoXMLStreamReader reader, RuntimeCo List factoryExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-factoryType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-factoryType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesFactory.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesFactory); facesFactory.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("application-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("application-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: applicationFactory - final String applicationFactoryItemRaw = elementReader.getElementAsString(); + String applicationFactoryItemRaw = elementReader.getElementText(); - final String applicationFactoryItem; + String applicationFactoryItem; try { applicationFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(applicationFactoryItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (applicationFactory == null) { applicationFactory = facesFactory.applicationFactory; - if (applicationFactory != null) { + if (applicationFactory!= null) { applicationFactory.clear(); } else { - applicationFactory = new ArrayList(); + applicationFactory = new ArrayList<>(); } } applicationFactory.add(applicationFactoryItem); - } else if (("exception-handler-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("exception-handler-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: exceptionHandlerFactory - final String exceptionHandlerFactoryItemRaw = elementReader.getElementAsString(); + String exceptionHandlerFactoryItemRaw = elementReader.getElementText(); - final String exceptionHandlerFactoryItem; + String exceptionHandlerFactoryItem; try { exceptionHandlerFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(exceptionHandlerFactoryItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (exceptionHandlerFactory == null) { exceptionHandlerFactory = facesFactory.exceptionHandlerFactory; - if (exceptionHandlerFactory != null) { + if (exceptionHandlerFactory!= null) { exceptionHandlerFactory.clear(); } else { - exceptionHandlerFactory = new ArrayList(); + exceptionHandlerFactory = new ArrayList<>(); } } exceptionHandlerFactory.add(exceptionHandlerFactoryItem); - } else if (("external-context-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("external-context-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: externalContextFactory - final String externalContextFactoryItemRaw = elementReader.getElementAsString(); + String externalContextFactoryItemRaw = elementReader.getElementText(); - final String externalContextFactoryItem; + String externalContextFactoryItem; try { externalContextFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(externalContextFactoryItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (externalContextFactory == null) { externalContextFactory = facesFactory.externalContextFactory; - if (externalContextFactory != null) { + if (externalContextFactory!= null) { externalContextFactory.clear(); } else { - externalContextFactory = new ArrayList(); + externalContextFactory = new ArrayList<>(); } } externalContextFactory.add(externalContextFactoryItem); - } else if (("faces-context-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("faces-context-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: facesContextFactory - final String facesContextFactoryItemRaw = elementReader.getElementAsString(); + String facesContextFactoryItemRaw = elementReader.getElementText(); - final String facesContextFactoryItem; + String facesContextFactoryItem; try { facesContextFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(facesContextFactoryItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (facesContextFactory == null) { facesContextFactory = facesFactory.facesContextFactory; - if (facesContextFactory != null) { + if (facesContextFactory!= null) { facesContextFactory.clear(); } else { - facesContextFactory = new ArrayList(); + facesContextFactory = new ArrayList<>(); } } facesContextFactory.add(facesContextFactoryItem); - } else if (("partial-view-context-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("partial-view-context-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: partialViewContextFactory - final String partialViewContextFactoryItemRaw = elementReader.getElementAsString(); + String partialViewContextFactoryItemRaw = elementReader.getElementText(); - final String partialViewContextFactoryItem; + String partialViewContextFactoryItem; try { partialViewContextFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(partialViewContextFactoryItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (partialViewContextFactory == null) { partialViewContextFactory = facesFactory.partialViewContextFactory; - if (partialViewContextFactory != null) { + if (partialViewContextFactory!= null) { partialViewContextFactory.clear(); } else { - partialViewContextFactory = new ArrayList(); + partialViewContextFactory = new ArrayList<>(); } } partialViewContextFactory.add(partialViewContextFactoryItem); - } else if (("lifecycle-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lifecycle-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lifecycleFactory - final String lifecycleFactoryItemRaw = elementReader.getElementAsString(); + String lifecycleFactoryItemRaw = elementReader.getElementText(); - final String lifecycleFactoryItem; + String lifecycleFactoryItem; try { lifecycleFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(lifecycleFactoryItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (lifecycleFactory == null) { lifecycleFactory = facesFactory.lifecycleFactory; - if (lifecycleFactory != null) { + if (lifecycleFactory!= null) { lifecycleFactory.clear(); } else { - lifecycleFactory = new ArrayList(); + lifecycleFactory = new ArrayList<>(); } } lifecycleFactory.add(lifecycleFactoryItem); - } else if (("view-declaration-language-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("view-declaration-language-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: viewDeclarationLanguageFactory - final String viewDeclarationLanguageFactoryItemRaw = elementReader.getElementAsString(); + String viewDeclarationLanguageFactoryItemRaw = elementReader.getElementText(); - final String viewDeclarationLanguageFactoryItem; + String viewDeclarationLanguageFactoryItem; try { viewDeclarationLanguageFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(viewDeclarationLanguageFactoryItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (viewDeclarationLanguageFactory == null) { viewDeclarationLanguageFactory = facesFactory.viewDeclarationLanguageFactory; - if (viewDeclarationLanguageFactory != null) { + if (viewDeclarationLanguageFactory!= null) { viewDeclarationLanguageFactory.clear(); } else { - viewDeclarationLanguageFactory = new ArrayList(); + viewDeclarationLanguageFactory = new ArrayList<>(); } } viewDeclarationLanguageFactory.add(viewDeclarationLanguageFactoryItem); - } else if (("tag-handler-delegate-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("tag-handler-delegate-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: tagHandlerDelegateFactory - final String tagHandlerDelegateFactoryItemRaw = elementReader.getElementAsString(); + String tagHandlerDelegateFactoryItemRaw = elementReader.getElementText(); - final String tagHandlerDelegateFactoryItem; + String tagHandlerDelegateFactoryItem; try { tagHandlerDelegateFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(tagHandlerDelegateFactoryItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (tagHandlerDelegateFactory == null) { tagHandlerDelegateFactory = facesFactory.tagHandlerDelegateFactory; - if (tagHandlerDelegateFactory != null) { + if (tagHandlerDelegateFactory!= null) { tagHandlerDelegateFactory.clear(); } else { - tagHandlerDelegateFactory = new ArrayList(); + tagHandlerDelegateFactory = new ArrayList<>(); } } tagHandlerDelegateFactory.add(tagHandlerDelegateFactoryItem); - } else if (("render-kit-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("render-kit-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: renderKitFactory - final String renderKitFactoryItemRaw = elementReader.getElementAsString(); + String renderKitFactoryItemRaw = elementReader.getElementText(); - final String renderKitFactoryItem; + String renderKitFactoryItem; try { renderKitFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(renderKitFactoryItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (renderKitFactory == null) { renderKitFactory = facesFactory.renderKitFactory; - if (renderKitFactory != null) { + if (renderKitFactory!= null) { renderKitFactory.clear(); } else { - renderKitFactory = new ArrayList(); + renderKitFactory = new ArrayList<>(); } } renderKitFactory.add(renderKitFactoryItem); - } else if (("visit-context-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("visit-context-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: visitContextFactory - final String visitContextFactoryItemRaw = elementReader.getElementAsString(); + String visitContextFactoryItemRaw = elementReader.getElementText(); - final String visitContextFactoryItem; + String visitContextFactoryItem; try { visitContextFactoryItem = Adapters.collapsedStringAdapterAdapter.unmarshal(visitContextFactoryItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (visitContextFactory == null) { visitContextFactory = facesFactory.visitContextFactory; - if (visitContextFactory != null) { + if (visitContextFactory!= null) { visitContextFactory.clear(); } else { - visitContextFactory = new ArrayList(); + visitContextFactory = new ArrayList<>(); } } visitContextFactory.add(visitContextFactoryItem); - } else if (("factory-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("factory-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: factoryExtension - final FacesFactoryExtension factoryExtensionItem = readFacesFactoryExtension(elementReader, context); + FacesFactoryExtension factoryExtensionItem = readFacesFactoryExtension(elementReader, context); if (factoryExtension == null) { factoryExtension = facesFactory.factoryExtension; - if (factoryExtension != null) { + if (factoryExtension!= null) { factoryExtension.clear(); } else { - factoryExtension = new ArrayList(); + factoryExtension = new ArrayList<>(); } } factoryExtension.add(factoryExtensionItem); } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "application-factory"), new QName("http://java.sun.com/xml/ns/javaee", "exception-handler-factory"), new QName("http://java.sun.com/xml/ns/javaee", "external-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "faces-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "partial-view-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "lifecycle-factory"), new QName("http://java.sun.com/xml/ns/javaee", "view-declaration-language-factory"), new QName("http://java.sun.com/xml/ns/javaee", "tag-handler-delegate-factory"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit-factory"), new QName("http://java.sun.com/xml/ns/javaee", "visit-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "factory-extension")); + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "application-factory"), new QName("http://java.sun.com/xml/ns/javaee", "exception-handler-factory"), new QName("http://java.sun.com/xml/ns/javaee", "external-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "faces-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "partial-view-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "lifecycle-factory"), new QName("http://java.sun.com/xml/ns/javaee", "view-declaration-language-factory"), new QName("http://java.sun.com/xml/ns/javaee", "tag-handler-delegate-factory"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit-factory"), new QName("http://java.sun.com/xml/ns/javaee", "visit-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "factory-extension")); } } - if (applicationFactory != null) { + if (applicationFactory!= null) { facesFactory.applicationFactory = applicationFactory; } - if (exceptionHandlerFactory != null) { + if (exceptionHandlerFactory!= null) { facesFactory.exceptionHandlerFactory = exceptionHandlerFactory; } - if (externalContextFactory != null) { + if (externalContextFactory!= null) { facesFactory.externalContextFactory = externalContextFactory; } - if (facesContextFactory != null) { + if (facesContextFactory!= null) { facesFactory.facesContextFactory = facesContextFactory; } - if (partialViewContextFactory != null) { + if (partialViewContextFactory!= null) { facesFactory.partialViewContextFactory = partialViewContextFactory; } - if (lifecycleFactory != null) { + if (lifecycleFactory!= null) { facesFactory.lifecycleFactory = lifecycleFactory; } - if (viewDeclarationLanguageFactory != null) { + if (viewDeclarationLanguageFactory!= null) { facesFactory.viewDeclarationLanguageFactory = viewDeclarationLanguageFactory; } - if (tagHandlerDelegateFactory != null) { + if (tagHandlerDelegateFactory!= null) { facesFactory.tagHandlerDelegateFactory = tagHandlerDelegateFactory; } - if (renderKitFactory != null) { + if (renderKitFactory!= null) { facesFactory.renderKitFactory = renderKitFactory; } - if (visitContextFactory != null) { + if (visitContextFactory!= null) { facesFactory.visitContextFactory = visitContextFactory; } - if (factoryExtension != null) { + if (factoryExtension!= null) { facesFactory.factoryExtension = factoryExtension; } @@ -374,54 +378,56 @@ public final static FacesFactory _read(final XoXMLStreamReader reader, RuntimeCo return facesFactory; } - public final FacesFactory read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesFactory read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesFactory facesFactory, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesFactory facesFactory, RuntimeContext context) + throws Exception + { if (facesFactory == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesFactory.class != facesFactory.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesFactory.class!= facesFactory.getClass()) { context.unexpectedSubclass(writer, facesFactory, FacesFactory.class); - return; + return ; } context.beforeMarshal(facesFactory, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesFactory.id; - if (idRaw != null) { + String idRaw = facesFactory.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactory, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: applicationFactory - final List applicationFactoryRaw = facesFactory.applicationFactory; - if (applicationFactoryRaw != null) { - for (final String applicationFactoryItem : applicationFactoryRaw) { + List applicationFactoryRaw = facesFactory.applicationFactory; + if (applicationFactoryRaw!= null) { + for (String applicationFactoryItem: applicationFactoryRaw) { String applicationFactory = null; try { applicationFactory = Adapters.collapsedStringAdapterAdapter.marshal(applicationFactoryItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactory, "applicationFactory", CollapsedStringAdapter.class, List.class, List.class, e); } - if (applicationFactory != null) { + if (applicationFactory!= null) { writer.writeStartElement(prefix, "application-factory", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(applicationFactory); writer.writeEndElement(); @@ -430,16 +436,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacto } // ELEMENT: exceptionHandlerFactory - final List exceptionHandlerFactoryRaw = facesFactory.exceptionHandlerFactory; - if (exceptionHandlerFactoryRaw != null) { - for (final String exceptionHandlerFactoryItem : exceptionHandlerFactoryRaw) { + List exceptionHandlerFactoryRaw = facesFactory.exceptionHandlerFactory; + if (exceptionHandlerFactoryRaw!= null) { + for (String exceptionHandlerFactoryItem: exceptionHandlerFactoryRaw) { String exceptionHandlerFactory = null; try { exceptionHandlerFactory = Adapters.collapsedStringAdapterAdapter.marshal(exceptionHandlerFactoryItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactory, "exceptionHandlerFactory", CollapsedStringAdapter.class, List.class, List.class, e); } - if (exceptionHandlerFactory != null) { + if (exceptionHandlerFactory!= null) { writer.writeStartElement(prefix, "exception-handler-factory", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(exceptionHandlerFactory); writer.writeEndElement(); @@ -448,16 +454,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacto } // ELEMENT: externalContextFactory - final List externalContextFactoryRaw = facesFactory.externalContextFactory; - if (externalContextFactoryRaw != null) { - for (final String externalContextFactoryItem : externalContextFactoryRaw) { + List externalContextFactoryRaw = facesFactory.externalContextFactory; + if (externalContextFactoryRaw!= null) { + for (String externalContextFactoryItem: externalContextFactoryRaw) { String externalContextFactory = null; try { externalContextFactory = Adapters.collapsedStringAdapterAdapter.marshal(externalContextFactoryItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactory, "externalContextFactory", CollapsedStringAdapter.class, List.class, List.class, e); } - if (externalContextFactory != null) { + if (externalContextFactory!= null) { writer.writeStartElement(prefix, "external-context-factory", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(externalContextFactory); writer.writeEndElement(); @@ -466,16 +472,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacto } // ELEMENT: facesContextFactory - final List facesContextFactoryRaw = facesFactory.facesContextFactory; - if (facesContextFactoryRaw != null) { - for (final String facesContextFactoryItem : facesContextFactoryRaw) { + List facesContextFactoryRaw = facesFactory.facesContextFactory; + if (facesContextFactoryRaw!= null) { + for (String facesContextFactoryItem: facesContextFactoryRaw) { String facesContextFactory = null; try { facesContextFactory = Adapters.collapsedStringAdapterAdapter.marshal(facesContextFactoryItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactory, "facesContextFactory", CollapsedStringAdapter.class, List.class, List.class, e); } - if (facesContextFactory != null) { + if (facesContextFactory!= null) { writer.writeStartElement(prefix, "faces-context-factory", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(facesContextFactory); writer.writeEndElement(); @@ -484,16 +490,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacto } // ELEMENT: partialViewContextFactory - final List partialViewContextFactoryRaw = facesFactory.partialViewContextFactory; - if (partialViewContextFactoryRaw != null) { - for (final String partialViewContextFactoryItem : partialViewContextFactoryRaw) { + List partialViewContextFactoryRaw = facesFactory.partialViewContextFactory; + if (partialViewContextFactoryRaw!= null) { + for (String partialViewContextFactoryItem: partialViewContextFactoryRaw) { String partialViewContextFactory = null; try { partialViewContextFactory = Adapters.collapsedStringAdapterAdapter.marshal(partialViewContextFactoryItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactory, "partialViewContextFactory", CollapsedStringAdapter.class, List.class, List.class, e); } - if (partialViewContextFactory != null) { + if (partialViewContextFactory!= null) { writer.writeStartElement(prefix, "partial-view-context-factory", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(partialViewContextFactory); writer.writeEndElement(); @@ -502,16 +508,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacto } // ELEMENT: lifecycleFactory - final List lifecycleFactoryRaw = facesFactory.lifecycleFactory; - if (lifecycleFactoryRaw != null) { - for (final String lifecycleFactoryItem : lifecycleFactoryRaw) { + List lifecycleFactoryRaw = facesFactory.lifecycleFactory; + if (lifecycleFactoryRaw!= null) { + for (String lifecycleFactoryItem: lifecycleFactoryRaw) { String lifecycleFactory = null; try { lifecycleFactory = Adapters.collapsedStringAdapterAdapter.marshal(lifecycleFactoryItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactory, "lifecycleFactory", CollapsedStringAdapter.class, List.class, List.class, e); } - if (lifecycleFactory != null) { + if (lifecycleFactory!= null) { writer.writeStartElement(prefix, "lifecycle-factory", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lifecycleFactory); writer.writeEndElement(); @@ -520,16 +526,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacto } // ELEMENT: viewDeclarationLanguageFactory - final List viewDeclarationLanguageFactoryRaw = facesFactory.viewDeclarationLanguageFactory; - if (viewDeclarationLanguageFactoryRaw != null) { - for (final String viewDeclarationLanguageFactoryItem : viewDeclarationLanguageFactoryRaw) { + List viewDeclarationLanguageFactoryRaw = facesFactory.viewDeclarationLanguageFactory; + if (viewDeclarationLanguageFactoryRaw!= null) { + for (String viewDeclarationLanguageFactoryItem: viewDeclarationLanguageFactoryRaw) { String viewDeclarationLanguageFactory = null; try { viewDeclarationLanguageFactory = Adapters.collapsedStringAdapterAdapter.marshal(viewDeclarationLanguageFactoryItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactory, "viewDeclarationLanguageFactory", CollapsedStringAdapter.class, List.class, List.class, e); } - if (viewDeclarationLanguageFactory != null) { + if (viewDeclarationLanguageFactory!= null) { writer.writeStartElement(prefix, "view-declaration-language-factory", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(viewDeclarationLanguageFactory); writer.writeEndElement(); @@ -538,16 +544,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacto } // ELEMENT: tagHandlerDelegateFactory - final List tagHandlerDelegateFactoryRaw = facesFactory.tagHandlerDelegateFactory; - if (tagHandlerDelegateFactoryRaw != null) { - for (final String tagHandlerDelegateFactoryItem : tagHandlerDelegateFactoryRaw) { + List tagHandlerDelegateFactoryRaw = facesFactory.tagHandlerDelegateFactory; + if (tagHandlerDelegateFactoryRaw!= null) { + for (String tagHandlerDelegateFactoryItem: tagHandlerDelegateFactoryRaw) { String tagHandlerDelegateFactory = null; try { tagHandlerDelegateFactory = Adapters.collapsedStringAdapterAdapter.marshal(tagHandlerDelegateFactoryItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactory, "tagHandlerDelegateFactory", CollapsedStringAdapter.class, List.class, List.class, e); } - if (tagHandlerDelegateFactory != null) { + if (tagHandlerDelegateFactory!= null) { writer.writeStartElement(prefix, "tag-handler-delegate-factory", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(tagHandlerDelegateFactory); writer.writeEndElement(); @@ -556,16 +562,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacto } // ELEMENT: renderKitFactory - final List renderKitFactoryRaw = facesFactory.renderKitFactory; - if (renderKitFactoryRaw != null) { - for (final String renderKitFactoryItem : renderKitFactoryRaw) { + List renderKitFactoryRaw = facesFactory.renderKitFactory; + if (renderKitFactoryRaw!= null) { + for (String renderKitFactoryItem: renderKitFactoryRaw) { String renderKitFactory = null; try { renderKitFactory = Adapters.collapsedStringAdapterAdapter.marshal(renderKitFactoryItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactory, "renderKitFactory", CollapsedStringAdapter.class, List.class, List.class, e); } - if (renderKitFactory != null) { + if (renderKitFactory!= null) { writer.writeStartElement(prefix, "render-kit-factory", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(renderKitFactory); writer.writeEndElement(); @@ -574,16 +580,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacto } // ELEMENT: visitContextFactory - final List visitContextFactoryRaw = facesFactory.visitContextFactory; - if (visitContextFactoryRaw != null) { - for (final String visitContextFactoryItem : visitContextFactoryRaw) { + List visitContextFactoryRaw = facesFactory.visitContextFactory; + if (visitContextFactoryRaw!= null) { + for (String visitContextFactoryItem: visitContextFactoryRaw) { String visitContextFactory = null; try { visitContextFactory = Adapters.collapsedStringAdapterAdapter.marshal(visitContextFactoryItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactory, "visitContextFactory", CollapsedStringAdapter.class, List.class, List.class, e); } - if (visitContextFactory != null) { + if (visitContextFactory!= null) { writer.writeStartElement(prefix, "visit-context-factory", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(visitContextFactory); writer.writeEndElement(); @@ -592,10 +598,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesFacto } // ELEMENT: factoryExtension - final List factoryExtension = facesFactory.factoryExtension; - if (factoryExtension != null) { - for (final FacesFactoryExtension factoryExtensionItem : factoryExtension) { - if (factoryExtensionItem != null) { + List factoryExtension = facesFactory.factoryExtension; + if (factoryExtension!= null) { + for (FacesFactoryExtension factoryExtensionItem: factoryExtension) { + if (factoryExtensionItem!= null) { writer.writeStartElement(prefix, "factory-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesFactoryExtension(writer, factoryExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactoryExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactoryExtension$JAXB.java index fdf9200bc74..e211653c84d 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactoryExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactoryExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesFactoryExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesFactoryExtension$JAXB() { super(FacesFactoryExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-factory-extensionType".intern())); } - public static FacesFactoryExtension readFacesFactoryExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesFactoryExtension readFacesFactoryExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesFactoryExtension(final XoXMLStreamWriter writer, final FacesFactoryExtension facesFactoryExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesFactoryExtension(XoXMLStreamWriter writer, FacesFactoryExtension facesFactoryExtension, RuntimeContext context) + throws Exception + { _write(writer, facesFactoryExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesFactoryExtension facesFactoryExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesFactoryExtension facesFactoryExtension, RuntimeContext context) + throws Exception + { _write(writer, facesFactoryExtension, context); } - public final static FacesFactoryExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesFactoryExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesFactoryExtension _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final FacesFactoryExtension facesFactoryExtension = new FacesFactoryExtension(); + FacesFactoryExtension facesFactoryExtension = new FacesFactoryExtension(); context.beforeUnmarshal(facesFactoryExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-factory-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-factory-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesFactoryExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesFactoryExtension); facesFactoryExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesFactoryExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesFactoryExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesFactoryExtension _read(final XoXMLStreamReader reader, return facesFactoryExtension; } - public final FacesFactoryExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesFactoryExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesFactoryExtension facesFactoryExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesFactoryExtension facesFactoryExtension, RuntimeContext context) + throws Exception + { if (facesFactoryExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesFactoryExtension.class != facesFactoryExtension.getClass()) { + if (FacesFactoryExtension.class!= facesFactoryExtension.getClass()) { context.unexpectedSubclass(writer, facesFactoryExtension, FacesFactoryExtension.class); - return; + return ; } context.beforeMarshal(facesFactoryExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesFactoryExtension.id; - if (idRaw != null) { + String idRaw = facesFactoryExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFactoryExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesFactoryExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesFactoryExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesFactoryExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFromAction$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFromAction$JAXB.java index 78ab4fcf3eb..861f8c8d5ef 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFromAction$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFromAction$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class FacesFromAction$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesFromAction$JAXB() { super(FacesFromAction.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-from-actionType".intern())); } - public static FacesFromAction readFacesFromAction(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesFromAction readFacesFromAction(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesFromAction(final XoXMLStreamWriter writer, final FacesFromAction facesFromAction, final RuntimeContext context) - throws Exception { + public static void writeFacesFromAction(XoXMLStreamWriter writer, FacesFromAction facesFromAction, RuntimeContext context) + throws Exception + { _write(writer, facesFromAction, context); } - public void write(final XoXMLStreamWriter writer, final FacesFromAction facesFromAction, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesFromAction facesFromAction, RuntimeContext context) + throws Exception + { _write(writer, facesFromAction, context); } - public final static FacesFromAction _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesFromAction _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,26 +70,26 @@ public final static FacesFromAction _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final FacesFromAction facesFromAction = new FacesFromAction(); + FacesFromAction facesFromAction = new FacesFromAction(); context.beforeUnmarshal(facesFromAction, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-from-actionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-from-actionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesFromAction.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesFromAction); facesFromAction.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id")); } } @@ -97,44 +102,46 @@ public final static FacesFromAction _read(final XoXMLStreamReader reader, Runtim return facesFromAction; } - public final FacesFromAction read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesFromAction read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesFromAction facesFromAction, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesFromAction facesFromAction, RuntimeContext context) + throws Exception + { if (facesFromAction == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesFromAction.class != facesFromAction.getClass()) { + if (FacesFromAction.class!= facesFromAction.getClass()) { context.unexpectedSubclass(writer, facesFromAction, FacesFromAction.class); - return; + return ; } context.beforeMarshal(facesFromAction, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesFromAction.id; - if (idRaw != null) { + String idRaw = facesFromAction.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesFromAction, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // VALUE: value - final FacesELExpression value = facesFromAction.value; + FacesELExpression value = facesFromAction.value; context.afterMarshal(facesFromAction, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycle$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycle$JAXB.java index 978e30f4049..e9c68f6409e 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycle$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycle$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesLifecycleExtension$JAXB.readFacesLifecycleExtension; import static org.apache.openejb.jee.FacesLifecycleExtension$JAXB.writeFacesLifecycleExtension; @@ -36,30 +37,35 @@ "StringEquality" }) public class FacesLifecycle$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesLifecycle$JAXB() { super(FacesLifecycle.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-lifecycleType".intern()), FacesLifecycleExtension$JAXB.class); } - public static FacesLifecycle readFacesLifecycle(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesLifecycle readFacesLifecycle(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesLifecycle(final XoXMLStreamWriter writer, final FacesLifecycle facesLifecycle, final RuntimeContext context) - throws Exception { + public static void writeFacesLifecycle(XoXMLStreamWriter writer, FacesLifecycle facesLifecycle, RuntimeContext context) + throws Exception + { _write(writer, facesLifecycle, context); } - public void write(final XoXMLStreamWriter writer, final FacesLifecycle facesLifecycle, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesLifecycle facesLifecycle, RuntimeContext context) + throws Exception + { _write(writer, facesLifecycle, context); } - public final static FacesLifecycle _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesLifecycle _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,77 +76,75 @@ public final static FacesLifecycle _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final FacesLifecycle facesLifecycle = new FacesLifecycle(); + FacesLifecycle facesLifecycle = new FacesLifecycle(); context.beforeUnmarshal(facesLifecycle, LifecycleCallback.NONE); List phaseListener = null; List lifecycleExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-lifecycleType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-lifecycleType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesLifecycle.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesLifecycle); facesLifecycle.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("phase-listener" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("phase-listener" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: phaseListener - final String phaseListenerItemRaw = elementReader.getElementAsString(); + String phaseListenerItemRaw = elementReader.getElementText(); - final String phaseListenerItem; + String phaseListenerItem; try { phaseListenerItem = Adapters.collapsedStringAdapterAdapter.unmarshal(phaseListenerItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (phaseListener == null) { phaseListener = facesLifecycle.phaseListener; - if (phaseListener != null) { + if (phaseListener!= null) { phaseListener.clear(); } else { - phaseListener = new ArrayList(); + phaseListener = new ArrayList<>(); } } phaseListener.add(phaseListenerItem); - } else if (("lifecycle-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lifecycle-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lifecycleExtension - final FacesLifecycleExtension lifecycleExtensionItem = readFacesLifecycleExtension(elementReader, context); + FacesLifecycleExtension lifecycleExtensionItem = readFacesLifecycleExtension(elementReader, context); if (lifecycleExtension == null) { lifecycleExtension = facesLifecycle.lifecycleExtension; - if (lifecycleExtension != null) { + if (lifecycleExtension!= null) { lifecycleExtension.clear(); } else { - lifecycleExtension = new ArrayList(); + lifecycleExtension = new ArrayList<>(); } } lifecycleExtension.add(lifecycleExtensionItem); } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "phase-listener"), new QName("http://java.sun.com/xml/ns/javaee", "lifecycle-extension")); + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "phase-listener"), new QName("http://java.sun.com/xml/ns/javaee", "lifecycle-extension")); } } - if (phaseListener != null) { + if (phaseListener!= null) { facesLifecycle.phaseListener = phaseListener; } - if (lifecycleExtension != null) { + if (lifecycleExtension!= null) { facesLifecycle.lifecycleExtension = lifecycleExtension; } @@ -149,54 +153,56 @@ public final static FacesLifecycle _read(final XoXMLStreamReader reader, Runtime return facesLifecycle; } - public final FacesLifecycle read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesLifecycle read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesLifecycle facesLifecycle, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesLifecycle facesLifecycle, RuntimeContext context) + throws Exception + { if (facesLifecycle == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesLifecycle.class != facesLifecycle.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesLifecycle.class!= facesLifecycle.getClass()) { context.unexpectedSubclass(writer, facesLifecycle, FacesLifecycle.class); - return; + return ; } context.beforeMarshal(facesLifecycle, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesLifecycle.id; - if (idRaw != null) { + String idRaw = facesLifecycle.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesLifecycle, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: phaseListener - final List phaseListenerRaw = facesLifecycle.phaseListener; - if (phaseListenerRaw != null) { - for (final String phaseListenerItem : phaseListenerRaw) { + List phaseListenerRaw = facesLifecycle.phaseListener; + if (phaseListenerRaw!= null) { + for (String phaseListenerItem: phaseListenerRaw) { String phaseListener = null; try { phaseListener = Adapters.collapsedStringAdapterAdapter.marshal(phaseListenerItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesLifecycle, "phaseListener", CollapsedStringAdapter.class, List.class, List.class, e); } - if (phaseListener != null) { + if (phaseListener!= null) { writer.writeStartElement(prefix, "phase-listener", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(phaseListener); writer.writeEndElement(); @@ -205,10 +211,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesLifec } // ELEMENT: lifecycleExtension - final List lifecycleExtension = facesLifecycle.lifecycleExtension; - if (lifecycleExtension != null) { - for (final FacesLifecycleExtension lifecycleExtensionItem : lifecycleExtension) { - if (lifecycleExtensionItem != null) { + List lifecycleExtension = facesLifecycle.lifecycleExtension; + if (lifecycleExtension!= null) { + for (FacesLifecycleExtension lifecycleExtensionItem: lifecycleExtension) { + if (lifecycleExtensionItem!= null) { writer.writeStartElement(prefix, "lifecycle-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesLifecycleExtension(writer, lifecycleExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycleExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycleExtension$JAXB.java index b921bf19a49..5fbe623d7fc 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycleExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycleExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesLifecycleExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesLifecycleExtension$JAXB() { super(FacesLifecycleExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-lifecycle-extensionType".intern())); } - public static FacesLifecycleExtension readFacesLifecycleExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesLifecycleExtension readFacesLifecycleExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesLifecycleExtension(final XoXMLStreamWriter writer, final FacesLifecycleExtension facesLifecycleExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesLifecycleExtension(XoXMLStreamWriter writer, FacesLifecycleExtension facesLifecycleExtension, RuntimeContext context) + throws Exception + { _write(writer, facesLifecycleExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesLifecycleExtension facesLifecycleExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesLifecycleExtension facesLifecycleExtension, RuntimeContext context) + throws Exception + { _write(writer, facesLifecycleExtension, context); } - public final static FacesLifecycleExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesLifecycleExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesLifecycleExtension _read(final XoXMLStreamReader reader context = new RuntimeContext(); } - final FacesLifecycleExtension facesLifecycleExtension = new FacesLifecycleExtension(); + FacesLifecycleExtension facesLifecycleExtension = new FacesLifecycleExtension(); context.beforeUnmarshal(facesLifecycleExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-lifecycle-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-lifecycle-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesLifecycleExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesLifecycleExtension); facesLifecycleExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesLifecycleExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesLifecycleExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesLifecycleExtension _read(final XoXMLStreamReader reader return facesLifecycleExtension; } - public final FacesLifecycleExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesLifecycleExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesLifecycleExtension facesLifecycleExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesLifecycleExtension facesLifecycleExtension, RuntimeContext context) + throws Exception + { if (facesLifecycleExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesLifecycleExtension.class != facesLifecycleExtension.getClass()) { + if (FacesLifecycleExtension.class!= facesLifecycleExtension.getClass()) { context.unexpectedSubclass(writer, facesLifecycleExtension, FacesLifecycleExtension.class); - return; + return ; } context.beforeMarshal(facesLifecycleExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesLifecycleExtension.id; - if (idRaw != null) { + String idRaw = facesLifecycleExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesLifecycleExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesLifecycleExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesLifecycleExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesLifecycleExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesListEntries$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesListEntries$JAXB.java index 9495b014a78..1ced0c8c7fe 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesListEntries$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesListEntries$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesNullValue$JAXB.readFacesNullValue; import static org.apache.openejb.jee.FacesNullValue$JAXB.writeFacesNullValue; @@ -36,30 +37,35 @@ "StringEquality" }) public class FacesListEntries$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesListEntries$JAXB() { super(FacesListEntries.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-list-entriesType".intern()), FacesNullValue$JAXB.class); } - public static FacesListEntries readFacesListEntries(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesListEntries readFacesListEntries(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesListEntries(final XoXMLStreamWriter writer, final FacesListEntries facesListEntries, final RuntimeContext context) - throws Exception { + public static void writeFacesListEntries(XoXMLStreamWriter writer, FacesListEntries facesListEntries, RuntimeContext context) + throws Exception + { _write(writer, facesListEntries, context); } - public void write(final XoXMLStreamWriter writer, final FacesListEntries facesListEntries, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesListEntries facesListEntries, RuntimeContext context) + throws Exception + { _write(writer, facesListEntries, context); } - public final static FacesListEntries _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesListEntries _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,67 +76,67 @@ public final static FacesListEntries _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final FacesListEntries facesListEntries = new FacesListEntries(); + FacesListEntries facesListEntries = new FacesListEntries(); context.beforeUnmarshal(facesListEntries, LifecycleCallback.NONE); List nullValueOrValue = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-list-entriesType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-list-entriesType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesListEntries.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final java.lang.String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + java.lang.String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesListEntries); facesListEntries.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("value-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("value-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: valueClass - final java.lang.String valueClassRaw = elementReader.getElementAsString(); + java.lang.String valueClassRaw = elementReader.getElementText(); - final java.lang.String valueClass; + java.lang.String valueClass; try { valueClass = Adapters.collapsedStringAdapterAdapter.unmarshal(valueClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, java.lang.String.class, java.lang.String.class, e); continue; } facesListEntries.valueClass = valueClass; - } else if (("value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: nullValueOrValue - final java.lang.String nullValueOrValueItem = elementReader.getElementAsString(); + java.lang.String nullValueOrValueItem = elementReader.getElementText(); if (nullValueOrValue == null) { nullValueOrValue = facesListEntries.nullValueOrValue; - if (nullValueOrValue != null) { + if (nullValueOrValue!= null) { nullValueOrValue.clear(); } else { - nullValueOrValue = new ArrayList(); + nullValueOrValue = new ArrayList<>(); } } nullValueOrValue.add(nullValueOrValueItem); - } else if (("null-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("null-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: nullValueOrValue - final org.apache.openejb.jee.FacesNullValue nullValueOrValueItem1 = readFacesNullValue(elementReader, context); + org.apache.openejb.jee.FacesNullValue nullValueOrValueItem1 = readFacesNullValue(elementReader, context); if (nullValueOrValue == null) { nullValueOrValue = facesListEntries.nullValueOrValue; - if (nullValueOrValue != null) { + if (nullValueOrValue!= null) { nullValueOrValue.clear(); } else { - nullValueOrValue = new ArrayList(); + nullValueOrValue = new ArrayList<>(); } } nullValueOrValue.add(nullValueOrValueItem1); @@ -138,7 +144,7 @@ public final static FacesListEntries _read(final XoXMLStreamReader reader, Runti context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "value-class"), new QName("http://java.sun.com/xml/ns/javaee", "value"), new QName("http://java.sun.com/xml/ns/javaee", "null-value")); } } - if (nullValueOrValue != null) { + if (nullValueOrValue!= null) { facesListEntries.nullValueOrValue = nullValueOrValue; } @@ -147,68 +153,70 @@ public final static FacesListEntries _read(final XoXMLStreamReader reader, Runti return facesListEntries; } - public final FacesListEntries read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesListEntries read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesListEntries facesListEntries, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesListEntries facesListEntries, RuntimeContext context) + throws Exception + { if (facesListEntries == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final java.lang.String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesListEntries.class != facesListEntries.getClass()) { + java.lang.String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesListEntries.class!= facesListEntries.getClass()) { context.unexpectedSubclass(writer, facesListEntries, FacesListEntries.class); - return; + return ; } context.beforeMarshal(facesListEntries, LifecycleCallback.NONE); // ATTRIBUTE: id - final java.lang.String idRaw = facesListEntries.id; - if (idRaw != null) { + java.lang.String idRaw = facesListEntries.id; + if (idRaw!= null) { java.lang.String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesListEntries, "id", CollapsedStringAdapter.class, java.lang.String.class, java.lang.String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: valueClass - final java.lang.String valueClassRaw = facesListEntries.valueClass; + java.lang.String valueClassRaw = facesListEntries.valueClass; java.lang.String valueClass = null; try { valueClass = Adapters.collapsedStringAdapterAdapter.marshal(valueClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesListEntries, "valueClass", CollapsedStringAdapter.class, java.lang.String.class, java.lang.String.class, e); } - if (valueClass != null) { + if (valueClass!= null) { writer.writeStartElement(prefix, "value-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(valueClass); writer.writeEndElement(); } // ELEMENT: nullValueOrValue - final List nullValueOrValue = facesListEntries.nullValueOrValue; - if (nullValueOrValue != null) { - for (final Object nullValueOrValueItem : nullValueOrValue) { + List nullValueOrValue = facesListEntries.nullValueOrValue; + if (nullValueOrValue!= null) { + for (Object nullValueOrValueItem: nullValueOrValue) { if (nullValueOrValueItem instanceof org.apache.openejb.jee.FacesNullValue) { - final org.apache.openejb.jee.FacesNullValue FacesNullValue = ((org.apache.openejb.jee.FacesNullValue) nullValueOrValueItem); + org.apache.openejb.jee.FacesNullValue FacesNullValue = ((org.apache.openejb.jee.FacesNullValue) nullValueOrValueItem); writer.writeStartElement(prefix, "null-value", "http://java.sun.com/xml/ns/javaee"); writeFacesNullValue(writer, FacesNullValue, context); writer.writeEndElement(); } else if (nullValueOrValueItem instanceof java.lang.String) { - final java.lang.String String = ((java.lang.String) nullValueOrValueItem); + java.lang.String String = ((java.lang.String) nullValueOrValueItem); writer.writeStartElement(prefix, "value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(String); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLocale$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLocale$JAXB.java index b4019669403..3cc300b243e 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLocale$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLocale$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class FacesLocale$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesLocale$JAXB() { super(FacesLocale.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-localeType".intern())); } - public static FacesLocale readFacesLocale(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesLocale readFacesLocale(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesLocale(final XoXMLStreamWriter writer, final FacesLocale facesLocale, final RuntimeContext context) - throws Exception { + public static void writeFacesLocale(XoXMLStreamWriter writer, FacesLocale facesLocale, RuntimeContext context) + throws Exception + { _write(writer, facesLocale, context); } - public void write(final XoXMLStreamWriter writer, final FacesLocale facesLocale, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesLocale facesLocale, RuntimeContext context) + throws Exception + { _write(writer, facesLocale, context); } - public final static FacesLocale _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesLocale _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,34 +70,34 @@ public final static FacesLocale _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final FacesLocale facesLocale = new FacesLocale(); + FacesLocale facesLocale = new FacesLocale(); context.beforeUnmarshal(facesLocale, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-localeType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-localeType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesLocale.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute); } } // VALUE: value - final String valueRaw = reader.getElementText(); + String valueRaw = reader.getElementText(); String value = null; boolean valueConverted; try { value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); valueConverted = true; - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); valueConverted = false; } @@ -106,36 +111,38 @@ public final static FacesLocale _read(final XoXMLStreamReader reader, RuntimeCon return facesLocale; } - public final FacesLocale read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesLocale read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesLocale facesLocale, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesLocale facesLocale, RuntimeContext context) + throws Exception + { if (facesLocale == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesLocale.class != facesLocale.getClass()) { + if (FacesLocale.class!= facesLocale.getClass()) { context.unexpectedSubclass(writer, facesLocale, FacesLocale.class); - return; + return ; } context.beforeMarshal(facesLocale, LifecycleCallback.NONE); // VALUE: value - final String valueRaw = facesLocale.value; + String valueRaw = facesLocale.value; String value = null; try { value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesLocale, "value", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeCharacters(value); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLocaleConfig$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLocaleConfig$JAXB.java index 90add11028b..7229e9354eb 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLocaleConfig$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLocaleConfig$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesDefaultLocale$JAXB.readFacesDefaultLocale; import static org.apache.openejb.jee.FacesDefaultLocale$JAXB.writeFacesDefaultLocale; @@ -38,30 +39,35 @@ "StringEquality" }) public class FacesLocaleConfig$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesLocaleConfig$JAXB() { super(FacesLocaleConfig.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-locale-configType".intern()), FacesDefaultLocale$JAXB.class, FacesSupportedLocale$JAXB.class); } - public static FacesLocaleConfig readFacesLocaleConfig(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesLocaleConfig readFacesLocaleConfig(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesLocaleConfig(final XoXMLStreamWriter writer, final FacesLocaleConfig facesLocaleConfig, final RuntimeContext context) - throws Exception { + public static void writeFacesLocaleConfig(XoXMLStreamWriter writer, FacesLocaleConfig facesLocaleConfig, RuntimeContext context) + throws Exception + { _write(writer, facesLocaleConfig, context); } - public void write(final XoXMLStreamWriter writer, final FacesLocaleConfig facesLocaleConfig, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesLocaleConfig facesLocaleConfig, RuntimeContext context) + throws Exception + { _write(writer, facesLocaleConfig, context); } - public final static FacesLocaleConfig _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesLocaleConfig _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,46 +78,46 @@ public final static FacesLocaleConfig _read(final XoXMLStreamReader reader, Runt context = new RuntimeContext(); } - final FacesLocaleConfig facesLocaleConfig = new FacesLocaleConfig(); + FacesLocaleConfig facesLocaleConfig = new FacesLocaleConfig(); context.beforeUnmarshal(facesLocaleConfig, LifecycleCallback.NONE); List supportedLocale = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-locale-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-locale-configType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesLocaleConfig.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesLocaleConfig); facesLocaleConfig.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("default-locale" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("default-locale" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: defaultLocale - final FacesDefaultLocale defaultLocale = readFacesDefaultLocale(elementReader, context); + FacesDefaultLocale defaultLocale = readFacesDefaultLocale(elementReader, context); facesLocaleConfig.defaultLocale = defaultLocale; - } else if (("supported-locale" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("supported-locale" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: supportedLocale - final FacesSupportedLocale supportedLocaleItem = readFacesSupportedLocale(elementReader, context); + FacesSupportedLocale supportedLocaleItem = readFacesSupportedLocale(elementReader, context); if (supportedLocale == null) { supportedLocale = facesLocaleConfig.supportedLocale; - if (supportedLocale != null) { + if (supportedLocale!= null) { supportedLocale.clear(); } else { - supportedLocale = new ArrayList(); + supportedLocale = new ArrayList<>(); } } supportedLocale.add(supportedLocaleItem); @@ -119,7 +125,7 @@ public final static FacesLocaleConfig _read(final XoXMLStreamReader reader, Runt context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "default-locale"), new QName("http://java.sun.com/xml/ns/javaee", "supported-locale")); } } - if (supportedLocale != null) { + if (supportedLocale!= null) { facesLocaleConfig.supportedLocale = supportedLocale; } @@ -128,56 +134,58 @@ public final static FacesLocaleConfig _read(final XoXMLStreamReader reader, Runt return facesLocaleConfig; } - public final FacesLocaleConfig read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesLocaleConfig read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesLocaleConfig facesLocaleConfig, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesLocaleConfig facesLocaleConfig, RuntimeContext context) + throws Exception + { if (facesLocaleConfig == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesLocaleConfig.class != facesLocaleConfig.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesLocaleConfig.class!= facesLocaleConfig.getClass()) { context.unexpectedSubclass(writer, facesLocaleConfig, FacesLocaleConfig.class); - return; + return ; } context.beforeMarshal(facesLocaleConfig, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesLocaleConfig.id; - if (idRaw != null) { + String idRaw = facesLocaleConfig.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesLocaleConfig, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: defaultLocale - final FacesDefaultLocale defaultLocale = facesLocaleConfig.defaultLocale; - if (defaultLocale != null) { + FacesDefaultLocale defaultLocale = facesLocaleConfig.defaultLocale; + if (defaultLocale!= null) { writer.writeStartElement(prefix, "default-locale", "http://java.sun.com/xml/ns/javaee"); writeFacesDefaultLocale(writer, defaultLocale, context); writer.writeEndElement(); } // ELEMENT: supportedLocale - final List supportedLocale = facesLocaleConfig.supportedLocale; - if (supportedLocale != null) { - for (final FacesSupportedLocale supportedLocaleItem : supportedLocale) { - if (supportedLocaleItem != null) { + List supportedLocale = facesLocaleConfig.supportedLocale; + if (supportedLocale!= null) { + for (FacesSupportedLocale supportedLocaleItem: supportedLocale) { + if (supportedLocaleItem!= null) { writer.writeStartElement(prefix, "supported-locale", "http://java.sun.com/xml/ns/javaee"); writeFacesSupportedLocale(writer, supportedLocaleItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedBean$JAXB.java index 512aced6085..a12d4c81307 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedBean$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedBean$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesListEntries$JAXB.readFacesListEntries; import static org.apache.openejb.jee.FacesListEntries$JAXB.writeFacesListEntries; @@ -46,30 +47,35 @@ "StringEquality" }) public class FacesManagedBean$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesManagedBean$JAXB() { super(FacesManagedBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-managed-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesManagedProperty$JAXB.class, FacesMapEntries$JAXB.class, FacesListEntries$JAXB.class, FacesManagedBeanExtension$JAXB.class); } - public static FacesManagedBean readFacesManagedBean(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesManagedBean readFacesManagedBean(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesManagedBean(final XoXMLStreamWriter writer, final FacesManagedBean facesManagedBean, final RuntimeContext context) - throws Exception { + public static void writeFacesManagedBean(XoXMLStreamWriter writer, FacesManagedBean facesManagedBean, RuntimeContext context) + throws Exception + { _write(writer, facesManagedBean, context); } - public void write(final XoXMLStreamWriter writer, final FacesManagedBean facesManagedBean, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesManagedBean facesManagedBean, RuntimeContext context) + throws Exception + { _write(writer, facesManagedBean, context); } - public final static FacesManagedBean _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesManagedBean _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -80,7 +86,7 @@ public final static FacesManagedBean _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final FacesManagedBean facesManagedBean = new FacesManagedBean(); + FacesManagedBean facesManagedBean = new FacesManagedBean(); context.beforeUnmarshal(facesManagedBean, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -90,121 +96,121 @@ public final static FacesManagedBean _read(final XoXMLStreamReader reader, Runti List managedBeanExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-managed-beanType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-managed-beanType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesManagedBean.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesManagedBean); facesManagedBean.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesManagedBean.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("managed-bean-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("managed-bean-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: managedBeanName - final String managedBeanNameRaw = elementReader.getElementAsString(); + String managedBeanNameRaw = elementReader.getElementText(); - final String managedBeanName; + String managedBeanName; try { managedBeanName = Adapters.collapsedStringAdapterAdapter.unmarshal(managedBeanNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesManagedBean.managedBeanName = managedBeanName; - } else if (("managed-bean-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("managed-bean-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: managedBeanClass - final String managedBeanClassRaw = elementReader.getElementAsString(); + String managedBeanClassRaw = elementReader.getElementText(); - final String managedBeanClass; + String managedBeanClass; try { managedBeanClass = Adapters.collapsedStringAdapterAdapter.unmarshal(managedBeanClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesManagedBean.managedBeanClass = managedBeanClass; - } else if (("managed-bean-scope" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("managed-bean-scope" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: managedBeanScope - final String managedBeanScopeRaw = elementReader.getElementAsString(); + String managedBeanScopeRaw = elementReader.getElementText(); - final String managedBeanScope; + String managedBeanScope; try { managedBeanScope = Adapters.collapsedStringAdapterAdapter.unmarshal(managedBeanScopeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesManagedBean.managedBeanScope = managedBeanScope; - } else if (("managed-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("managed-property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: managedProperty - final FacesManagedProperty managedPropertyItem = readFacesManagedProperty(elementReader, context); + FacesManagedProperty managedPropertyItem = readFacesManagedProperty(elementReader, context); if (managedProperty == null) { managedProperty = facesManagedBean.managedProperty; - if (managedProperty != null) { + if (managedProperty!= null) { managedProperty.clear(); } else { - managedProperty = new ArrayList(); + managedProperty = new ArrayList<>(); } } managedProperty.add(managedPropertyItem); - } else if (("map-entries" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("map-entries" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mapEntries - final FacesMapEntries mapEntries = readFacesMapEntries(elementReader, context); + FacesMapEntries mapEntries = readFacesMapEntries(elementReader, context); facesManagedBean.mapEntries = mapEntries; - } else if (("list-entries" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("list-entries" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: listEntries - final FacesListEntries listEntries = readFacesListEntries(elementReader, context); + FacesListEntries listEntries = readFacesListEntries(elementReader, context); facesManagedBean.listEntries = listEntries; - } else if (("managed-bean-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("managed-bean-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: managedBeanExtension - final FacesManagedBeanExtension managedBeanExtensionItem = readFacesManagedBeanExtension(elementReader, context); + FacesManagedBeanExtension managedBeanExtensionItem = readFacesManagedBeanExtension(elementReader, context); if (managedBeanExtension == null) { managedBeanExtension = facesManagedBean.managedBeanExtension; - if (managedBeanExtension != null) { + if (managedBeanExtension!= null) { managedBeanExtension.clear(); } else { - managedBeanExtension = new ArrayList(); + managedBeanExtension = new ArrayList<>(); } } managedBeanExtension.add(managedBeanExtensionItem); @@ -212,27 +218,27 @@ public final static FacesManagedBean _read(final XoXMLStreamReader reader, Runti 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", "managed-bean-name"), new QName("http://java.sun.com/xml/ns/javaee", "managed-bean-class"), new QName("http://java.sun.com/xml/ns/javaee", "managed-bean-scope"), new QName("http://java.sun.com/xml/ns/javaee", "managed-property"), new QName("http://java.sun.com/xml/ns/javaee", "map-entries"), new QName("http://java.sun.com/xml/ns/javaee", "list-entries"), new QName("http://java.sun.com/xml/ns/javaee", "managed-bean-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesManagedBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesManagedBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesManagedBean.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesManagedBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesManagedBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesManagedBean.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesManagedBean.icon = icon; } - if (managedProperty != null) { + if (managedProperty!= null) { facesManagedBean.managedProperty = managedProperty; } - if (managedBeanExtension != null) { + if (managedBeanExtension!= null) { facesManagedBean.managedBeanExtension = managedBeanExtension; } @@ -241,38 +247,40 @@ public final static FacesManagedBean _read(final XoXMLStreamReader reader, Runti return facesManagedBean; } - public final FacesManagedBean read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesManagedBean read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesManagedBean facesManagedBean, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesManagedBean facesManagedBean, RuntimeContext context) + throws Exception + { if (facesManagedBean == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesManagedBean.class != facesManagedBean.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesManagedBean.class!= facesManagedBean.getClass()) { context.unexpectedSubclass(writer, facesManagedBean, FacesManagedBean.class); - return; + return ; } context.beforeMarshal(facesManagedBean, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesManagedBean.id; - if (idRaw != null) { + String idRaw = facesManagedBean.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesManagedBean, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -282,12 +290,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag Text[] descriptions = null; try { descriptions = facesManagedBean.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesManagedBean, "descriptions", FacesManagedBean.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -301,12 +309,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag Text[] displayNames = null; try { displayNames = facesManagedBean.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesManagedBean, "displayNames", FacesManagedBean.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -317,10 +325,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag } // ELEMENT: icon - final LocalCollection icon = facesManagedBean.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesManagedBean.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -331,14 +339,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag } // ELEMENT: managedBeanName - final String managedBeanNameRaw = facesManagedBean.managedBeanName; + String managedBeanNameRaw = facesManagedBean.managedBeanName; String managedBeanName = null; try { managedBeanName = Adapters.collapsedStringAdapterAdapter.marshal(managedBeanNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesManagedBean, "managedBeanName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (managedBeanName != null) { + if (managedBeanName!= null) { writer.writeStartElement(prefix, "managed-bean-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(managedBeanName); writer.writeEndElement(); @@ -347,14 +355,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag } // ELEMENT: managedBeanClass - final String managedBeanClassRaw = facesManagedBean.managedBeanClass; + String managedBeanClassRaw = facesManagedBean.managedBeanClass; String managedBeanClass = null; try { managedBeanClass = Adapters.collapsedStringAdapterAdapter.marshal(managedBeanClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesManagedBean, "managedBeanClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (managedBeanClass != null) { + if (managedBeanClass!= null) { writer.writeStartElement(prefix, "managed-bean-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(managedBeanClass); writer.writeEndElement(); @@ -363,14 +371,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag } // ELEMENT: managedBeanScope - final String managedBeanScopeRaw = facesManagedBean.managedBeanScope; + String managedBeanScopeRaw = facesManagedBean.managedBeanScope; String managedBeanScope = null; try { managedBeanScope = Adapters.collapsedStringAdapterAdapter.marshal(managedBeanScopeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesManagedBean, "managedBeanScope", CollapsedStringAdapter.class, String.class, String.class, e); } - if (managedBeanScope != null) { + if (managedBeanScope!= null) { writer.writeStartElement(prefix, "managed-bean-scope", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(managedBeanScope); writer.writeEndElement(); @@ -379,10 +387,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag } // ELEMENT: managedProperty - final List managedProperty = facesManagedBean.managedProperty; - if (managedProperty != null) { - for (final FacesManagedProperty managedPropertyItem : managedProperty) { - if (managedPropertyItem != null) { + List managedProperty = facesManagedBean.managedProperty; + if (managedProperty!= null) { + for (FacesManagedProperty managedPropertyItem: managedProperty) { + if (managedPropertyItem!= null) { writer.writeStartElement(prefix, "managed-property", "http://java.sun.com/xml/ns/javaee"); writeFacesManagedProperty(writer, managedPropertyItem, context); writer.writeEndElement(); @@ -391,26 +399,26 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag } // ELEMENT: mapEntries - final FacesMapEntries mapEntries = facesManagedBean.mapEntries; - if (mapEntries != null) { + FacesMapEntries mapEntries = facesManagedBean.mapEntries; + if (mapEntries!= null) { writer.writeStartElement(prefix, "map-entries", "http://java.sun.com/xml/ns/javaee"); writeFacesMapEntries(writer, mapEntries, context); writer.writeEndElement(); } // ELEMENT: listEntries - final FacesListEntries listEntries = facesManagedBean.listEntries; - if (listEntries != null) { + FacesListEntries listEntries = facesManagedBean.listEntries; + if (listEntries!= null) { writer.writeStartElement(prefix, "list-entries", "http://java.sun.com/xml/ns/javaee"); writeFacesListEntries(writer, listEntries, context); writer.writeEndElement(); } // ELEMENT: managedBeanExtension - final List managedBeanExtension = facesManagedBean.managedBeanExtension; - if (managedBeanExtension != null) { - for (final FacesManagedBeanExtension managedBeanExtensionItem : managedBeanExtension) { - if (managedBeanExtensionItem != null) { + List managedBeanExtension = facesManagedBean.managedBeanExtension; + if (managedBeanExtension!= null) { + for (FacesManagedBeanExtension managedBeanExtensionItem: managedBeanExtension) { + if (managedBeanExtensionItem!= null) { writer.writeStartElement(prefix, "managed-bean-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesManagedBeanExtension(writer, managedBeanExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedBeanExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedBeanExtension$JAXB.java index 6659fe49b6d..7d62c894366 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedBeanExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedBeanExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesManagedBeanExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesManagedBeanExtension$JAXB() { super(FacesManagedBeanExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-managed-bean-extensionType".intern())); } - public static FacesManagedBeanExtension readFacesManagedBeanExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesManagedBeanExtension readFacesManagedBeanExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesManagedBeanExtension(final XoXMLStreamWriter writer, final FacesManagedBeanExtension facesManagedBeanExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesManagedBeanExtension(XoXMLStreamWriter writer, FacesManagedBeanExtension facesManagedBeanExtension, RuntimeContext context) + throws Exception + { _write(writer, facesManagedBeanExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesManagedBeanExtension facesManagedBeanExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesManagedBeanExtension facesManagedBeanExtension, RuntimeContext context) + throws Exception + { _write(writer, facesManagedBeanExtension, context); } - public final static FacesManagedBeanExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesManagedBeanExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesManagedBeanExtension _read(final XoXMLStreamReader read context = new RuntimeContext(); } - final FacesManagedBeanExtension facesManagedBeanExtension = new FacesManagedBeanExtension(); + FacesManagedBeanExtension facesManagedBeanExtension = new FacesManagedBeanExtension(); context.beforeUnmarshal(facesManagedBeanExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-managed-bean-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-managed-bean-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesManagedBeanExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesManagedBeanExtension); facesManagedBeanExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesManagedBeanExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesManagedBeanExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesManagedBeanExtension _read(final XoXMLStreamReader read return facesManagedBeanExtension; } - public final FacesManagedBeanExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesManagedBeanExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesManagedBeanExtension facesManagedBeanExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesManagedBeanExtension facesManagedBeanExtension, RuntimeContext context) + throws Exception + { if (facesManagedBeanExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesManagedBeanExtension.class != facesManagedBeanExtension.getClass()) { + if (FacesManagedBeanExtension.class!= facesManagedBeanExtension.getClass()) { context.unexpectedSubclass(writer, facesManagedBeanExtension, FacesManagedBeanExtension.class); - return; + return ; } context.beforeMarshal(facesManagedBeanExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesManagedBeanExtension.id; - if (idRaw != null) { + String idRaw = facesManagedBeanExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesManagedBeanExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesManagedBeanExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesManagedBeanExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesManagedBeanExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedProperty$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedProperty$JAXB.java index 18feabd9e77..9981e8a17cf 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedProperty$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesManagedProperty$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.FacesListEntries$JAXB.readFacesListEntries; import static org.apache.openejb.jee.FacesListEntries$JAXB.writeFacesListEntries; @@ -43,30 +44,35 @@ "StringEquality" }) public class FacesManagedProperty$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesManagedProperty$JAXB() { super(FacesManagedProperty.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-managed-propertyType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesMapEntries$JAXB.class, FacesNullValue$JAXB.class, FacesListEntries$JAXB.class); } - public static FacesManagedProperty readFacesManagedProperty(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesManagedProperty readFacesManagedProperty(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesManagedProperty(final XoXMLStreamWriter writer, final FacesManagedProperty facesManagedProperty, final RuntimeContext context) - throws Exception { + public static void writeFacesManagedProperty(XoXMLStreamWriter writer, FacesManagedProperty facesManagedProperty, RuntimeContext context) + throws Exception + { _write(writer, facesManagedProperty, context); } - public void write(final XoXMLStreamWriter writer, final FacesManagedProperty facesManagedProperty, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesManagedProperty facesManagedProperty, RuntimeContext context) + throws Exception + { _write(writer, facesManagedProperty, context); } - public final static FacesManagedProperty _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesManagedProperty _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -77,7 +83,7 @@ public final static FacesManagedProperty _read(final XoXMLStreamReader reader, R context = new RuntimeContext(); } - final FacesManagedProperty facesManagedProperty = new FacesManagedProperty(); + FacesManagedProperty facesManagedProperty = new FacesManagedProperty(); context.beforeUnmarshal(facesManagedProperty, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -85,123 +91,123 @@ public final static FacesManagedProperty _read(final XoXMLStreamReader reader, R LocalCollection icon = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-managed-propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-managed-propertyType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesManagedProperty.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesManagedProperty); facesManagedProperty.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesManagedProperty.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("property-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("property-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: propertyName - final String propertyNameRaw = elementReader.getElementAsString(); + String propertyNameRaw = elementReader.getElementText(); - final String propertyName; + String propertyName; try { propertyName = Adapters.collapsedStringAdapterAdapter.unmarshal(propertyNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesManagedProperty.propertyName = propertyName; - } else if (("property-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("property-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: propertyClass - final String propertyClassRaw = elementReader.getElementAsString(); + String propertyClassRaw = elementReader.getElementText(); - final String propertyClass; + String propertyClass; try { propertyClass = Adapters.collapsedStringAdapterAdapter.unmarshal(propertyClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesManagedProperty.propertyClass = propertyClass; - } else if (("map-entries" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("map-entries" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mapEntries - final FacesMapEntries mapEntries = readFacesMapEntries(elementReader, context); + FacesMapEntries mapEntries = readFacesMapEntries(elementReader, context); facesManagedProperty.mapEntries = mapEntries; - } else if (("null-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("null-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: nullValue - final FacesNullValue nullValue = readFacesNullValue(elementReader, context); + FacesNullValue nullValue = readFacesNullValue(elementReader, context); facesManagedProperty.nullValue = nullValue; - } else if (("value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: value - final String valueRaw = elementReader.getElementAsString(); + String valueRaw = elementReader.getElementText(); - final String value; + String value; try { value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesManagedProperty.value = value; - } else if (("list-entries" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("list-entries" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: listEntries - final FacesListEntries listEntries = readFacesListEntries(elementReader, context); + FacesListEntries listEntries = readFacesListEntries(elementReader, context); facesManagedProperty.listEntries = listEntries; } 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", "property-name"), new QName("http://java.sun.com/xml/ns/javaee", "property-class"), new QName("http://java.sun.com/xml/ns/javaee", "map-entries"), new QName("http://java.sun.com/xml/ns/javaee", "null-value"), new QName("http://java.sun.com/xml/ns/javaee", "value"), new QName("http://java.sun.com/xml/ns/javaee", "list-entries")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesManagedProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesManagedProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesManagedProperty.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesManagedProperty.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesManagedProperty.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesManagedProperty.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesManagedProperty.icon = icon; } @@ -210,38 +216,40 @@ public final static FacesManagedProperty _read(final XoXMLStreamReader reader, R return facesManagedProperty; } - public final FacesManagedProperty read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesManagedProperty read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesManagedProperty facesManagedProperty, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesManagedProperty facesManagedProperty, RuntimeContext context) + throws Exception + { if (facesManagedProperty == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesManagedProperty.class != facesManagedProperty.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesManagedProperty.class!= facesManagedProperty.getClass()) { context.unexpectedSubclass(writer, facesManagedProperty, FacesManagedProperty.class); - return; + return ; } context.beforeMarshal(facesManagedProperty, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesManagedProperty.id; - if (idRaw != null) { + String idRaw = facesManagedProperty.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesManagedProperty, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -251,12 +259,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag Text[] descriptions = null; try { descriptions = facesManagedProperty.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesManagedProperty, "descriptions", FacesManagedProperty.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -270,12 +278,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag Text[] displayNames = null; try { displayNames = facesManagedProperty.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesManagedProperty, "displayNames", FacesManagedProperty.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -286,10 +294,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag } // ELEMENT: icon - final LocalCollection icon = facesManagedProperty.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesManagedProperty.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -300,14 +308,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag } // ELEMENT: propertyName - final String propertyNameRaw = facesManagedProperty.propertyName; + String propertyNameRaw = facesManagedProperty.propertyName; String propertyName = null; try { propertyName = Adapters.collapsedStringAdapterAdapter.marshal(propertyNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesManagedProperty, "propertyName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (propertyName != null) { + if (propertyName!= null) { writer.writeStartElement(prefix, "property-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(propertyName); writer.writeEndElement(); @@ -316,52 +324,52 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesManag } // ELEMENT: propertyClass - final String propertyClassRaw = facesManagedProperty.propertyClass; + String propertyClassRaw = facesManagedProperty.propertyClass; String propertyClass = null; try { propertyClass = Adapters.collapsedStringAdapterAdapter.marshal(propertyClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesManagedProperty, "propertyClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (propertyClass != null) { + if (propertyClass!= null) { writer.writeStartElement(prefix, "property-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(propertyClass); writer.writeEndElement(); } // ELEMENT: mapEntries - final FacesMapEntries mapEntries = facesManagedProperty.mapEntries; - if (mapEntries != null) { + FacesMapEntries mapEntries = facesManagedProperty.mapEntries; + if (mapEntries!= null) { writer.writeStartElement(prefix, "map-entries", "http://java.sun.com/xml/ns/javaee"); writeFacesMapEntries(writer, mapEntries, context); writer.writeEndElement(); } // ELEMENT: nullValue - final FacesNullValue nullValue = facesManagedProperty.nullValue; - if (nullValue != null) { + FacesNullValue nullValue = facesManagedProperty.nullValue; + if (nullValue!= null) { writer.writeStartElement(prefix, "null-value", "http://java.sun.com/xml/ns/javaee"); writeFacesNullValue(writer, nullValue, context); writer.writeEndElement(); } // ELEMENT: value - final String valueRaw = facesManagedProperty.value; + String valueRaw = facesManagedProperty.value; String value = null; try { value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesManagedProperty, "value", CollapsedStringAdapter.class, String.class, String.class, e); } - if (value != null) { + if (value!= null) { writer.writeStartElement(prefix, "value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(value); writer.writeEndElement(); } // ELEMENT: listEntries - final FacesListEntries listEntries = facesManagedProperty.listEntries; - if (listEntries != null) { + FacesListEntries listEntries = facesManagedProperty.listEntries; + if (listEntries!= null) { writer.writeStartElement(prefix, "list-entries", "http://java.sun.com/xml/ns/javaee"); writeFacesListEntries(writer, listEntries, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesMapEntries$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesMapEntries$JAXB.java index 43108124e84..2e93107d953 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesMapEntries$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesMapEntries$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesMapEntry$JAXB.readFacesMapEntry; import static org.apache.openejb.jee.FacesMapEntry$JAXB.writeFacesMapEntry; @@ -36,30 +37,35 @@ "StringEquality" }) public class FacesMapEntries$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesMapEntries$JAXB() { super(FacesMapEntries.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-map-entriesType".intern()), FacesMapEntry$JAXB.class); } - public static FacesMapEntries readFacesMapEntries(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesMapEntries readFacesMapEntries(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesMapEntries(final XoXMLStreamWriter writer, final FacesMapEntries facesMapEntries, final RuntimeContext context) - throws Exception { + public static void writeFacesMapEntries(XoXMLStreamWriter writer, FacesMapEntries facesMapEntries, RuntimeContext context) + throws Exception + { _write(writer, facesMapEntries, context); } - public void write(final XoXMLStreamWriter writer, final FacesMapEntries facesMapEntries, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesMapEntries facesMapEntries, RuntimeContext context) + throws Exception + { _write(writer, facesMapEntries, context); } - public final static FacesMapEntries _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesMapEntries _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,68 +76,68 @@ public final static FacesMapEntries _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final FacesMapEntries facesMapEntries = new FacesMapEntries(); + FacesMapEntries facesMapEntries = new FacesMapEntries(); context.beforeUnmarshal(facesMapEntries, LifecycleCallback.NONE); List mapEntry = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-map-entriesType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-map-entriesType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesMapEntries.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesMapEntries); facesMapEntries.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("key-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("key-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: keyClass - final String keyClassRaw = elementReader.getElementAsString(); + String keyClassRaw = elementReader.getElementText(); - final String keyClass; + String keyClass; try { keyClass = Adapters.collapsedStringAdapterAdapter.unmarshal(keyClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesMapEntries.keyClass = keyClass; - } else if (("value-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("value-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: valueClass - final String valueClassRaw = elementReader.getElementAsString(); + String valueClassRaw = elementReader.getElementText(); - final String valueClass; + String valueClass; try { valueClass = Adapters.collapsedStringAdapterAdapter.unmarshal(valueClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesMapEntries.valueClass = valueClass; - } else if (("map-entry" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("map-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mapEntry - final FacesMapEntry mapEntryItem = readFacesMapEntry(elementReader, context); + FacesMapEntry mapEntryItem = readFacesMapEntry(elementReader, context); if (mapEntry == null) { mapEntry = facesMapEntries.mapEntry; - if (mapEntry != null) { + if (mapEntry!= null) { mapEntry.clear(); } else { - mapEntry = new ArrayList(); + mapEntry = new ArrayList<>(); } } mapEntry.add(mapEntryItem); @@ -139,7 +145,7 @@ public final static FacesMapEntries _read(final XoXMLStreamReader reader, Runtim context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "key-class"), new QName("http://java.sun.com/xml/ns/javaee", "value-class"), new QName("http://java.sun.com/xml/ns/javaee", "map-entry")); } } - if (mapEntry != null) { + if (mapEntry!= null) { facesMapEntries.mapEntry = mapEntry; } @@ -148,76 +154,78 @@ public final static FacesMapEntries _read(final XoXMLStreamReader reader, Runtim return facesMapEntries; } - public final FacesMapEntries read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesMapEntries read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesMapEntries facesMapEntries, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesMapEntries facesMapEntries, RuntimeContext context) + throws Exception + { if (facesMapEntries == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesMapEntries.class != facesMapEntries.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesMapEntries.class!= facesMapEntries.getClass()) { context.unexpectedSubclass(writer, facesMapEntries, FacesMapEntries.class); - return; + return ; } context.beforeMarshal(facesMapEntries, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesMapEntries.id; - if (idRaw != null) { + String idRaw = facesMapEntries.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesMapEntries, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: keyClass - final String keyClassRaw = facesMapEntries.keyClass; + String keyClassRaw = facesMapEntries.keyClass; String keyClass = null; try { keyClass = Adapters.collapsedStringAdapterAdapter.marshal(keyClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesMapEntries, "keyClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (keyClass != null) { + if (keyClass!= null) { writer.writeStartElement(prefix, "key-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(keyClass); writer.writeEndElement(); } // ELEMENT: valueClass - final String valueClassRaw = facesMapEntries.valueClass; + String valueClassRaw = facesMapEntries.valueClass; String valueClass = null; try { valueClass = Adapters.collapsedStringAdapterAdapter.marshal(valueClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesMapEntries, "valueClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (valueClass != null) { + if (valueClass!= null) { writer.writeStartElement(prefix, "value-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(valueClass); writer.writeEndElement(); } // ELEMENT: mapEntry - final List mapEntry = facesMapEntries.mapEntry; - if (mapEntry != null) { - for (final FacesMapEntry mapEntryItem : mapEntry) { - if (mapEntryItem != null) { + List mapEntry = facesMapEntries.mapEntry; + if (mapEntry!= null) { + for (FacesMapEntry mapEntryItem: mapEntry) { + if (mapEntryItem!= null) { writer.writeStartElement(prefix, "map-entry", "http://java.sun.com/xml/ns/javaee"); writeFacesMapEntry(writer, mapEntryItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesMapEntry$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesMapEntry$JAXB.java index db53ad71302..cf47866d1b4 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesMapEntry$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesMapEntry$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.FacesNullValue$JAXB.readFacesNullValue; import static org.apache.openejb.jee.FacesNullValue$JAXB.writeFacesNullValue; @@ -34,30 +35,35 @@ "StringEquality" }) public class FacesMapEntry$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesMapEntry$JAXB() { super(FacesMapEntry.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-map-entryType".intern()), FacesNullValue$JAXB.class); } - public static FacesMapEntry readFacesMapEntry(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesMapEntry readFacesMapEntry(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesMapEntry(final XoXMLStreamWriter writer, final FacesMapEntry facesMapEntry, final RuntimeContext context) - throws Exception { + public static void writeFacesMapEntry(XoXMLStreamWriter writer, FacesMapEntry facesMapEntry, RuntimeContext context) + throws Exception + { _write(writer, facesMapEntry, context); } - public void write(final XoXMLStreamWriter writer, final FacesMapEntry facesMapEntry, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesMapEntry facesMapEntry, RuntimeContext context) + throws Exception + { _write(writer, facesMapEntry, context); } - public final static FacesMapEntry _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesMapEntry _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -68,57 +74,57 @@ public final static FacesMapEntry _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final FacesMapEntry facesMapEntry = new FacesMapEntry(); + FacesMapEntry facesMapEntry = new FacesMapEntry(); context.beforeUnmarshal(facesMapEntry, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-map-entryType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-map-entryType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesMapEntry.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesMapEntry); facesMapEntry.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("key" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("key" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: key - final String keyRaw = elementReader.getElementAsString(); + String keyRaw = elementReader.getElementText(); - final String key; + String key; try { key = Adapters.collapsedStringAdapterAdapter.unmarshal(keyRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesMapEntry.key = key; - } else if (("null-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("null-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: nullValue - final FacesNullValue nullValue = readFacesNullValue(elementReader, context); + FacesNullValue nullValue = readFacesNullValue(elementReader, context); facesMapEntry.nullValue = nullValue; - } else if (("value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: value - final String valueRaw = elementReader.getElementAsString(); + String valueRaw = elementReader.getElementText(); - final String value; + String value; try { value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -134,52 +140,54 @@ public final static FacesMapEntry _read(final XoXMLStreamReader reader, RuntimeC return facesMapEntry; } - public final FacesMapEntry read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesMapEntry read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesMapEntry facesMapEntry, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesMapEntry facesMapEntry, RuntimeContext context) + throws Exception + { if (facesMapEntry == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesMapEntry.class != facesMapEntry.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesMapEntry.class!= facesMapEntry.getClass()) { context.unexpectedSubclass(writer, facesMapEntry, FacesMapEntry.class); - return; + return ; } context.beforeMarshal(facesMapEntry, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesMapEntry.id; - if (idRaw != null) { + String idRaw = facesMapEntry.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesMapEntry, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: key - final String keyRaw = facesMapEntry.key; + String keyRaw = facesMapEntry.key; String key = null; try { key = Adapters.collapsedStringAdapterAdapter.marshal(keyRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesMapEntry, "key", CollapsedStringAdapter.class, String.class, String.class, e); } - if (key != null) { + if (key!= null) { writer.writeStartElement(prefix, "key", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(key); writer.writeEndElement(); @@ -188,22 +196,22 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesMapEn } // ELEMENT: nullValue - final FacesNullValue nullValue = facesMapEntry.nullValue; - if (nullValue != null) { + FacesNullValue nullValue = facesMapEntry.nullValue; + if (nullValue!= null) { writer.writeStartElement(prefix, "null-value", "http://java.sun.com/xml/ns/javaee"); writeFacesNullValue(writer, nullValue, context); writer.writeEndElement(); } // ELEMENT: value - final String valueRaw = facesMapEntry.value; + String valueRaw = facesMapEntry.value; String value = null; try { value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesMapEntry, "value", CollapsedStringAdapter.class, String.class, String.class, e); } - if (value != null) { + if (value!= null) { writer.writeStartElement(prefix, "value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(value); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationCase$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationCase$JAXB.java index d7a347d74d3..98bd76e9855 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationCase$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationCase$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.FacesFromAction$JAXB.readFacesFromAction; import static org.apache.openejb.jee.FacesFromAction$JAXB.writeFacesFromAction; @@ -41,30 +42,35 @@ "StringEquality" }) public class FacesNavigationCase$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesNavigationCase$JAXB() { super(FacesNavigationCase.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-navigation-caseType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesFromAction$JAXB.class, FacesRedirect$JAXB.class); } - public static FacesNavigationCase readFacesNavigationCase(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesNavigationCase readFacesNavigationCase(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesNavigationCase(final XoXMLStreamWriter writer, final FacesNavigationCase facesNavigationCase, final RuntimeContext context) - throws Exception { + public static void writeFacesNavigationCase(XoXMLStreamWriter writer, FacesNavigationCase facesNavigationCase, RuntimeContext context) + throws Exception + { _write(writer, facesNavigationCase, context); } - public void write(final XoXMLStreamWriter writer, final FacesNavigationCase facesNavigationCase, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesNavigationCase facesNavigationCase, RuntimeContext context) + throws Exception + { _write(writer, facesNavigationCase, context); } - public final static FacesNavigationCase _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesNavigationCase _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -75,7 +81,7 @@ public final static FacesNavigationCase _read(final XoXMLStreamReader reader, Ru context = new RuntimeContext(); } - final FacesNavigationCase facesNavigationCase = new FacesNavigationCase(); + FacesNavigationCase facesNavigationCase = new FacesNavigationCase(); context.beforeUnmarshal(facesNavigationCase, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -83,119 +89,119 @@ public final static FacesNavigationCase _read(final XoXMLStreamReader reader, Ru LocalCollection icon = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-navigation-caseType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-navigation-caseType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesNavigationCase.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesNavigationCase); facesNavigationCase.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesNavigationCase.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("from-action" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("from-action" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: fromAction - final FacesFromAction fromAction = readFacesFromAction(elementReader, context); + FacesFromAction fromAction = readFacesFromAction(elementReader, context); facesNavigationCase.fromAction = fromAction; - } else if (("from-outcome" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("from-outcome" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: fromOutcome - final String fromOutcomeRaw = elementReader.getElementAsString(); + String fromOutcomeRaw = elementReader.getElementText(); - final String fromOutcome; + String fromOutcome; try { fromOutcome = Adapters.collapsedStringAdapterAdapter.unmarshal(fromOutcomeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesNavigationCase.fromOutcome = fromOutcome; - } else if (("if" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("if" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: _if - final String _ifRaw = elementReader.getElementAsString(); + String _ifRaw = elementReader.getElementText(); - final String _if; + String _if; try { _if = Adapters.collapsedStringAdapterAdapter.unmarshal(_ifRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesNavigationCase._if = _if; - } else if (("to-view-id" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("to-view-id" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: toViewId - final String toViewIdRaw = elementReader.getElementAsString(); + String toViewIdRaw = elementReader.getElementText(); - final String toViewId; + String toViewId; try { toViewId = Adapters.collapsedStringAdapterAdapter.unmarshal(toViewIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesNavigationCase.toViewId = toViewId; - } else if (("redirect" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("redirect" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: redirect - final FacesRedirect redirect = readFacesRedirect(elementReader, context); + FacesRedirect redirect = readFacesRedirect(elementReader, context); facesNavigationCase.redirect = redirect; } 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", "from-action"), new QName("http://java.sun.com/xml/ns/javaee", "from-outcome"), new QName("http://java.sun.com/xml/ns/javaee", "if"), new QName("http://java.sun.com/xml/ns/javaee", "to-view-id"), new QName("http://java.sun.com/xml/ns/javaee", "redirect")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesNavigationCase.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesNavigationCase.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesNavigationCase.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesNavigationCase.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesNavigationCase.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesNavigationCase.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesNavigationCase.icon = icon; } @@ -204,38 +210,40 @@ public final static FacesNavigationCase _read(final XoXMLStreamReader reader, Ru return facesNavigationCase; } - public final FacesNavigationCase read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesNavigationCase read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesNavigationCase facesNavigationCase, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesNavigationCase facesNavigationCase, RuntimeContext context) + throws Exception + { if (facesNavigationCase == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesNavigationCase.class != facesNavigationCase.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesNavigationCase.class!= facesNavigationCase.getClass()) { context.unexpectedSubclass(writer, facesNavigationCase, FacesNavigationCase.class); - return; + return ; } context.beforeMarshal(facesNavigationCase, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesNavigationCase.id; - if (idRaw != null) { + String idRaw = facesNavigationCase.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesNavigationCase, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -245,12 +253,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesNavig Text[] descriptions = null; try { descriptions = facesNavigationCase.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesNavigationCase, "descriptions", FacesNavigationCase.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -264,12 +272,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesNavig Text[] displayNames = null; try { displayNames = facesNavigationCase.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesNavigationCase, "displayNames", FacesNavigationCase.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -280,10 +288,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesNavig } // ELEMENT: icon - final LocalCollection icon = facesNavigationCase.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesNavigationCase.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -294,50 +302,50 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesNavig } // ELEMENT: fromAction - final FacesFromAction fromAction = facesNavigationCase.fromAction; - if (fromAction != null) { + FacesFromAction fromAction = facesNavigationCase.fromAction; + if (fromAction!= null) { writer.writeStartElement(prefix, "from-action", "http://java.sun.com/xml/ns/javaee"); writeFacesFromAction(writer, fromAction, context); writer.writeEndElement(); } // ELEMENT: fromOutcome - final String fromOutcomeRaw = facesNavigationCase.fromOutcome; + String fromOutcomeRaw = facesNavigationCase.fromOutcome; String fromOutcome = null; try { fromOutcome = Adapters.collapsedStringAdapterAdapter.marshal(fromOutcomeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesNavigationCase, "fromOutcome", CollapsedStringAdapter.class, String.class, String.class, e); } - if (fromOutcome != null) { + if (fromOutcome!= null) { writer.writeStartElement(prefix, "from-outcome", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(fromOutcome); writer.writeEndElement(); } // ELEMENT: _if - final String _ifRaw = facesNavigationCase._if; + String _ifRaw = facesNavigationCase._if; String _if = null; try { _if = Adapters.collapsedStringAdapterAdapter.marshal(_ifRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesNavigationCase, "_if", CollapsedStringAdapter.class, String.class, String.class, e); } - if (_if != null) { + if (_if!= null) { writer.writeStartElement(prefix, "if", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(_if); writer.writeEndElement(); } // ELEMENT: toViewId - final String toViewIdRaw = facesNavigationCase.toViewId; + String toViewIdRaw = facesNavigationCase.toViewId; String toViewId = null; try { toViewId = Adapters.collapsedStringAdapterAdapter.marshal(toViewIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesNavigationCase, "toViewId", CollapsedStringAdapter.class, String.class, String.class, e); } - if (toViewId != null) { + if (toViewId!= null) { writer.writeStartElement(prefix, "to-view-id", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toViewId); writer.writeEndElement(); @@ -346,8 +354,8 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesNavig } // ELEMENT: redirect - final FacesRedirect redirect = facesNavigationCase.redirect; - if (redirect != null) { + FacesRedirect redirect = facesNavigationCase.redirect; + if (redirect!= null) { writer.writeStartElement(prefix, "redirect", "http://java.sun.com/xml/ns/javaee"); writeFacesRedirect(writer, redirect, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRule$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRule$JAXB.java index 02ad680eca2..877b5835e9b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRule$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRule$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesNavigationCase$JAXB.readFacesNavigationCase; import static org.apache.openejb.jee.FacesNavigationCase$JAXB.writeFacesNavigationCase; @@ -42,30 +43,35 @@ "StringEquality" }) public class FacesNavigationRule$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesNavigationRule$JAXB() { super(FacesNavigationRule.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-navigation-ruleType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesNavigationCase$JAXB.class, FacesNavigationRuleExtension$JAXB.class); } - public static FacesNavigationRule readFacesNavigationRule(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesNavigationRule readFacesNavigationRule(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesNavigationRule(final XoXMLStreamWriter writer, final FacesNavigationRule facesNavigationRule, final RuntimeContext context) - throws Exception { + public static void writeFacesNavigationRule(XoXMLStreamWriter writer, FacesNavigationRule facesNavigationRule, RuntimeContext context) + throws Exception + { _write(writer, facesNavigationRule, context); } - public void write(final XoXMLStreamWriter writer, final FacesNavigationRule facesNavigationRule, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesNavigationRule facesNavigationRule, RuntimeContext context) + throws Exception + { _write(writer, facesNavigationRule, context); } - public final static FacesNavigationRule _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesNavigationRule _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -76,7 +82,7 @@ public final static FacesNavigationRule _read(final XoXMLStreamReader reader, Ru context = new RuntimeContext(); } - final FacesNavigationRule facesNavigationRule = new FacesNavigationRule(); + FacesNavigationRule facesNavigationRule = new FacesNavigationRule(); context.beforeUnmarshal(facesNavigationRule, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -86,117 +92,115 @@ public final static FacesNavigationRule _read(final XoXMLStreamReader reader, Ru List navigationRuleExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-navigation-ruleType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-navigation-ruleType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesNavigationRule.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesNavigationRule); facesNavigationRule.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesNavigationRule.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("from-view-id" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("from-view-id" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: fromViewId - final String fromViewIdRaw = elementReader.getElementAsString(); + String fromViewIdRaw = elementReader.getElementText(); - final String fromViewId; + String fromViewId; try { fromViewId = Adapters.collapsedStringAdapterAdapter.unmarshal(fromViewIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesNavigationRule.fromViewId = fromViewId; - } else if (("navigation-case" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("navigation-case" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: navigationCase - final FacesNavigationCase navigationCaseItem = readFacesNavigationCase(elementReader, context); + FacesNavigationCase navigationCaseItem = readFacesNavigationCase(elementReader, context); if (navigationCase == null) { navigationCase = facesNavigationRule.navigationCase; - if (navigationCase != null) { + if (navigationCase!= null) { navigationCase.clear(); } else { - navigationCase = new ArrayList(); + navigationCase = new ArrayList<>(); } } navigationCase.add(navigationCaseItem); - } else if (("navigation-rule-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("navigation-rule-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: navigationRuleExtension - final FacesNavigationRuleExtension navigationRuleExtensionItem = readFacesNavigationRuleExtension(elementReader, context); + FacesNavigationRuleExtension navigationRuleExtensionItem = readFacesNavigationRuleExtension(elementReader, context); if (navigationRuleExtension == null) { navigationRuleExtension = facesNavigationRule.navigationRuleExtension; - if (navigationRuleExtension != null) { + if (navigationRuleExtension!= null) { navigationRuleExtension.clear(); } else { - navigationRuleExtension = new ArrayList(); + navigationRuleExtension = new ArrayList<>(); } } navigationRuleExtension.add(navigationRuleExtensionItem); } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // 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", "from-view-id"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-case"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-rule-extension")); + 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", "from-view-id"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-case"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-rule-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesNavigationRule.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesNavigationRule.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesNavigationRule.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesNavigationRule.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesNavigationRule.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesNavigationRule.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesNavigationRule.icon = icon; } - if (navigationCase != null) { + if (navigationCase!= null) { facesNavigationRule.navigationCase = navigationCase; } - if (navigationRuleExtension != null) { + if (navigationRuleExtension!= null) { facesNavigationRule.navigationRuleExtension = navigationRuleExtension; } @@ -205,38 +209,40 @@ public final static FacesNavigationRule _read(final XoXMLStreamReader reader, Ru return facesNavigationRule; } - public final FacesNavigationRule read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesNavigationRule read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesNavigationRule facesNavigationRule, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesNavigationRule facesNavigationRule, RuntimeContext context) + throws Exception + { if (facesNavigationRule == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesNavigationRule.class != facesNavigationRule.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesNavigationRule.class!= facesNavigationRule.getClass()) { context.unexpectedSubclass(writer, facesNavigationRule, FacesNavigationRule.class); - return; + return ; } context.beforeMarshal(facesNavigationRule, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesNavigationRule.id; - if (idRaw != null) { + String idRaw = facesNavigationRule.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesNavigationRule, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -246,12 +252,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesNavig Text[] descriptions = null; try { descriptions = facesNavigationRule.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesNavigationRule, "descriptions", FacesNavigationRule.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -265,12 +271,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesNavig Text[] displayNames = null; try { displayNames = facesNavigationRule.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesNavigationRule, "displayNames", FacesNavigationRule.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -281,10 +287,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesNavig } // ELEMENT: icon - final LocalCollection icon = facesNavigationRule.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesNavigationRule.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -295,24 +301,24 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesNavig } // ELEMENT: fromViewId - final String fromViewIdRaw = facesNavigationRule.fromViewId; + String fromViewIdRaw = facesNavigationRule.fromViewId; String fromViewId = null; try { fromViewId = Adapters.collapsedStringAdapterAdapter.marshal(fromViewIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesNavigationRule, "fromViewId", CollapsedStringAdapter.class, String.class, String.class, e); } - if (fromViewId != null) { + if (fromViewId!= null) { writer.writeStartElement(prefix, "from-view-id", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(fromViewId); writer.writeEndElement(); } // ELEMENT: navigationCase - final List navigationCase = facesNavigationRule.navigationCase; - if (navigationCase != null) { - for (final FacesNavigationCase navigationCaseItem : navigationCase) { - if (navigationCaseItem != null) { + List navigationCase = facesNavigationRule.navigationCase; + if (navigationCase!= null) { + for (FacesNavigationCase navigationCaseItem: navigationCase) { + if (navigationCaseItem!= null) { writer.writeStartElement(prefix, "navigation-case", "http://java.sun.com/xml/ns/javaee"); writeFacesNavigationCase(writer, navigationCaseItem, context); writer.writeEndElement(); @@ -321,10 +327,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesNavig } // ELEMENT: navigationRuleExtension - final List navigationRuleExtension = facesNavigationRule.navigationRuleExtension; - if (navigationRuleExtension != null) { - for (final FacesNavigationRuleExtension navigationRuleExtensionItem : navigationRuleExtension) { - if (navigationRuleExtensionItem != null) { + List navigationRuleExtension = facesNavigationRule.navigationRuleExtension; + if (navigationRuleExtension!= null) { + for (FacesNavigationRuleExtension navigationRuleExtensionItem: navigationRuleExtension) { + if (navigationRuleExtensionItem!= null) { writer.writeStartElement(prefix, "navigation-rule-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesNavigationRuleExtension(writer, navigationRuleExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRuleExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRuleExtension$JAXB.java index 1072ea54b9f..c0a75f3dc78 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRuleExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRuleExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesNavigationRuleExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesNavigationRuleExtension$JAXB() { super(FacesNavigationRuleExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-navigation-rule-extensionType".intern())); } - public static FacesNavigationRuleExtension readFacesNavigationRuleExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesNavigationRuleExtension readFacesNavigationRuleExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesNavigationRuleExtension(final XoXMLStreamWriter writer, final FacesNavigationRuleExtension facesNavigationRuleExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesNavigationRuleExtension(XoXMLStreamWriter writer, FacesNavigationRuleExtension facesNavigationRuleExtension, RuntimeContext context) + throws Exception + { _write(writer, facesNavigationRuleExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesNavigationRuleExtension facesNavigationRuleExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesNavigationRuleExtension facesNavigationRuleExtension, RuntimeContext context) + throws Exception + { _write(writer, facesNavigationRuleExtension, context); } - public final static FacesNavigationRuleExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesNavigationRuleExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesNavigationRuleExtension _read(final XoXMLStreamReader r context = new RuntimeContext(); } - final FacesNavigationRuleExtension facesNavigationRuleExtension = new FacesNavigationRuleExtension(); + FacesNavigationRuleExtension facesNavigationRuleExtension = new FacesNavigationRuleExtension(); context.beforeUnmarshal(facesNavigationRuleExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-navigation-rule-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-navigation-rule-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesNavigationRuleExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesNavigationRuleExtension); facesNavigationRuleExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesNavigationRuleExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesNavigationRuleExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesNavigationRuleExtension _read(final XoXMLStreamReader r return facesNavigationRuleExtension; } - public final FacesNavigationRuleExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesNavigationRuleExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesNavigationRuleExtension facesNavigationRuleExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesNavigationRuleExtension facesNavigationRuleExtension, RuntimeContext context) + throws Exception + { if (facesNavigationRuleExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesNavigationRuleExtension.class != facesNavigationRuleExtension.getClass()) { + if (FacesNavigationRuleExtension.class!= facesNavigationRuleExtension.getClass()) { context.unexpectedSubclass(writer, facesNavigationRuleExtension, FacesNavigationRuleExtension.class); - return; + return ; } context.beforeMarshal(facesNavigationRuleExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesNavigationRuleExtension.id; - if (idRaw != null) { + String idRaw = facesNavigationRuleExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesNavigationRuleExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesNavigationRuleExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesNavigationRuleExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesNavigationRuleExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNullValue$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNullValue$JAXB.java index f7e8dc3d849..efd1033456c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNullValue$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNullValue$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class FacesNullValue$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesNullValue$JAXB() { super(FacesNullValue.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-null-valueType".intern())); } - public static FacesNullValue readFacesNullValue(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesNullValue readFacesNullValue(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesNullValue(final XoXMLStreamWriter writer, final FacesNullValue facesNullValue, final RuntimeContext context) - throws Exception { + public static void writeFacesNullValue(XoXMLStreamWriter writer, FacesNullValue facesNullValue, RuntimeContext context) + throws Exception + { _write(writer, facesNullValue, context); } - public void write(final XoXMLStreamWriter writer, final FacesNullValue facesNullValue, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesNullValue facesNullValue, RuntimeContext context) + throws Exception + { _write(writer, facesNullValue, context); } - public final static FacesNullValue _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesNullValue _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,32 +70,32 @@ public final static FacesNullValue _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final FacesNullValue facesNullValue = new FacesNullValue(); + FacesNullValue facesNullValue = new FacesNullValue(); context.beforeUnmarshal(facesNullValue, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-null-valueType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-null-valueType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesNullValue.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesNullValue); facesNullValue.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { context.unexpectedElement(elementReader); } @@ -99,37 +104,39 @@ public final static FacesNullValue _read(final XoXMLStreamReader reader, Runtime return facesNullValue; } - public final FacesNullValue read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesNullValue read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesNullValue facesNullValue, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesNullValue facesNullValue, RuntimeContext context) + throws Exception + { if (facesNullValue == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesNullValue.class != facesNullValue.getClass()) { + if (FacesNullValue.class!= facesNullValue.getClass()) { context.unexpectedSubclass(writer, facesNullValue, FacesNullValue.class); - return; + return ; } context.beforeMarshal(facesNullValue, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesNullValue.id; - if (idRaw != null) { + String idRaw = facesNullValue.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesNullValue, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrdering$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrdering$JAXB.java index bc57e0a60bc..ffbabc0409f 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrdering$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrdering$JAXB.java @@ -1,21 +1,24 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,8 +26,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.FacesOrderingOrdering$JAXB.readFacesOrderingOrdering; import static org.apache.openejb.jee.FacesOrderingOrdering$JAXB.writeFacesOrderingOrdering; @@ -33,30 +34,35 @@ "StringEquality" }) public class FacesOrdering$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesOrdering$JAXB() { super(FacesOrdering.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-orderingType".intern()), FacesOrderingOrdering$JAXB.class); } - public static FacesOrdering readFacesOrdering(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesOrdering readFacesOrdering(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesOrdering(final XoXMLStreamWriter writer, final FacesOrdering facesOrdering, final RuntimeContext context) - throws Exception { + public static void writeFacesOrdering(XoXMLStreamWriter writer, FacesOrdering facesOrdering, RuntimeContext context) + throws Exception + { _write(writer, facesOrdering, context); } - public void write(final XoXMLStreamWriter writer, final FacesOrdering facesOrdering, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesOrdering facesOrdering, RuntimeContext context) + throws Exception + { _write(writer, facesOrdering, context); } - public final static FacesOrdering _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesOrdering _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,39 +73,37 @@ public final static FacesOrdering _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final FacesOrdering facesOrdering = new FacesOrdering(); + FacesOrdering facesOrdering = new FacesOrdering(); context.beforeUnmarshal(facesOrdering, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-orderingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-orderingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesOrdering.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("after" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("after" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: after - final FacesOrderingOrdering after = readFacesOrderingOrdering(elementReader, context); + FacesOrderingOrdering after = readFacesOrderingOrdering(elementReader, context); facesOrdering.after = after; - } else if (("before" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("before" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: before - final FacesOrderingOrdering before = readFacesOrderingOrdering(elementReader, context); + FacesOrderingOrdering before = readFacesOrderingOrdering(elementReader, context); facesOrdering.before = before; } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "after"), new QName("http://java.sun.com/xml/ns/javaee", "before")); + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "after"), new QName("http://java.sun.com/xml/ns/javaee", "before")); } } @@ -108,42 +112,44 @@ public final static FacesOrdering _read(final XoXMLStreamReader reader, RuntimeC return facesOrdering; } - public final FacesOrdering read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesOrdering read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesOrdering facesOrdering, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesOrdering facesOrdering, RuntimeContext context) + throws Exception + { if (facesOrdering == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesOrdering.class != facesOrdering.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesOrdering.class!= facesOrdering.getClass()) { context.unexpectedSubclass(writer, facesOrdering, FacesOrdering.class); - return; + return ; } context.beforeMarshal(facesOrdering, LifecycleCallback.NONE); // ELEMENT: after - final FacesOrderingOrdering after = facesOrdering.after; - if (after != null) { + FacesOrderingOrdering after = facesOrdering.after; + if (after!= null) { writer.writeStartElement(prefix, "after", "http://java.sun.com/xml/ns/javaee"); writeFacesOrderingOrdering(writer, after, context); writer.writeEndElement(); } // ELEMENT: before - final FacesOrderingOrdering before = facesOrdering.before; - if (before != null) { + FacesOrderingOrdering before = facesOrdering.before; + if (before!= null) { writer.writeStartElement(prefix, "before", "http://java.sun.com/xml/ns/javaee"); writeFacesOrderingOrdering(writer, before, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrderingOrdering$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrderingOrdering$JAXB.java index 146fd3c72da..57d5b9367be 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrderingOrdering$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrderingOrdering$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesOrderingOthers$JAXB.readFacesOrderingOthers; import static org.apache.openejb.jee.FacesOrderingOthers$JAXB.writeFacesOrderingOthers; @@ -36,30 +37,35 @@ "StringEquality" }) public class FacesOrderingOrdering$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesOrderingOrdering$JAXB() { super(FacesOrderingOrdering.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-ordering-orderingType".intern()), FacesOrderingOthers$JAXB.class); } - public static FacesOrderingOrdering readFacesOrderingOrdering(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesOrderingOrdering readFacesOrderingOrdering(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesOrderingOrdering(final XoXMLStreamWriter writer, final FacesOrderingOrdering facesOrderingOrdering, final RuntimeContext context) - throws Exception { + public static void writeFacesOrderingOrdering(XoXMLStreamWriter writer, FacesOrderingOrdering facesOrderingOrdering, RuntimeContext context) + throws Exception + { _write(writer, facesOrderingOrdering, context); } - public void write(final XoXMLStreamWriter writer, final FacesOrderingOrdering facesOrderingOrdering, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesOrderingOrdering facesOrderingOrdering, RuntimeContext context) + throws Exception + { _write(writer, facesOrderingOrdering, context); } - public final static FacesOrderingOrdering _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesOrderingOrdering _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,61 +76,61 @@ public final static FacesOrderingOrdering _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final FacesOrderingOrdering facesOrderingOrdering = new FacesOrderingOrdering(); + FacesOrderingOrdering facesOrderingOrdering = new FacesOrderingOrdering(); context.beforeUnmarshal(facesOrderingOrdering, LifecycleCallback.NONE); List name = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-ordering-orderingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-ordering-orderingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesOrderingOrdering.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: name String nameItemRaw = null; if (!elementReader.isXsiNil()) { - nameItemRaw = elementReader.getElementAsString(); + nameItemRaw = elementReader.getElementText(); } - final String nameItem; + String nameItem; try { nameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(nameItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (name == null) { name = facesOrderingOrdering.name; - if (name != null) { + if (name!= null) { name.clear(); } else { - name = new ArrayList(); + name = new ArrayList<>(); } } name.add(nameItem); - } else if (("others" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("others" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: others - final FacesOrderingOthers others = readFacesOrderingOthers(elementReader, context); + FacesOrderingOthers others = readFacesOrderingOthers(elementReader, context); facesOrderingOrdering.others = others; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "others")); } } - if (name != null) { + if (name!= null) { facesOrderingOrdering.name = name; } @@ -133,43 +139,45 @@ public final static FacesOrderingOrdering _read(final XoXMLStreamReader reader, return facesOrderingOrdering; } - public final FacesOrderingOrdering read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesOrderingOrdering read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesOrderingOrdering facesOrderingOrdering, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesOrderingOrdering facesOrderingOrdering, RuntimeContext context) + throws Exception + { if (facesOrderingOrdering == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesOrderingOrdering.class != facesOrderingOrdering.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesOrderingOrdering.class!= facesOrderingOrdering.getClass()) { context.unexpectedSubclass(writer, facesOrderingOrdering, FacesOrderingOrdering.class); - return; + return ; } context.beforeMarshal(facesOrderingOrdering, LifecycleCallback.NONE); // ELEMENT: name - final List nameRaw = facesOrderingOrdering.name; - if (nameRaw != null) { - for (final String nameItem : nameRaw) { + List nameRaw = facesOrderingOrdering.name; + if (nameRaw!= null) { + for (String nameItem: nameRaw) { String name = null; try { name = Adapters.collapsedStringAdapterAdapter.marshal(nameItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesOrderingOrdering, "name", CollapsedStringAdapter.class, List.class, List.class, e); } writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); - if (name != null) { + if (name!= null) { writer.writeCharacters(name); } else { writer.writeXsiNil(); @@ -179,8 +187,8 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesOrder } // ELEMENT: others - final FacesOrderingOthers others = facesOrderingOrdering.others; - if (others != null) { + FacesOrderingOthers others = facesOrderingOrdering.others; + if (others!= null) { writer.writeStartElement(prefix, "others", "http://java.sun.com/xml/ns/javaee"); writeFacesOrderingOthers(writer, others, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrderingOthers$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrderingOthers$JAXB.java index 958e23fec62..fe58ea26ece 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrderingOthers$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrderingOthers$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class FacesOrderingOthers$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesOrderingOthers$JAXB() { super(FacesOrderingOthers.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-ordering-othersType".intern())); } - public static FacesOrderingOthers readFacesOrderingOthers(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesOrderingOthers readFacesOrderingOthers(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesOrderingOthers(final XoXMLStreamWriter writer, final FacesOrderingOthers facesOrderingOthers, final RuntimeContext context) - throws Exception { + public static void writeFacesOrderingOthers(XoXMLStreamWriter writer, FacesOrderingOthers facesOrderingOthers, RuntimeContext context) + throws Exception + { _write(writer, facesOrderingOthers, context); } - public void write(final XoXMLStreamWriter writer, final FacesOrderingOthers facesOrderingOthers, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesOrderingOthers facesOrderingOthers, RuntimeContext context) + throws Exception + { _write(writer, facesOrderingOthers, context); } - public final static FacesOrderingOthers _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesOrderingOthers _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,32 +70,32 @@ public final static FacesOrderingOthers _read(final XoXMLStreamReader reader, Ru context = new RuntimeContext(); } - final FacesOrderingOthers facesOrderingOthers = new FacesOrderingOthers(); + FacesOrderingOthers facesOrderingOthers = new FacesOrderingOthers(); context.beforeUnmarshal(facesOrderingOthers, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-ordering-othersType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-ordering-othersType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesOrderingOthers.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesOrderingOthers); facesOrderingOthers.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { context.unexpectedElement(elementReader); } @@ -99,37 +104,39 @@ public final static FacesOrderingOthers _read(final XoXMLStreamReader reader, Ru return facesOrderingOthers; } - public final FacesOrderingOthers read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesOrderingOthers read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesOrderingOthers facesOrderingOthers, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesOrderingOthers facesOrderingOthers, RuntimeContext context) + throws Exception + { if (facesOrderingOthers == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesOrderingOthers.class != facesOrderingOthers.getClass()) { + if (FacesOrderingOthers.class!= facesOrderingOthers.getClass()) { context.unexpectedSubclass(writer, facesOrderingOthers, FacesOrderingOthers.class); - return; + return ; } context.beforeMarshal(facesOrderingOthers, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesOrderingOthers.id; - if (idRaw != null) { + String idRaw = facesOrderingOthers.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesOrderingOthers, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesProperty$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesProperty$JAXB.java index dba277f8344..c8f9f265296 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesProperty$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesProperty$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesPropertyExtension$JAXB.readFacesPropertyExtension; import static org.apache.openejb.jee.FacesPropertyExtension$JAXB.writeFacesPropertyExtension; @@ -40,30 +41,35 @@ "StringEquality" }) public class FacesProperty$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesProperty$JAXB() { super(FacesProperty.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-propertyType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesPropertyExtension$JAXB.class); } - public static FacesProperty readFacesProperty(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesProperty readFacesProperty(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesProperty(final XoXMLStreamWriter writer, final FacesProperty facesProperty, final RuntimeContext context) - throws Exception { + public static void writeFacesProperty(XoXMLStreamWriter writer, FacesProperty facesProperty, RuntimeContext context) + throws Exception + { _write(writer, facesProperty, context); } - public void write(final XoXMLStreamWriter writer, final FacesProperty facesProperty, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesProperty facesProperty, RuntimeContext context) + throws Exception + { _write(writer, facesProperty, context); } - public final static FacesProperty _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesProperty _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,7 +80,7 @@ public final static FacesProperty _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final FacesProperty facesProperty = new FacesProperty(); + FacesProperty facesProperty = new FacesProperty(); context.beforeUnmarshal(facesProperty, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -83,114 +89,114 @@ public final static FacesProperty _read(final XoXMLStreamReader reader, RuntimeC List propertyExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-propertyType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesProperty.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesProperty); facesProperty.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesProperty.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("property-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("property-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: propertyName - final String propertyNameRaw = elementReader.getElementAsString(); + String propertyNameRaw = elementReader.getElementText(); - final String propertyName; + String propertyName; try { propertyName = Adapters.collapsedStringAdapterAdapter.unmarshal(propertyNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesProperty.propertyName = propertyName; - } else if (("property-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("property-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: propertyClass - final String propertyClassRaw = elementReader.getElementAsString(); + String propertyClassRaw = elementReader.getElementText(); - final String propertyClass; + String propertyClass; try { propertyClass = Adapters.collapsedStringAdapterAdapter.unmarshal(propertyClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesProperty.propertyClass = propertyClass; - } else if (("default-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("default-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: defaultValue - final String defaultValueRaw = elementReader.getElementAsString(); + String defaultValueRaw = elementReader.getElementText(); - final String defaultValue; + String defaultValue; try { defaultValue = Adapters.collapsedStringAdapterAdapter.unmarshal(defaultValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesProperty.defaultValue = defaultValue; - } else if (("suggested-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("suggested-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: suggestedValue - final String suggestedValueRaw = elementReader.getElementAsString(); + String suggestedValueRaw = elementReader.getElementText(); - final String suggestedValue; + String suggestedValue; try { suggestedValue = Adapters.collapsedStringAdapterAdapter.unmarshal(suggestedValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesProperty.suggestedValue = suggestedValue; - } else if (("property-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("property-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: propertyExtension - final FacesPropertyExtension propertyExtensionItem = readFacesPropertyExtension(elementReader, context); + FacesPropertyExtension propertyExtensionItem = readFacesPropertyExtension(elementReader, context); if (propertyExtension == null) { propertyExtension = facesProperty.propertyExtension; - if (propertyExtension != null) { + if (propertyExtension!= null) { propertyExtension.clear(); } else { - propertyExtension = new ArrayList(); + propertyExtension = new ArrayList<>(); } } propertyExtension.add(propertyExtensionItem); @@ -198,24 +204,24 @@ public final static FacesProperty _read(final XoXMLStreamReader reader, RuntimeC 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", "property-name"), new QName("http://java.sun.com/xml/ns/javaee", "property-class"), new QName("http://java.sun.com/xml/ns/javaee", "default-value"), new QName("http://java.sun.com/xml/ns/javaee", "suggested-value"), new QName("http://java.sun.com/xml/ns/javaee", "property-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesProperty.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesProperty.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesProperty.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesProperty.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesProperty.icon = icon; } - if (propertyExtension != null) { + if (propertyExtension!= null) { facesProperty.propertyExtension = propertyExtension; } @@ -224,38 +230,40 @@ public final static FacesProperty _read(final XoXMLStreamReader reader, RuntimeC return facesProperty; } - public final FacesProperty read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesProperty read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesProperty facesProperty, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesProperty facesProperty, RuntimeContext context) + throws Exception + { if (facesProperty == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesProperty.class != facesProperty.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesProperty.class!= facesProperty.getClass()) { context.unexpectedSubclass(writer, facesProperty, FacesProperty.class); - return; + return ; } context.beforeMarshal(facesProperty, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesProperty.id; - if (idRaw != null) { + String idRaw = facesProperty.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesProperty, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -265,12 +273,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesPrope Text[] descriptions = null; try { descriptions = facesProperty.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesProperty, "descriptions", FacesProperty.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -284,12 +292,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesPrope Text[] displayNames = null; try { displayNames = facesProperty.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesProperty, "displayNames", FacesProperty.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -300,10 +308,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesPrope } // ELEMENT: icon - final LocalCollection icon = facesProperty.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesProperty.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -314,14 +322,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesPrope } // ELEMENT: propertyName - final String propertyNameRaw = facesProperty.propertyName; + String propertyNameRaw = facesProperty.propertyName; String propertyName = null; try { propertyName = Adapters.collapsedStringAdapterAdapter.marshal(propertyNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesProperty, "propertyName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (propertyName != null) { + if (propertyName!= null) { writer.writeStartElement(prefix, "property-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(propertyName); writer.writeEndElement(); @@ -330,14 +338,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesPrope } // ELEMENT: propertyClass - final String propertyClassRaw = facesProperty.propertyClass; + String propertyClassRaw = facesProperty.propertyClass; String propertyClass = null; try { propertyClass = Adapters.collapsedStringAdapterAdapter.marshal(propertyClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesProperty, "propertyClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (propertyClass != null) { + if (propertyClass!= null) { writer.writeStartElement(prefix, "property-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(propertyClass); writer.writeEndElement(); @@ -346,38 +354,38 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesPrope } // ELEMENT: defaultValue - final String defaultValueRaw = facesProperty.defaultValue; + String defaultValueRaw = facesProperty.defaultValue; String defaultValue = null; try { defaultValue = Adapters.collapsedStringAdapterAdapter.marshal(defaultValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesProperty, "defaultValue", CollapsedStringAdapter.class, String.class, String.class, e); } - if (defaultValue != null) { + if (defaultValue!= null) { writer.writeStartElement(prefix, "default-value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(defaultValue); writer.writeEndElement(); } // ELEMENT: suggestedValue - final String suggestedValueRaw = facesProperty.suggestedValue; + String suggestedValueRaw = facesProperty.suggestedValue; String suggestedValue = null; try { suggestedValue = Adapters.collapsedStringAdapterAdapter.marshal(suggestedValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesProperty, "suggestedValue", CollapsedStringAdapter.class, String.class, String.class, e); } - if (suggestedValue != null) { + if (suggestedValue!= null) { writer.writeStartElement(prefix, "suggested-value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(suggestedValue); writer.writeEndElement(); } // ELEMENT: propertyExtension - final List propertyExtension = facesProperty.propertyExtension; - if (propertyExtension != null) { - for (final FacesPropertyExtension propertyExtensionItem : propertyExtension) { - if (propertyExtensionItem != null) { + List propertyExtension = facesProperty.propertyExtension; + if (propertyExtension!= null) { + for (FacesPropertyExtension propertyExtensionItem: propertyExtension) { + if (propertyExtensionItem!= null) { writer.writeStartElement(prefix, "property-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesPropertyExtension(writer, propertyExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesPropertyExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesPropertyExtension$JAXB.java index 26f32dafaa4..f0d1d93fa59 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesPropertyExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesPropertyExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesPropertyExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesPropertyExtension$JAXB() { super(FacesPropertyExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-property-extensionType".intern())); } - public static FacesPropertyExtension readFacesPropertyExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesPropertyExtension readFacesPropertyExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesPropertyExtension(final XoXMLStreamWriter writer, final FacesPropertyExtension facesPropertyExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesPropertyExtension(XoXMLStreamWriter writer, FacesPropertyExtension facesPropertyExtension, RuntimeContext context) + throws Exception + { _write(writer, facesPropertyExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesPropertyExtension facesPropertyExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesPropertyExtension facesPropertyExtension, RuntimeContext context) + throws Exception + { _write(writer, facesPropertyExtension, context); } - public final static FacesPropertyExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesPropertyExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesPropertyExtension _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final FacesPropertyExtension facesPropertyExtension = new FacesPropertyExtension(); + FacesPropertyExtension facesPropertyExtension = new FacesPropertyExtension(); context.beforeUnmarshal(facesPropertyExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-property-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-property-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesPropertyExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesPropertyExtension); facesPropertyExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesPropertyExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesPropertyExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesPropertyExtension _read(final XoXMLStreamReader reader, return facesPropertyExtension; } - public final FacesPropertyExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesPropertyExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesPropertyExtension facesPropertyExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesPropertyExtension facesPropertyExtension, RuntimeContext context) + throws Exception + { if (facesPropertyExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesPropertyExtension.class != facesPropertyExtension.getClass()) { + if (FacesPropertyExtension.class!= facesPropertyExtension.getClass()) { context.unexpectedSubclass(writer, facesPropertyExtension, FacesPropertyExtension.class); - return; + return ; } context.beforeMarshal(facesPropertyExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesPropertyExtension.id; - if (idRaw != null) { + String idRaw = facesPropertyExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesPropertyExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesPropertyExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesPropertyExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesPropertyExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRedirect$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRedirect$JAXB.java index 267b3323331..79a603c0683 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRedirect$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRedirect$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesRedirectViewParam$JAXB.readFacesRedirectViewParam; import static org.apache.openejb.jee.FacesRedirectViewParam$JAXB.writeFacesRedirectViewParam; @@ -36,30 +37,35 @@ "StringEquality" }) public class FacesRedirect$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesRedirect$JAXB() { super(FacesRedirect.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-redirectType".intern()), FacesRedirectViewParam$JAXB.class); } - public static FacesRedirect readFacesRedirect(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesRedirect readFacesRedirect(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesRedirect(final XoXMLStreamWriter writer, final FacesRedirect facesRedirect, final RuntimeContext context) - throws Exception { + public static void writeFacesRedirect(XoXMLStreamWriter writer, FacesRedirect facesRedirect, RuntimeContext context) + throws Exception + { _write(writer, facesRedirect, context); } - public void write(final XoXMLStreamWriter writer, final FacesRedirect facesRedirect, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesRedirect facesRedirect, RuntimeContext context) + throws Exception + { _write(writer, facesRedirect, context); } - public final static FacesRedirect _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesRedirect _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,46 +76,46 @@ public final static FacesRedirect _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final FacesRedirect facesRedirect = new FacesRedirect(); + FacesRedirect facesRedirect = new FacesRedirect(); context.beforeUnmarshal(facesRedirect, LifecycleCallback.NONE); List viewParam = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-redirectType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-redirectType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesRedirect.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesRedirect); facesRedirect.id = id; - } else if (("include-view-params" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("include-view-params" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: includeViewParams - final Boolean includeViewParams = ("1".equals(attribute.getValue()) || "true".equals(attribute.getValue())); + Boolean includeViewParams = ("1".equals(attribute.getValue())||"true".equals(attribute.getValue())); facesRedirect.includeViewParams = includeViewParams; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "include-view-params")); } } // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("view-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("view-param" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: viewParam - final FacesRedirectViewParam viewParamItem = readFacesRedirectViewParam(elementReader, context); + FacesRedirectViewParam viewParamItem = readFacesRedirectViewParam(elementReader, context); if (viewParam == null) { viewParam = facesRedirect.viewParam; - if (viewParam != null) { + if (viewParam!= null) { viewParam.clear(); } else { - viewParam = new ArrayList(); + viewParam = new ArrayList<>(); } } viewParam.add(viewParamItem); @@ -117,7 +123,7 @@ public final static FacesRedirect _read(final XoXMLStreamReader reader, RuntimeC context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "view-param")); } } - if (viewParam != null) { + if (viewParam!= null) { facesRedirect.viewParam = viewParam; } @@ -126,53 +132,55 @@ public final static FacesRedirect _read(final XoXMLStreamReader reader, RuntimeC return facesRedirect; } - public final FacesRedirect read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesRedirect read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesRedirect facesRedirect, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesRedirect facesRedirect, RuntimeContext context) + throws Exception + { if (facesRedirect == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesRedirect.class != facesRedirect.getClass()) { + if (FacesRedirect.class!= facesRedirect.getClass()) { context.unexpectedSubclass(writer, facesRedirect, FacesRedirect.class); - return; + return ; } context.beforeMarshal(facesRedirect, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesRedirect.id; - if (idRaw != null) { + String idRaw = facesRedirect.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRedirect, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: includeViewParams - final Boolean includeViewParams = facesRedirect.includeViewParams; - if (includeViewParams != null) { + Boolean includeViewParams = facesRedirect.includeViewParams; + if (includeViewParams!= null) { writer.writeAttribute("", "", "include-view-params", Boolean.toString(includeViewParams)); } // ELEMENT: viewParam - final List viewParam = facesRedirect.viewParam; - if (viewParam != null) { - for (final FacesRedirectViewParam viewParamItem : viewParam) { - if (viewParamItem != null) { + List viewParam = facesRedirect.viewParam; + if (viewParam!= null) { + for (FacesRedirectViewParam viewParamItem: viewParam) { + if (viewParamItem!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "view-param"); writeFacesRedirectViewParam(writer, viewParamItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRedirectViewParam$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRedirectViewParam$JAXB.java index 2fce08f0105..026d112bf86 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRedirectViewParam$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRedirectViewParam$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class FacesRedirectViewParam$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesRedirectViewParam$JAXB() { super(FacesRedirectViewParam.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-redirect-viewParamType".intern())); } - public static FacesRedirectViewParam readFacesRedirectViewParam(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesRedirectViewParam readFacesRedirectViewParam(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesRedirectViewParam(final XoXMLStreamWriter writer, final FacesRedirectViewParam facesRedirectViewParam, final RuntimeContext context) - throws Exception { + public static void writeFacesRedirectViewParam(XoXMLStreamWriter writer, FacesRedirectViewParam facesRedirectViewParam, RuntimeContext context) + throws Exception + { _write(writer, facesRedirectViewParam, context); } - public void write(final XoXMLStreamWriter writer, final FacesRedirectViewParam facesRedirectViewParam, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesRedirectViewParam facesRedirectViewParam, RuntimeContext context) + throws Exception + { _write(writer, facesRedirectViewParam, context); } - public final static FacesRedirectViewParam _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesRedirectViewParam _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,53 +70,53 @@ public final static FacesRedirectViewParam _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final FacesRedirectViewParam facesRedirectViewParam = new FacesRedirectViewParam(); + FacesRedirectViewParam facesRedirectViewParam = new FacesRedirectViewParam(); context.beforeUnmarshal(facesRedirectViewParam, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-redirect-viewParamType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-redirect-viewParamType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesRedirectViewParam.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesRedirectViewParam); facesRedirectViewParam.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + String nameRaw = elementReader.getElementText(); - final String name; + String name; try { name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesRedirectViewParam.name = name; - } else if (("value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: value - final String valueRaw = elementReader.getElementAsString(); + String valueRaw = elementReader.getElementText(); - final String value; + String value; try { value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -127,52 +132,54 @@ public final static FacesRedirectViewParam _read(final XoXMLStreamReader reader, return facesRedirectViewParam; } - public final FacesRedirectViewParam read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesRedirectViewParam read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesRedirectViewParam facesRedirectViewParam, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesRedirectViewParam facesRedirectViewParam, RuntimeContext context) + throws Exception + { if (facesRedirectViewParam == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesRedirectViewParam.class != facesRedirectViewParam.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesRedirectViewParam.class!= facesRedirectViewParam.getClass()) { context.unexpectedSubclass(writer, facesRedirectViewParam, FacesRedirectViewParam.class); - return; + return ; } context.beforeMarshal(facesRedirectViewParam, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesRedirectViewParam.id; - if (idRaw != null) { + String idRaw = facesRedirectViewParam.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRedirectViewParam, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: name - final String nameRaw = facesRedirectViewParam.name; + String nameRaw = facesRedirectViewParam.name; String name = null; try { name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRedirectViewParam, "name", CollapsedStringAdapter.class, String.class, String.class, e); } - if (name != null) { + if (name!= null) { writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(name); writer.writeEndElement(); @@ -181,14 +188,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRedir } // ELEMENT: value - final String valueRaw = facesRedirectViewParam.value; + String valueRaw = facesRedirectViewParam.value; String value = null; try { value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRedirectViewParam, "value", CollapsedStringAdapter.class, String.class, String.class, e); } - if (value != null) { + if (value!= null) { writer.writeStartElement(prefix, "value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(value); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesReferencedBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesReferencedBean$JAXB.java index 6f6ef852949..17e35fa3be3 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesReferencedBean$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesReferencedBean$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -37,30 +38,35 @@ "StringEquality" }) public class FacesReferencedBean$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesReferencedBean$JAXB() { super(FacesReferencedBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-referenced-beanType".intern()), Text$JAXB.class, Icon$JAXB.class); } - public static FacesReferencedBean readFacesReferencedBean(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesReferencedBean readFacesReferencedBean(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesReferencedBean(final XoXMLStreamWriter writer, final FacesReferencedBean facesReferencedBean, final RuntimeContext context) - throws Exception { + public static void writeFacesReferencedBean(XoXMLStreamWriter writer, FacesReferencedBean facesReferencedBean, RuntimeContext context) + throws Exception + { _write(writer, facesReferencedBean, context); } - public void write(final XoXMLStreamWriter writer, final FacesReferencedBean facesReferencedBean, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesReferencedBean facesReferencedBean, RuntimeContext context) + throws Exception + { _write(writer, facesReferencedBean, context); } - public final static FacesReferencedBean _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesReferencedBean _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -71,7 +77,7 @@ public final static FacesReferencedBean _read(final XoXMLStreamReader reader, Ru context = new RuntimeContext(); } - final FacesReferencedBean facesReferencedBean = new FacesReferencedBean(); + FacesReferencedBean facesReferencedBean = new FacesReferencedBean(); context.beforeUnmarshal(facesReferencedBean, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -79,100 +85,98 @@ public final static FacesReferencedBean _read(final XoXMLStreamReader reader, Ru LocalCollection icon = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-referenced-beanType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-referenced-beanType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesReferencedBean.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesReferencedBean); facesReferencedBean.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesReferencedBean.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("referenced-bean-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("referenced-bean-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: referencedBeanName - final String referencedBeanNameRaw = elementReader.getElementAsString(); + String referencedBeanNameRaw = elementReader.getElementText(); - final String referencedBeanName; + String referencedBeanName; try { referencedBeanName = Adapters.collapsedStringAdapterAdapter.unmarshal(referencedBeanNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesReferencedBean.referencedBeanName = referencedBeanName; - } else if (("referenced-bean-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("referenced-bean-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: referencedBeanClass - final String referencedBeanClassRaw = elementReader.getElementAsString(); + String referencedBeanClassRaw = elementReader.getElementText(); - final String referencedBeanClass; + String referencedBeanClass; try { referencedBeanClass = Adapters.collapsedStringAdapterAdapter.unmarshal(referencedBeanClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesReferencedBean.referencedBeanClass = referencedBeanClass; } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // 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", "referenced-bean-name"), new QName("http://java.sun.com/xml/ns/javaee", "referenced-bean-class")); + 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", "referenced-bean-name"), new QName("http://java.sun.com/xml/ns/javaee", "referenced-bean-class")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesReferencedBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesReferencedBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesReferencedBean.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesReferencedBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesReferencedBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesReferencedBean.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesReferencedBean.icon = icon; } @@ -181,38 +185,40 @@ public final static FacesReferencedBean _read(final XoXMLStreamReader reader, Ru return facesReferencedBean; } - public final FacesReferencedBean read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesReferencedBean read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesReferencedBean facesReferencedBean, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesReferencedBean facesReferencedBean, RuntimeContext context) + throws Exception + { if (facesReferencedBean == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesReferencedBean.class != facesReferencedBean.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesReferencedBean.class!= facesReferencedBean.getClass()) { context.unexpectedSubclass(writer, facesReferencedBean, FacesReferencedBean.class); - return; + return ; } context.beforeMarshal(facesReferencedBean, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesReferencedBean.id; - if (idRaw != null) { + String idRaw = facesReferencedBean.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesReferencedBean, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -222,12 +228,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRefer Text[] descriptions = null; try { descriptions = facesReferencedBean.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesReferencedBean, "descriptions", FacesReferencedBean.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -241,12 +247,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRefer Text[] displayNames = null; try { displayNames = facesReferencedBean.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesReferencedBean, "displayNames", FacesReferencedBean.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -257,10 +263,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRefer } // ELEMENT: icon - final LocalCollection icon = facesReferencedBean.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesReferencedBean.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -271,14 +277,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRefer } // ELEMENT: referencedBeanName - final String referencedBeanNameRaw = facesReferencedBean.referencedBeanName; + String referencedBeanNameRaw = facesReferencedBean.referencedBeanName; String referencedBeanName = null; try { referencedBeanName = Adapters.collapsedStringAdapterAdapter.marshal(referencedBeanNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesReferencedBean, "referencedBeanName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (referencedBeanName != null) { + if (referencedBeanName!= null) { writer.writeStartElement(prefix, "referenced-bean-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(referencedBeanName); writer.writeEndElement(); @@ -287,14 +293,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRefer } // ELEMENT: referencedBeanClass - final String referencedBeanClassRaw = facesReferencedBean.referencedBeanClass; + String referencedBeanClassRaw = facesReferencedBean.referencedBeanClass; String referencedBeanClass = null; try { referencedBeanClass = Adapters.collapsedStringAdapterAdapter.marshal(referencedBeanClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesReferencedBean, "referencedBeanClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (referencedBeanClass != null) { + if (referencedBeanClass!= null) { writer.writeStartElement(prefix, "referenced-bean-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(referencedBeanClass); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKit$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKit$JAXB.java index 1b91a0779a6..972292622fd 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKit$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKit$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesClientBehaviorRenderer$JAXB.readFacesClientBehaviorRenderer; import static org.apache.openejb.jee.FacesClientBehaviorRenderer$JAXB.writeFacesClientBehaviorRenderer; @@ -44,30 +45,35 @@ "StringEquality" }) public class FacesRenderKit$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesRenderKit$JAXB() { super(FacesRenderKit.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-render-kitType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesRenderer$JAXB.class, FacesClientBehaviorRenderer$JAXB.class, FacesRenderKitExtension$JAXB.class); } - public static FacesRenderKit readFacesRenderKit(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesRenderKit readFacesRenderKit(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesRenderKit(final XoXMLStreamWriter writer, final FacesRenderKit facesRenderKit, final RuntimeContext context) - throws Exception { + public static void writeFacesRenderKit(XoXMLStreamWriter writer, FacesRenderKit facesRenderKit, RuntimeContext context) + throws Exception + { _write(writer, facesRenderKit, context); } - public void write(final XoXMLStreamWriter writer, final FacesRenderKit facesRenderKit, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesRenderKit facesRenderKit, RuntimeContext context) + throws Exception + { _write(writer, facesRenderKit, context); } - public final static FacesRenderKit _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesRenderKit _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -78,7 +84,7 @@ public final static FacesRenderKit _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final FacesRenderKit facesRenderKit = new FacesRenderKit(); + FacesRenderKit facesRenderKit = new FacesRenderKit(); context.beforeUnmarshal(facesRenderKit, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -89,145 +95,143 @@ public final static FacesRenderKit _read(final XoXMLStreamReader reader, Runtime List renderKitExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-render-kitType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-render-kitType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesRenderKit.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesRenderKit); facesRenderKit.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesRenderKit.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("render-kit-id" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("render-kit-id" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: renderKitId - final String renderKitIdRaw = elementReader.getElementAsString(); + String renderKitIdRaw = elementReader.getElementText(); - final String renderKitId; + String renderKitId; try { renderKitId = Adapters.collapsedStringAdapterAdapter.unmarshal(renderKitIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesRenderKit.renderKitId = renderKitId; - } else if (("render-kit-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("render-kit-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: renderKitClass - final String renderKitClassRaw = elementReader.getElementAsString(); + String renderKitClassRaw = elementReader.getElementText(); - final String renderKitClass; + String renderKitClass; try { renderKitClass = Adapters.collapsedStringAdapterAdapter.unmarshal(renderKitClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesRenderKit.renderKitClass = renderKitClass; - } else if (("renderer" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("renderer" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: renderer - final FacesRenderer rendererItem = readFacesRenderer(elementReader, context); + FacesRenderer rendererItem = readFacesRenderer(elementReader, context); if (renderer == null) { renderer = facesRenderKit.renderer; - if (renderer != null) { + if (renderer!= null) { renderer.clear(); } else { - renderer = new ArrayList(); + renderer = new ArrayList<>(); } } renderer.add(rendererItem); - } else if (("client-behavior-renderer" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("client-behavior-renderer" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: clientBehaviorRenderer - final FacesClientBehaviorRenderer clientBehaviorRendererItem = readFacesClientBehaviorRenderer(elementReader, context); + FacesClientBehaviorRenderer clientBehaviorRendererItem = readFacesClientBehaviorRenderer(elementReader, context); if (clientBehaviorRenderer == null) { clientBehaviorRenderer = facesRenderKit.clientBehaviorRenderer; - if (clientBehaviorRenderer != null) { + if (clientBehaviorRenderer!= null) { clientBehaviorRenderer.clear(); } else { - clientBehaviorRenderer = new ArrayList(); + clientBehaviorRenderer = new ArrayList<>(); } } clientBehaviorRenderer.add(clientBehaviorRendererItem); - } else if (("render-kit-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("render-kit-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: renderKitExtension - final FacesRenderKitExtension renderKitExtensionItem = readFacesRenderKitExtension(elementReader, context); + FacesRenderKitExtension renderKitExtensionItem = readFacesRenderKitExtension(elementReader, context); if (renderKitExtension == null) { renderKitExtension = facesRenderKit.renderKitExtension; - if (renderKitExtension != null) { + if (renderKitExtension!= null) { renderKitExtension.clear(); } else { - renderKitExtension = new ArrayList(); + renderKitExtension = new ArrayList<>(); } } renderKitExtension.add(renderKitExtensionItem); } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // 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", "render-kit-id"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit-class"), new QName("http://java.sun.com/xml/ns/javaee", "renderer"), new QName("http://java.sun.com/xml/ns/javaee", "client-behavior-renderer"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit-extension")); + 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", "render-kit-id"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit-class"), new QName("http://java.sun.com/xml/ns/javaee", "renderer"), new QName("http://java.sun.com/xml/ns/javaee", "client-behavior-renderer"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesRenderKit.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesRenderKit.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesRenderKit.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesRenderKit.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesRenderKit.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesRenderKit.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesRenderKit.icon = icon; } - if (renderer != null) { + if (renderer!= null) { facesRenderKit.renderer = renderer; } - if (clientBehaviorRenderer != null) { + if (clientBehaviorRenderer!= null) { facesRenderKit.clientBehaviorRenderer = clientBehaviorRenderer; } - if (renderKitExtension != null) { + if (renderKitExtension!= null) { facesRenderKit.renderKitExtension = renderKitExtension; } @@ -236,38 +240,40 @@ public final static FacesRenderKit _read(final XoXMLStreamReader reader, Runtime return facesRenderKit; } - public final FacesRenderKit read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesRenderKit read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesRenderKit facesRenderKit, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesRenderKit facesRenderKit, RuntimeContext context) + throws Exception + { if (facesRenderKit == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesRenderKit.class != facesRenderKit.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesRenderKit.class!= facesRenderKit.getClass()) { context.unexpectedSubclass(writer, facesRenderKit, FacesRenderKit.class); - return; + return ; } context.beforeMarshal(facesRenderKit, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesRenderKit.id; - if (idRaw != null) { + String idRaw = facesRenderKit.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRenderKit, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -277,12 +283,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende Text[] descriptions = null; try { descriptions = facesRenderKit.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesRenderKit, "descriptions", FacesRenderKit.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -296,12 +302,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende Text[] displayNames = null; try { displayNames = facesRenderKit.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesRenderKit, "displayNames", FacesRenderKit.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -312,10 +318,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende } // ELEMENT: icon - final LocalCollection icon = facesRenderKit.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesRenderKit.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -326,39 +332,39 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende } // ELEMENT: renderKitId - final String renderKitIdRaw = facesRenderKit.renderKitId; + String renderKitIdRaw = facesRenderKit.renderKitId; String renderKitId = null; try { renderKitId = Adapters.collapsedStringAdapterAdapter.marshal(renderKitIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRenderKit, "renderKitId", CollapsedStringAdapter.class, String.class, String.class, e); } - if (renderKitId != null) { + if (renderKitId!= null) { writer.writeStartElement(prefix, "render-kit-id", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(renderKitId); writer.writeEndElement(); } // ELEMENT: renderKitClass - final String renderKitClassRaw = facesRenderKit.renderKitClass; + String renderKitClassRaw = facesRenderKit.renderKitClass; String renderKitClass = null; try { renderKitClass = Adapters.collapsedStringAdapterAdapter.marshal(renderKitClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRenderKit, "renderKitClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (renderKitClass != null) { + if (renderKitClass!= null) { writer.writeStartElement(prefix, "render-kit-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(renderKitClass); writer.writeEndElement(); } // ELEMENT: renderer - final List renderer = facesRenderKit.renderer; - if (renderer != null) { - for (final FacesRenderer rendererItem : renderer) { + List renderer = facesRenderKit.renderer; + if (renderer!= null) { + for (FacesRenderer rendererItem: renderer) { writer.writeStartElement(prefix, "renderer", "http://java.sun.com/xml/ns/javaee"); - if (rendererItem != null) { + if (rendererItem!= null) { writeFacesRenderer(writer, rendererItem, context); } else { writer.writeXsiNil(); @@ -368,10 +374,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende } // ELEMENT: clientBehaviorRenderer - final List clientBehaviorRenderer = facesRenderKit.clientBehaviorRenderer; - if (clientBehaviorRenderer != null) { - for (final FacesClientBehaviorRenderer clientBehaviorRendererItem : clientBehaviorRenderer) { - if (clientBehaviorRendererItem != null) { + List clientBehaviorRenderer = facesRenderKit.clientBehaviorRenderer; + if (clientBehaviorRenderer!= null) { + for (FacesClientBehaviorRenderer clientBehaviorRendererItem: clientBehaviorRenderer) { + if (clientBehaviorRendererItem!= null) { writer.writeStartElement(prefix, "client-behavior-renderer", "http://java.sun.com/xml/ns/javaee"); writeFacesClientBehaviorRenderer(writer, clientBehaviorRendererItem, context); writer.writeEndElement(); @@ -380,10 +386,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende } // ELEMENT: renderKitExtension - final List renderKitExtension = facesRenderKit.renderKitExtension; - if (renderKitExtension != null) { - for (final FacesRenderKitExtension renderKitExtensionItem : renderKitExtension) { - if (renderKitExtensionItem != null) { + List renderKitExtension = facesRenderKit.renderKitExtension; + if (renderKitExtension!= null) { + for (FacesRenderKitExtension renderKitExtensionItem: renderKitExtension) { + if (renderKitExtensionItem!= null) { writer.writeStartElement(prefix, "render-kit-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesRenderKitExtension(writer, renderKitExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKitExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKitExtension$JAXB.java index ce315fa42f5..42c803492bb 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKitExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKitExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesRenderKitExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesRenderKitExtension$JAXB() { super(FacesRenderKitExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-render-kit-extensionType".intern())); } - public static FacesRenderKitExtension readFacesRenderKitExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesRenderKitExtension readFacesRenderKitExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesRenderKitExtension(final XoXMLStreamWriter writer, final FacesRenderKitExtension facesRenderKitExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesRenderKitExtension(XoXMLStreamWriter writer, FacesRenderKitExtension facesRenderKitExtension, RuntimeContext context) + throws Exception + { _write(writer, facesRenderKitExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesRenderKitExtension facesRenderKitExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesRenderKitExtension facesRenderKitExtension, RuntimeContext context) + throws Exception + { _write(writer, facesRenderKitExtension, context); } - public final static FacesRenderKitExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesRenderKitExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesRenderKitExtension _read(final XoXMLStreamReader reader context = new RuntimeContext(); } - final FacesRenderKitExtension facesRenderKitExtension = new FacesRenderKitExtension(); + FacesRenderKitExtension facesRenderKitExtension = new FacesRenderKitExtension(); context.beforeUnmarshal(facesRenderKitExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-render-kit-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-render-kit-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesRenderKitExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesRenderKitExtension); facesRenderKitExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesRenderKitExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesRenderKitExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesRenderKitExtension _read(final XoXMLStreamReader reader return facesRenderKitExtension; } - public final FacesRenderKitExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesRenderKitExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesRenderKitExtension facesRenderKitExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesRenderKitExtension facesRenderKitExtension, RuntimeContext context) + throws Exception + { if (facesRenderKitExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesRenderKitExtension.class != facesRenderKitExtension.getClass()) { + if (FacesRenderKitExtension.class!= facesRenderKitExtension.getClass()) { context.unexpectedSubclass(writer, facesRenderKitExtension, FacesRenderKitExtension.class); - return; + return ; } context.beforeMarshal(facesRenderKitExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesRenderKitExtension.id; - if (idRaw != null) { + String idRaw = facesRenderKitExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRenderKitExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesRenderKitExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesRenderKitExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesRenderKitExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderer$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderer$JAXB.java index 32024a01537..4588b21db25 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderer$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderer$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesAttribute$JAXB.readFacesAttribute; import static org.apache.openejb.jee.FacesAttribute$JAXB.writeFacesAttribute; @@ -44,30 +45,35 @@ "StringEquality" }) public class FacesRenderer$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesRenderer$JAXB() { super(FacesRenderer.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-rendererType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesFacet$JAXB.class, FacesAttribute$JAXB.class, FacesRendererExtension$JAXB.class); } - public static FacesRenderer readFacesRenderer(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesRenderer readFacesRenderer(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesRenderer(final XoXMLStreamWriter writer, final FacesRenderer facesRenderer, final RuntimeContext context) - throws Exception { + public static void writeFacesRenderer(XoXMLStreamWriter writer, FacesRenderer facesRenderer, RuntimeContext context) + throws Exception + { _write(writer, facesRenderer, context); } - public void write(final XoXMLStreamWriter writer, final FacesRenderer facesRenderer, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesRenderer facesRenderer, RuntimeContext context) + throws Exception + { _write(writer, facesRenderer, context); } - public final static FacesRenderer _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesRenderer _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -78,7 +84,7 @@ public final static FacesRenderer _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final FacesRenderer facesRenderer = new FacesRenderer(); + FacesRenderer facesRenderer = new FacesRenderer(); context.beforeUnmarshal(facesRenderer, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -89,125 +95,125 @@ public final static FacesRenderer _read(final XoXMLStreamReader reader, RuntimeC List rendererExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-rendererType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-rendererType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesRenderer.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesRenderer); facesRenderer.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesRenderer.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("component-family" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("component-family" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: componentFamily - final String componentFamilyRaw = elementReader.getElementAsString(); + String componentFamilyRaw = elementReader.getElementText(); - final String componentFamily; + String componentFamily; try { componentFamily = Adapters.collapsedStringAdapterAdapter.unmarshal(componentFamilyRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesRenderer.componentFamily = componentFamily; - } else if (("renderer-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("renderer-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: rendererType - final String rendererTypeRaw = elementReader.getElementAsString(); + String rendererTypeRaw = elementReader.getElementText(); - final String rendererType; + String rendererType; try { rendererType = Adapters.collapsedStringAdapterAdapter.unmarshal(rendererTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesRenderer.rendererType = rendererType; - } else if (("renderer-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("renderer-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: rendererClass - final String rendererClassRaw = elementReader.getElementAsString(); + String rendererClassRaw = elementReader.getElementText(); - final String rendererClass; + String rendererClass; try { rendererClass = Adapters.collapsedStringAdapterAdapter.unmarshal(rendererClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesRenderer.rendererClass = rendererClass; - } else if (("facet" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("facet" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: facet - final FacesFacet facetItem = readFacesFacet(elementReader, context); + FacesFacet facetItem = readFacesFacet(elementReader, context); if (facet == null) { facet = facesRenderer.facet; - if (facet != null) { + if (facet!= null) { facet.clear(); } else { - facet = new ArrayList(); + facet = new ArrayList<>(); } } facet.add(facetItem); - } else if (("attribute" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("attribute" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: attribute - final FacesAttribute attributeItem = readFacesAttribute(elementReader, context); + FacesAttribute attributeItem = readFacesAttribute(elementReader, context); if (attribute1 == null) { attribute1 = facesRenderer.attribute; if (attribute1 != null) { - attribute1.clear(); + attribute1 .clear(); } else { - attribute1 = new ArrayList(); + attribute1 = new ArrayList<>(); } } - attribute1.add(attributeItem); - } else if (("renderer-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + attribute1 .add(attributeItem); + } else if (("renderer-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: rendererExtension - final FacesRendererExtension rendererExtensionItem = readFacesRendererExtension(elementReader, context); + FacesRendererExtension rendererExtensionItem = readFacesRendererExtension(elementReader, context); if (rendererExtension == null) { rendererExtension = facesRenderer.rendererExtension; - if (rendererExtension != null) { + if (rendererExtension!= null) { rendererExtension.clear(); } else { - rendererExtension = new ArrayList(); + rendererExtension = new ArrayList<>(); } } rendererExtension.add(rendererExtensionItem); @@ -215,30 +221,30 @@ public final static FacesRenderer _read(final XoXMLStreamReader reader, RuntimeC 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", "component-family"), new QName("http://java.sun.com/xml/ns/javaee", "renderer-type"), new QName("http://java.sun.com/xml/ns/javaee", "renderer-class"), new QName("http://java.sun.com/xml/ns/javaee", "facet"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "renderer-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesRenderer.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesRenderer.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesRenderer.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesRenderer.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesRenderer.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesRenderer.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesRenderer.icon = icon; } - if (facet != null) { + if (facet!= null) { facesRenderer.facet = facet; } if (attribute1 != null) { facesRenderer.attribute = attribute1; } - if (rendererExtension != null) { + if (rendererExtension!= null) { facesRenderer.rendererExtension = rendererExtension; } @@ -247,38 +253,40 @@ public final static FacesRenderer _read(final XoXMLStreamReader reader, RuntimeC return facesRenderer; } - public final FacesRenderer read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesRenderer read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesRenderer facesRenderer, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesRenderer facesRenderer, RuntimeContext context) + throws Exception + { if (facesRenderer == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesRenderer.class != facesRenderer.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesRenderer.class!= facesRenderer.getClass()) { context.unexpectedSubclass(writer, facesRenderer, FacesRenderer.class); - return; + return ; } context.beforeMarshal(facesRenderer, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesRenderer.id; - if (idRaw != null) { + String idRaw = facesRenderer.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRenderer, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -288,12 +296,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende Text[] descriptions = null; try { descriptions = facesRenderer.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesRenderer, "descriptions", FacesRenderer.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -307,12 +315,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende Text[] displayNames = null; try { displayNames = facesRenderer.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesRenderer, "displayNames", FacesRenderer.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -323,10 +331,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende } // ELEMENT: icon - final LocalCollection icon = facesRenderer.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesRenderer.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -337,14 +345,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende } // ELEMENT: componentFamily - final String componentFamilyRaw = facesRenderer.componentFamily; + String componentFamilyRaw = facesRenderer.componentFamily; String componentFamily = null; try { componentFamily = Adapters.collapsedStringAdapterAdapter.marshal(componentFamilyRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRenderer, "componentFamily", CollapsedStringAdapter.class, String.class, String.class, e); } - if (componentFamily != null) { + if (componentFamily!= null) { writer.writeStartElement(prefix, "component-family", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(componentFamily); writer.writeEndElement(); @@ -353,14 +361,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende } // ELEMENT: rendererType - final String rendererTypeRaw = facesRenderer.rendererType; + String rendererTypeRaw = facesRenderer.rendererType; String rendererType = null; try { rendererType = Adapters.collapsedStringAdapterAdapter.marshal(rendererTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRenderer, "rendererType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (rendererType != null) { + if (rendererType!= null) { writer.writeStartElement(prefix, "renderer-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(rendererType); writer.writeEndElement(); @@ -369,14 +377,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende } // ELEMENT: rendererClass - final String rendererClassRaw = facesRenderer.rendererClass; + String rendererClassRaw = facesRenderer.rendererClass; String rendererClass = null; try { rendererClass = Adapters.collapsedStringAdapterAdapter.marshal(rendererClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRenderer, "rendererClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (rendererClass != null) { + if (rendererClass!= null) { writer.writeStartElement(prefix, "renderer-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(rendererClass); writer.writeEndElement(); @@ -385,11 +393,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende } // ELEMENT: facet - final List facet = facesRenderer.facet; - if (facet != null) { - for (final FacesFacet facetItem : facet) { + List facet = facesRenderer.facet; + if (facet!= null) { + for (FacesFacet facetItem: facet) { writer.writeStartElement(prefix, "facet", "http://java.sun.com/xml/ns/javaee"); - if (facetItem != null) { + if (facetItem!= null) { writeFacesFacet(writer, facetItem, context); } else { writer.writeXsiNil(); @@ -399,11 +407,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende } // ELEMENT: attribute - final List attribute = facesRenderer.attribute; - if (attribute != null) { - for (final FacesAttribute attributeItem : attribute) { + List attribute = facesRenderer.attribute; + if (attribute!= null) { + for (FacesAttribute attributeItem: attribute) { writer.writeStartElement(prefix, "attribute", "http://java.sun.com/xml/ns/javaee"); - if (attributeItem != null) { + if (attributeItem!= null) { writeFacesAttribute(writer, attributeItem, context); } else { writer.writeXsiNil(); @@ -413,10 +421,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesRende } // ELEMENT: rendererExtension - final List rendererExtension = facesRenderer.rendererExtension; - if (rendererExtension != null) { - for (final FacesRendererExtension rendererExtensionItem : rendererExtension) { - if (rendererExtensionItem != null) { + List rendererExtension = facesRenderer.rendererExtension; + if (rendererExtension!= null) { + for (FacesRendererExtension rendererExtensionItem: rendererExtension) { + if (rendererExtensionItem!= null) { writer.writeStartElement(prefix, "renderer-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesRendererExtension(writer, rendererExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRendererExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRendererExtension$JAXB.java index 241f27292ce..42090e66c04 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRendererExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRendererExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesRendererExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesRendererExtension$JAXB() { super(FacesRendererExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-renderer-extensionType".intern())); } - public static FacesRendererExtension readFacesRendererExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesRendererExtension readFacesRendererExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesRendererExtension(final XoXMLStreamWriter writer, final FacesRendererExtension facesRendererExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesRendererExtension(XoXMLStreamWriter writer, FacesRendererExtension facesRendererExtension, RuntimeContext context) + throws Exception + { _write(writer, facesRendererExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesRendererExtension facesRendererExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesRendererExtension facesRendererExtension, RuntimeContext context) + throws Exception + { _write(writer, facesRendererExtension, context); } - public final static FacesRendererExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesRendererExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesRendererExtension _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final FacesRendererExtension facesRendererExtension = new FacesRendererExtension(); + FacesRendererExtension facesRendererExtension = new FacesRendererExtension(); context.beforeUnmarshal(facesRendererExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-renderer-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-renderer-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesRendererExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesRendererExtension); facesRendererExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesRendererExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesRendererExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesRendererExtension _read(final XoXMLStreamReader reader, return facesRendererExtension; } - public final FacesRendererExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesRendererExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesRendererExtension facesRendererExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesRendererExtension facesRendererExtension, RuntimeContext context) + throws Exception + { if (facesRendererExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesRendererExtension.class != facesRendererExtension.getClass()) { + if (FacesRendererExtension.class!= facesRendererExtension.getClass()) { context.unexpectedSubclass(writer, facesRendererExtension, FacesRendererExtension.class); - return; + return ; } context.beforeMarshal(facesRendererExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesRendererExtension.id; - if (idRaw != null) { + String idRaw = facesRendererExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesRendererExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesRendererExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesRendererExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesRendererExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesSupportedLocale$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesSupportedLocale$JAXB.java index 21e0e74495f..18e0dd9995c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesSupportedLocale$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesSupportedLocale$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class FacesSupportedLocale$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesSupportedLocale$JAXB() { super(FacesSupportedLocale.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-supported-localeType".intern())); } - public static FacesSupportedLocale readFacesSupportedLocale(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesSupportedLocale readFacesSupportedLocale(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesSupportedLocale(final XoXMLStreamWriter writer, final FacesSupportedLocale facesSupportedLocale, final RuntimeContext context) - throws Exception { + public static void writeFacesSupportedLocale(XoXMLStreamWriter writer, FacesSupportedLocale facesSupportedLocale, RuntimeContext context) + throws Exception + { _write(writer, facesSupportedLocale, context); } - public void write(final XoXMLStreamWriter writer, final FacesSupportedLocale facesSupportedLocale, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesSupportedLocale facesSupportedLocale, RuntimeContext context) + throws Exception + { _write(writer, facesSupportedLocale, context); } - public final static FacesSupportedLocale _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesSupportedLocale _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,26 +70,26 @@ public final static FacesSupportedLocale _read(final XoXMLStreamReader reader, R context = new RuntimeContext(); } - final FacesSupportedLocale facesSupportedLocale = new FacesSupportedLocale(); + FacesSupportedLocale facesSupportedLocale = new FacesSupportedLocale(); context.beforeUnmarshal(facesSupportedLocale, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-supported-localeType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-supported-localeType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesSupportedLocale.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesSupportedLocale); facesSupportedLocale.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id")); } } @@ -97,44 +102,46 @@ public final static FacesSupportedLocale _read(final XoXMLStreamReader reader, R return facesSupportedLocale; } - public final FacesSupportedLocale read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesSupportedLocale read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesSupportedLocale facesSupportedLocale, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesSupportedLocale facesSupportedLocale, RuntimeContext context) + throws Exception + { if (facesSupportedLocale == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesSupportedLocale.class != facesSupportedLocale.getClass()) { + if (FacesSupportedLocale.class!= facesSupportedLocale.getClass()) { context.unexpectedSubclass(writer, facesSupportedLocale, FacesSupportedLocale.class); - return; + return ; } context.beforeMarshal(facesSupportedLocale, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesSupportedLocale.id; - if (idRaw != null) { + String idRaw = facesSupportedLocale.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesSupportedLocale, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // VALUE: value - final FacesLocale value = facesSupportedLocale.value; + FacesLocale value = facesSupportedLocale.value; context.afterMarshal(facesSupportedLocale, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesSystemEventListener$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesSystemEventListener$JAXB.java index 1d97a4ca7cb..03c5ed54531 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesSystemEventListener$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesSystemEventListener$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class FacesSystemEventListener$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesSystemEventListener$JAXB() { super(FacesSystemEventListener.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-system-event-listenerType".intern())); } - public static FacesSystemEventListener readFacesSystemEventListener(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesSystemEventListener readFacesSystemEventListener(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesSystemEventListener(final XoXMLStreamWriter writer, final FacesSystemEventListener facesSystemEventListener, final RuntimeContext context) - throws Exception { + public static void writeFacesSystemEventListener(XoXMLStreamWriter writer, FacesSystemEventListener facesSystemEventListener, RuntimeContext context) + throws Exception + { _write(writer, facesSystemEventListener, context); } - public void write(final XoXMLStreamWriter writer, final FacesSystemEventListener facesSystemEventListener, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesSystemEventListener facesSystemEventListener, RuntimeContext context) + throws Exception + { _write(writer, facesSystemEventListener, context); } - public final static FacesSystemEventListener _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesSystemEventListener _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,66 +70,66 @@ public final static FacesSystemEventListener _read(final XoXMLStreamReader reade context = new RuntimeContext(); } - final FacesSystemEventListener facesSystemEventListener = new FacesSystemEventListener(); + FacesSystemEventListener facesSystemEventListener = new FacesSystemEventListener(); context.beforeUnmarshal(facesSystemEventListener, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-system-event-listenerType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-system-event-listenerType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesSystemEventListener.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesSystemEventListener); facesSystemEventListener.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("system-event-listener-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("system-event-listener-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: systemEventListenerClass - final String systemEventListenerClassRaw = elementReader.getElementAsString(); + String systemEventListenerClassRaw = elementReader.getElementText(); - final String systemEventListenerClass; + String systemEventListenerClass; try { systemEventListenerClass = Adapters.collapsedStringAdapterAdapter.unmarshal(systemEventListenerClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesSystemEventListener.systemEventListenerClass = systemEventListenerClass; - } else if (("system-event-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("system-event-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: systemEventClass - final String systemEventClassRaw = elementReader.getElementAsString(); + String systemEventClassRaw = elementReader.getElementText(); - final String systemEventClass; + String systemEventClass; try { systemEventClass = Adapters.collapsedStringAdapterAdapter.unmarshal(systemEventClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesSystemEventListener.systemEventClass = systemEventClass; - } else if (("source-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("source-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: sourceClass - final String sourceClassRaw = elementReader.getElementAsString(); + String sourceClassRaw = elementReader.getElementText(); - final String sourceClass; + String sourceClass; try { sourceClass = Adapters.collapsedStringAdapterAdapter.unmarshal(sourceClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -140,52 +145,54 @@ public final static FacesSystemEventListener _read(final XoXMLStreamReader reade return facesSystemEventListener; } - public final FacesSystemEventListener read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesSystemEventListener read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesSystemEventListener facesSystemEventListener, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesSystemEventListener facesSystemEventListener, RuntimeContext context) + throws Exception + { if (facesSystemEventListener == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesSystemEventListener.class != facesSystemEventListener.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesSystemEventListener.class!= facesSystemEventListener.getClass()) { context.unexpectedSubclass(writer, facesSystemEventListener, FacesSystemEventListener.class); - return; + return ; } context.beforeMarshal(facesSystemEventListener, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesSystemEventListener.id; - if (idRaw != null) { + String idRaw = facesSystemEventListener.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesSystemEventListener, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: systemEventListenerClass - final String systemEventListenerClassRaw = facesSystemEventListener.systemEventListenerClass; + String systemEventListenerClassRaw = facesSystemEventListener.systemEventListenerClass; String systemEventListenerClass = null; try { systemEventListenerClass = Adapters.collapsedStringAdapterAdapter.marshal(systemEventListenerClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesSystemEventListener, "systemEventListenerClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (systemEventListenerClass != null) { + if (systemEventListenerClass!= null) { writer.writeStartElement(prefix, "system-event-listener-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(systemEventListenerClass); writer.writeEndElement(); @@ -194,14 +201,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesSyste } // ELEMENT: systemEventClass - final String systemEventClassRaw = facesSystemEventListener.systemEventClass; + String systemEventClassRaw = facesSystemEventListener.systemEventClass; String systemEventClass = null; try { systemEventClass = Adapters.collapsedStringAdapterAdapter.marshal(systemEventClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesSystemEventListener, "systemEventClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (systemEventClass != null) { + if (systemEventClass!= null) { writer.writeStartElement(prefix, "system-event-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(systemEventClass); writer.writeEndElement(); @@ -210,14 +217,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesSyste } // ELEMENT: sourceClass - final String sourceClassRaw = facesSystemEventListener.sourceClass; + String sourceClassRaw = facesSystemEventListener.sourceClass; String sourceClass = null; try { sourceClass = Adapters.collapsedStringAdapterAdapter.marshal(sourceClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesSystemEventListener, "sourceClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (sourceClass != null) { + if (sourceClass!= null) { writer.writeStartElement(prefix, "source-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(sourceClass); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidator$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidator$JAXB.java index 16ceb7c9ff1..e703c9d0b82 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidator$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidator$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.FacesAttribute$JAXB.readFacesAttribute; import static org.apache.openejb.jee.FacesAttribute$JAXB.writeFacesAttribute; @@ -44,30 +45,35 @@ "StringEquality" }) public class FacesValidator$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesValidator$JAXB() { super(FacesValidator.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-validatorType".intern()), Text$JAXB.class, Icon$JAXB.class, FacesAttribute$JAXB.class, FacesProperty$JAXB.class, FacesValidatorExtension$JAXB.class); } - public static FacesValidator readFacesValidator(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesValidator readFacesValidator(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesValidator(final XoXMLStreamWriter writer, final FacesValidator facesValidator, final RuntimeContext context) - throws Exception { + public static void writeFacesValidator(XoXMLStreamWriter writer, FacesValidator facesValidator, RuntimeContext context) + throws Exception + { _write(writer, facesValidator, context); } - public void write(final XoXMLStreamWriter writer, final FacesValidator facesValidator, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesValidator facesValidator, RuntimeContext context) + throws Exception + { _write(writer, facesValidator, context); } - public final static FacesValidator _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesValidator _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -78,7 +84,7 @@ public final static FacesValidator _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final FacesValidator facesValidator = new FacesValidator(); + FacesValidator facesValidator = new FacesValidator(); context.beforeUnmarshal(facesValidator, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -89,145 +95,143 @@ public final static FacesValidator _read(final XoXMLStreamReader reader, Runtime List validatorExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-validatorType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-validatorType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesValidator.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesValidator); facesValidator.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = facesValidator.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("validator-id" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("validator-id" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: validatorId - final String validatorIdRaw = elementReader.getElementAsString(); + String validatorIdRaw = elementReader.getElementText(); - final String validatorId; + String validatorId; try { validatorId = Adapters.collapsedStringAdapterAdapter.unmarshal(validatorIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesValidator.validatorId = validatorId; - } else if (("validator-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("validator-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: validatorClass - final String validatorClassRaw = elementReader.getElementAsString(); + String validatorClassRaw = elementReader.getElementText(); - final String validatorClass; + String validatorClass; try { validatorClass = Adapters.collapsedStringAdapterAdapter.unmarshal(validatorClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } facesValidator.validatorClass = validatorClass; - } else if (("attribute" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("attribute" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: attribute - final FacesAttribute attributeItem = readFacesAttribute(elementReader, context); + FacesAttribute attributeItem = readFacesAttribute(elementReader, context); if (attribute1 == null) { attribute1 = facesValidator.attribute; if (attribute1 != null) { - attribute1.clear(); + attribute1 .clear(); } else { - attribute1 = new ArrayList(); + attribute1 = new ArrayList<>(); } } - attribute1.add(attributeItem); - } else if (("property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + attribute1 .add(attributeItem); + } else if (("property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: property - final FacesProperty propertyItem = readFacesProperty(elementReader, context); + FacesProperty propertyItem = readFacesProperty(elementReader, context); if (property == null) { property = facesValidator.property; - if (property != null) { + if (property!= null) { property.clear(); } else { - property = new ArrayList(); + property = new ArrayList<>(); } } property.add(propertyItem); - } else if (("validator-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("validator-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: validatorExtension - final FacesValidatorExtension validatorExtensionItem = readFacesValidatorExtension(elementReader, context); + FacesValidatorExtension validatorExtensionItem = readFacesValidatorExtension(elementReader, context); if (validatorExtension == null) { validatorExtension = facesValidator.validatorExtension; - if (validatorExtension != null) { + if (validatorExtension!= null) { validatorExtension.clear(); } else { - validatorExtension = new ArrayList(); + validatorExtension = new ArrayList<>(); } } validatorExtension.add(validatorExtensionItem); } else { - // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it - // TODO: handle it properly - // 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", "validator-id"), new QName("http://java.sun.com/xml/ns/javaee", "validator-class"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "validator-extension")); + 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", "validator-id"), new QName("http://java.sun.com/xml/ns/javaee", "validator-class"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "validator-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - facesValidator.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + facesValidator.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, FacesValidator.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - facesValidator.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + facesValidator.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, FacesValidator.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { facesValidator.icon = icon; } if (attribute1 != null) { facesValidator.attribute = attribute1; } - if (property != null) { + if (property!= null) { facesValidator.property = property; } - if (validatorExtension != null) { + if (validatorExtension!= null) { facesValidator.validatorExtension = validatorExtension; } @@ -236,38 +240,40 @@ public final static FacesValidator _read(final XoXMLStreamReader reader, Runtime return facesValidator; } - public final FacesValidator read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesValidator read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesValidator facesValidator, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesValidator facesValidator, RuntimeContext context) + throws Exception + { if (facesValidator == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FacesValidator.class != facesValidator.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FacesValidator.class!= facesValidator.getClass()) { context.unexpectedSubclass(writer, facesValidator, FacesValidator.class); - return; + return ; } context.beforeMarshal(facesValidator, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesValidator.id; - if (idRaw != null) { + String idRaw = facesValidator.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesValidator, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -277,12 +283,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesValid Text[] descriptions = null; try { descriptions = facesValidator.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesValidator, "descriptions", FacesValidator.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -296,12 +302,12 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesValid Text[] displayNames = null; try { displayNames = facesValidator.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(facesValidator, "displayNames", FacesValidator.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -312,10 +318,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesValid } // ELEMENT: icon - final LocalCollection icon = facesValidator.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = facesValidator.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -326,14 +332,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesValid } // ELEMENT: validatorId - final String validatorIdRaw = facesValidator.validatorId; + String validatorIdRaw = facesValidator.validatorId; String validatorId = null; try { validatorId = Adapters.collapsedStringAdapterAdapter.marshal(validatorIdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesValidator, "validatorId", CollapsedStringAdapter.class, String.class, String.class, e); } - if (validatorId != null) { + if (validatorId!= null) { writer.writeStartElement(prefix, "validator-id", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(validatorId); writer.writeEndElement(); @@ -342,14 +348,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesValid } // ELEMENT: validatorClass - final String validatorClassRaw = facesValidator.validatorClass; + String validatorClassRaw = facesValidator.validatorClass; String validatorClass = null; try { validatorClass = Adapters.collapsedStringAdapterAdapter.marshal(validatorClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesValidator, "validatorClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (validatorClass != null) { + if (validatorClass!= null) { writer.writeStartElement(prefix, "validator-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(validatorClass); writer.writeEndElement(); @@ -358,11 +364,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesValid } // ELEMENT: attribute - final List attribute = facesValidator.attribute; - if (attribute != null) { - for (final FacesAttribute attributeItem : attribute) { + List attribute = facesValidator.attribute; + if (attribute!= null) { + for (FacesAttribute attributeItem: attribute) { writer.writeStartElement(prefix, "attribute", "http://java.sun.com/xml/ns/javaee"); - if (attributeItem != null) { + if (attributeItem!= null) { writeFacesAttribute(writer, attributeItem, context); } else { writer.writeXsiNil(); @@ -372,11 +378,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesValid } // ELEMENT: property - final List property = facesValidator.property; - if (property != null) { - for (final FacesProperty propertyItem : property) { + List property = facesValidator.property; + if (property!= null) { + for (FacesProperty propertyItem: property) { writer.writeStartElement(prefix, "property", "http://java.sun.com/xml/ns/javaee"); - if (propertyItem != null) { + if (propertyItem!= null) { writeFacesProperty(writer, propertyItem, context); } else { writer.writeXsiNil(); @@ -386,10 +392,10 @@ public final static void _write(final XoXMLStreamWriter writer, final FacesValid } // ELEMENT: validatorExtension - final List validatorExtension = facesValidator.validatorExtension; - if (validatorExtension != null) { - for (final FacesValidatorExtension validatorExtensionItem : validatorExtension) { - if (validatorExtensionItem != null) { + List validatorExtension = facesValidator.validatorExtension; + if (validatorExtension!= null) { + for (FacesValidatorExtension validatorExtensionItem: validatorExtension) { + if (validatorExtensionItem!= null) { writer.writeStartElement(prefix, "validator-extension", "http://java.sun.com/xml/ns/javaee"); writeFacesValidatorExtension(writer, validatorExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidatorExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidatorExtension$JAXB.java index 88c2fa0584d..af90b46b551 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidatorExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidatorExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class FacesValidatorExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public FacesValidatorExtension$JAXB() { super(FacesValidatorExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config-validator-extensionType".intern())); } - public static FacesValidatorExtension readFacesValidatorExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FacesValidatorExtension readFacesValidatorExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFacesValidatorExtension(final XoXMLStreamWriter writer, final FacesValidatorExtension facesValidatorExtension, final RuntimeContext context) - throws Exception { + public static void writeFacesValidatorExtension(XoXMLStreamWriter writer, FacesValidatorExtension facesValidatorExtension, RuntimeContext context) + throws Exception + { _write(writer, facesValidatorExtension, context); } - public void write(final XoXMLStreamWriter writer, final FacesValidatorExtension facesValidatorExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FacesValidatorExtension facesValidatorExtension, RuntimeContext context) + throws Exception + { _write(writer, facesValidatorExtension, context); } - public final static FacesValidatorExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FacesValidatorExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,45 +72,45 @@ public final static FacesValidatorExtension _read(final XoXMLStreamReader reader context = new RuntimeContext(); } - final FacesValidatorExtension facesValidatorExtension = new FacesValidatorExtension(); + FacesValidatorExtension facesValidatorExtension = new FacesValidatorExtension(); context.beforeUnmarshal(facesValidatorExtension, LifecycleCallback.NONE); List any = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("faces-config-validator-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("faces-config-validator-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FacesValidatorExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, facesValidatorExtension); facesValidatorExtension.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { // ELEMENT_REF: any if (any == null) { any = facesValidatorExtension.any; - if (any != null) { + if (any!= null) { any.clear(); } else { - any = new ArrayList(); + any = new ArrayList<>(); } } any.add(context.readXmlAny(elementReader, Object.class, true)); } - if (any != null) { + if (any!= null) { facesValidatorExtension.any = any; } @@ -114,46 +119,48 @@ public final static FacesValidatorExtension _read(final XoXMLStreamReader reader return facesValidatorExtension; } - public final FacesValidatorExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FacesValidatorExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FacesValidatorExtension facesValidatorExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FacesValidatorExtension facesValidatorExtension, RuntimeContext context) + throws Exception + { if (facesValidatorExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (FacesValidatorExtension.class != facesValidatorExtension.getClass()) { + if (FacesValidatorExtension.class!= facesValidatorExtension.getClass()) { context.unexpectedSubclass(writer, facesValidatorExtension, FacesValidatorExtension.class); - return; + return ; } context.beforeMarshal(facesValidatorExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = facesValidatorExtension.id; - if (idRaw != null) { + String idRaw = facesValidatorExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(facesValidatorExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT_REF: any - final List any = facesValidatorExtension.any; - if (any != null) { - for (final Object anyItem : any) { + List any = facesValidatorExtension.any; + if (any!= null) { + for (Object anyItem: any) { context.writeXmlAny(writer, facesValidatorExtension, "any", anyItem); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Filter$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Filter$JAXB.java index b844c98c1fe..24973267d5f 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Filter$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Filter$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -40,30 +41,35 @@ "StringEquality" }) public class Filter$JAXB - extends JAXBObject { + extends JAXBObject +{ public Filter$JAXB() { super(Filter.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "filterType".intern()), Text$JAXB.class, Icon$JAXB.class, ParamValue$JAXB.class); } - public static Filter readFilter(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Filter readFilter(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFilter(final XoXMLStreamWriter writer, final Filter filter, final RuntimeContext context) - throws Exception { + public static void writeFilter(XoXMLStreamWriter writer, Filter filter, RuntimeContext context) + throws Exception + { _write(writer, filter, context); } - public void write(final XoXMLStreamWriter writer, final Filter filter, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Filter filter, RuntimeContext context) + throws Exception + { _write(writer, filter, context); } - public final static Filter _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Filter _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,7 +80,7 @@ public final static Filter _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final Filter filter = new Filter(); + Filter filter = new Filter(); context.beforeUnmarshal(filter, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -83,92 +89,92 @@ public final static Filter _read(final XoXMLStreamReader reader, RuntimeContext List initParam = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("filterType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("filterType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Filter.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, filter); filter.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = filter.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("filter-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("filter-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: filterName - final String filterNameRaw = elementReader.getElementAsString(); + String filterNameRaw = elementReader.getElementText(); - final String filterName; + String filterName; try { filterName = Adapters.collapsedStringAdapterAdapter.unmarshal(filterNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } filter.filterName = filterName; - } else if (("filter-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("filter-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: filterClass - final String filterClassRaw = elementReader.getElementAsString(); + String filterClassRaw = elementReader.getElementText(); - final String filterClass; + String filterClass; try { filterClass = Adapters.collapsedStringAdapterAdapter.unmarshal(filterClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } filter.filterClass = filterClass; - } else if (("async-supported" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("async-supported" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: asyncSupported - final Boolean asyncSupported = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean asyncSupported = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); filter.asyncSupported = asyncSupported; - } else if (("init-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("init-param" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: initParam - final ParamValue initParamItem = readParamValue(elementReader, context); + ParamValue initParamItem = readParamValue(elementReader, context); if (initParam == null) { initParam = filter.initParam; - if (initParam != null) { + if (initParam!= null) { initParam.clear(); } else { - initParam = new ArrayList(); + initParam = new ArrayList<>(); } } initParam.add(initParamItem); @@ -176,24 +182,24 @@ public final static Filter _read(final XoXMLStreamReader reader, RuntimeContext 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", "filter-name"), new QName("http://java.sun.com/xml/ns/javaee", "filter-class"), new QName("http://java.sun.com/xml/ns/javaee", "async-supported"), new QName("http://java.sun.com/xml/ns/javaee", "init-param")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - filter.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + filter.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Filter.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - filter.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + filter.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, Filter.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { filter.icon = icon; } - if (initParam != null) { + if (initParam!= null) { filter.initParam = initParam; } @@ -202,38 +208,40 @@ public final static Filter _read(final XoXMLStreamReader reader, RuntimeContext return filter; } - public final Filter read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Filter read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Filter filter, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Filter filter, RuntimeContext context) + throws Exception + { if (filter == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Filter.class != filter.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Filter.class!= filter.getClass()) { context.unexpectedSubclass(writer, filter, Filter.class); - return; + return ; } context.beforeMarshal(filter, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = filter.id; - if (idRaw != null) { + String idRaw = filter.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(filter, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -243,12 +251,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Filter fil Text[] descriptions = null; try { descriptions = filter.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(filter, "descriptions", Filter.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -262,12 +270,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Filter fil Text[] displayNames = null; try { displayNames = filter.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(filter, "displayNames", Filter.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -278,10 +286,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Filter fil } // ELEMENT: icon - final LocalCollection icon = filter.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = filter.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -292,14 +300,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Filter fil } // ELEMENT: filterName - final String filterNameRaw = filter.filterName; + String filterNameRaw = filter.filterName; String filterName = null; try { filterName = Adapters.collapsedStringAdapterAdapter.marshal(filterNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(filter, "filterName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (filterName != null) { + if (filterName!= null) { writer.writeStartElement(prefix, "filter-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(filterName); writer.writeEndElement(); @@ -308,14 +316,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Filter fil } // ELEMENT: filterClass - final String filterClassRaw = filter.filterClass; + String filterClassRaw = filter.filterClass; String filterClass = null; try { filterClass = Adapters.collapsedStringAdapterAdapter.marshal(filterClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(filter, "filterClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (filterClass != null) { + if (filterClass!= null) { writer.writeStartElement(prefix, "filter-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(filterClass); writer.writeEndElement(); @@ -324,16 +332,16 @@ public final static void _write(final XoXMLStreamWriter writer, final Filter fil } // ELEMENT: asyncSupported - final Boolean asyncSupported = filter.asyncSupported; + Boolean asyncSupported = filter.asyncSupported; writer.writeStartElement(prefix, "async-supported", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(asyncSupported)); writer.writeEndElement(); // ELEMENT: initParam - final List initParam = filter.initParam; - if (initParam != null) { - for (final ParamValue initParamItem : initParam) { - if (initParamItem != null) { + List initParam = filter.initParam; + if (initParam!= null) { + for (ParamValue initParamItem: initParam) { + if (initParamItem!= null) { writer.writeStartElement(prefix, "init-param", "http://java.sun.com/xml/ns/javaee"); writeParamValue(writer, initParamItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FilterMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FilterMapping$JAXB.java index 9d90a1fbf36..42fc74a054b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FilterMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FilterMapping$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Dispatcher$JAXB.parseDispatcher; import static org.apache.openejb.jee.Dispatcher$JAXB.toStringDispatcher; @@ -36,30 +37,35 @@ "StringEquality" }) public class FilterMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public FilterMapping$JAXB() { super(FilterMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "filter-mappingType".intern()), Dispatcher$JAXB.class); } - public static FilterMapping readFilterMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FilterMapping readFilterMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFilterMapping(final XoXMLStreamWriter writer, final FilterMapping filterMapping, final RuntimeContext context) - throws Exception { + public static void writeFilterMapping(XoXMLStreamWriter writer, FilterMapping filterMapping, RuntimeContext context) + throws Exception + { _write(writer, filterMapping, context); } - public void write(final XoXMLStreamWriter writer, final FilterMapping filterMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FilterMapping filterMapping, RuntimeContext context) + throws Exception + { _write(writer, filterMapping, context); } - public final static FilterMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FilterMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,7 +76,7 @@ public final static FilterMapping _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final FilterMapping filterMapping = new FilterMapping(); + FilterMapping filterMapping = new FilterMapping(); context.beforeUnmarshal(filterMapping, LifecycleCallback.NONE); List urlPattern = null; @@ -78,94 +84,94 @@ public final static FilterMapping _read(final XoXMLStreamReader reader, RuntimeC List dispatcher = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("filter-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("filter-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FilterMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, filterMapping); filterMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("filter-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("filter-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: filterName - final String filterNameRaw = elementReader.getElementAsString(); + String filterNameRaw = elementReader.getElementText(); - final String filterName; + String filterName; try { filterName = Adapters.collapsedStringAdapterAdapter.unmarshal(filterNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } filterMapping.filterName = filterName; - } else if (("url-pattern" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("url-pattern" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: urlPattern - final String urlPatternItemRaw = elementReader.getElementAsString(); + String urlPatternItemRaw = elementReader.getElementText(); - final String urlPatternItem; + String urlPatternItem; try { urlPatternItem = Adapters.trimStringAdapterAdapter.unmarshal(urlPatternItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, TrimStringAdapter.class, String.class, String.class, e); continue; } if (urlPattern == null) { urlPattern = filterMapping.urlPattern; - if (urlPattern != null) { + if (urlPattern!= null) { urlPattern.clear(); } else { - urlPattern = new ArrayList(); + urlPattern = new ArrayList<>(); } } urlPattern.add(urlPatternItem); - } else if (("servlet-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("servlet-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: servletName - final String servletNameItemRaw = elementReader.getElementAsString(); + String servletNameItemRaw = elementReader.getElementText(); - final String servletNameItem; + String servletNameItem; try { servletNameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(servletNameItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (servletName == null) { servletName = filterMapping.servletName; - if (servletName != null) { + if (servletName!= null) { servletName.clear(); } else { - servletName = new ArrayList(); + servletName = new ArrayList<>(); } } servletName.add(servletNameItem); - } else if (("dispatcher" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("dispatcher" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dispatcher Dispatcher dispatcherItem = null; if (!elementReader.isXsiNil()) { - dispatcherItem = parseDispatcher(elementReader, context, elementReader.getElementAsString()); + dispatcherItem = parseDispatcher(elementReader, context, elementReader.getElementText()); } if (dispatcher == null) { dispatcher = filterMapping.dispatcher; - if (dispatcher != null) { + if (dispatcher!= null) { dispatcher.clear(); } else { - dispatcher = new ArrayList(); + dispatcher = new ArrayList<>(); } } dispatcher.add(dispatcherItem); @@ -173,13 +179,13 @@ public final static FilterMapping _read(final XoXMLStreamReader reader, RuntimeC context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "filter-name"), new QName("http://java.sun.com/xml/ns/javaee", "url-pattern"), new QName("http://java.sun.com/xml/ns/javaee", "servlet-name"), new QName("http://java.sun.com/xml/ns/javaee", "dispatcher")); } } - if (urlPattern != null) { + if (urlPattern!= null) { filterMapping.urlPattern = urlPattern; } - if (servletName != null) { + if (servletName!= null) { filterMapping.servletName = servletName; } - if (dispatcher != null) { + if (dispatcher!= null) { filterMapping.dispatcher = dispatcher; } @@ -188,52 +194,54 @@ public final static FilterMapping _read(final XoXMLStreamReader reader, RuntimeC return filterMapping; } - public final FilterMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FilterMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FilterMapping filterMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FilterMapping filterMapping, RuntimeContext context) + throws Exception + { if (filterMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FilterMapping.class != filterMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FilterMapping.class!= filterMapping.getClass()) { context.unexpectedSubclass(writer, filterMapping, FilterMapping.class); - return; + return ; } context.beforeMarshal(filterMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = filterMapping.id; - if (idRaw != null) { + String idRaw = filterMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(filterMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: filterName - final String filterNameRaw = filterMapping.filterName; + String filterNameRaw = filterMapping.filterName; String filterName = null; try { filterName = Adapters.collapsedStringAdapterAdapter.marshal(filterNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(filterMapping, "filterName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (filterName != null) { + if (filterName!= null) { writer.writeStartElement(prefix, "filter-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(filterName); writer.writeEndElement(); @@ -242,16 +250,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FilterMapp } // ELEMENT: urlPattern - final List urlPatternRaw = filterMapping.urlPattern; - if (urlPatternRaw != null) { - for (final String urlPatternItem : urlPatternRaw) { + List urlPatternRaw = filterMapping.urlPattern; + if (urlPatternRaw!= null) { + for (String urlPatternItem: urlPatternRaw) { String urlPattern = null; try { urlPattern = Adapters.trimStringAdapterAdapter.marshal(urlPatternItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(filterMapping, "urlPattern", TrimStringAdapter.class, List.class, List.class, e); } - if (urlPattern != null) { + if (urlPattern!= null) { writer.writeStartElement(prefix, "url-pattern", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(urlPattern); writer.writeEndElement(); @@ -260,16 +268,16 @@ public final static void _write(final XoXMLStreamWriter writer, final FilterMapp } // ELEMENT: servletName - final List servletNameRaw = filterMapping.servletName; - if (servletNameRaw != null) { - for (final String servletNameItem : servletNameRaw) { + List servletNameRaw = filterMapping.servletName; + if (servletNameRaw!= null) { + for (String servletNameItem: servletNameRaw) { String servletName = null; try { servletName = Adapters.collapsedStringAdapterAdapter.marshal(servletNameItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(filterMapping, "servletName", CollapsedStringAdapter.class, List.class, List.class, e); } - if (servletName != null) { + if (servletName!= null) { writer.writeStartElement(prefix, "servlet-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(servletName); writer.writeEndElement(); @@ -278,11 +286,11 @@ public final static void _write(final XoXMLStreamWriter writer, final FilterMapp } // ELEMENT: dispatcher - final List dispatcher = filterMapping.dispatcher; - if (dispatcher != null) { - for (final Dispatcher dispatcherItem : dispatcher) { + List dispatcher = filterMapping.dispatcher; + if (dispatcher!= null) { + for (Dispatcher dispatcherItem: dispatcher) { writer.writeStartElement(prefix, "dispatcher", "http://java.sun.com/xml/ns/javaee"); - if (dispatcherItem != null) { + if (dispatcherItem!= null) { writer.writeCharacters(toStringDispatcher(filterMapping, null, context, dispatcherItem)); } else { writer.writeXsiNil(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FormLoginConfig$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FormLoginConfig$JAXB.java index f4511c718ff..f52711e3a6a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FormLoginConfig$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FormLoginConfig$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class FormLoginConfig$JAXB - extends JAXBObject { + extends JAXBObject +{ public FormLoginConfig$JAXB() { super(FormLoginConfig.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "form-login-configType".intern())); } - public static FormLoginConfig readFormLoginConfig(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static FormLoginConfig readFormLoginConfig(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFormLoginConfig(final XoXMLStreamWriter writer, final FormLoginConfig formLoginConfig, final RuntimeContext context) - throws Exception { + public static void writeFormLoginConfig(XoXMLStreamWriter writer, FormLoginConfig formLoginConfig, RuntimeContext context) + throws Exception + { _write(writer, formLoginConfig, context); } - public void write(final XoXMLStreamWriter writer, final FormLoginConfig formLoginConfig, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, FormLoginConfig formLoginConfig, RuntimeContext context) + throws Exception + { _write(writer, formLoginConfig, context); } - public final static FormLoginConfig _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final FormLoginConfig _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,53 +70,53 @@ public final static FormLoginConfig _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final FormLoginConfig formLoginConfig = new FormLoginConfig(); + FormLoginConfig formLoginConfig = new FormLoginConfig(); context.beforeUnmarshal(formLoginConfig, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("form-login-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("form-login-configType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, FormLoginConfig.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, formLoginConfig); formLoginConfig.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("form-login-page" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("form-login-page" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: formLoginPage - final String formLoginPageRaw = elementReader.getElementAsString(); + String formLoginPageRaw = elementReader.getElementText(); - final String formLoginPage; + String formLoginPage; try { formLoginPage = Adapters.collapsedStringAdapterAdapter.unmarshal(formLoginPageRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } formLoginConfig.formLoginPage = formLoginPage; - } else if (("form-error-page" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("form-error-page" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: formErrorPage - final String formErrorPageRaw = elementReader.getElementAsString(); + String formErrorPageRaw = elementReader.getElementText(); - final String formErrorPage; + String formErrorPage; try { formErrorPage = Adapters.collapsedStringAdapterAdapter.unmarshal(formErrorPageRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -127,52 +132,54 @@ public final static FormLoginConfig _read(final XoXMLStreamReader reader, Runtim return formLoginConfig; } - public final FormLoginConfig read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final FormLoginConfig read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final FormLoginConfig formLoginConfig, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, FormLoginConfig formLoginConfig, RuntimeContext context) + throws Exception + { if (formLoginConfig == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (FormLoginConfig.class != formLoginConfig.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (FormLoginConfig.class!= formLoginConfig.getClass()) { context.unexpectedSubclass(writer, formLoginConfig, FormLoginConfig.class); - return; + return ; } context.beforeMarshal(formLoginConfig, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = formLoginConfig.id; - if (idRaw != null) { + String idRaw = formLoginConfig.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(formLoginConfig, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: formLoginPage - final String formLoginPageRaw = formLoginConfig.formLoginPage; + String formLoginPageRaw = formLoginConfig.formLoginPage; String formLoginPage = null; try { formLoginPage = Adapters.collapsedStringAdapterAdapter.marshal(formLoginPageRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(formLoginConfig, "formLoginPage", CollapsedStringAdapter.class, String.class, String.class, e); } - if (formLoginPage != null) { + if (formLoginPage!= null) { writer.writeStartElement(prefix, "form-login-page", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(formLoginPage); writer.writeEndElement(); @@ -181,14 +188,14 @@ public final static void _write(final XoXMLStreamWriter writer, final FormLoginC } // ELEMENT: formErrorPage - final String formErrorPageRaw = formLoginConfig.formErrorPage; + String formErrorPageRaw = formLoginConfig.formErrorPage; String formErrorPage = null; try { formErrorPage = Adapters.collapsedStringAdapterAdapter.marshal(formErrorPageRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(formLoginConfig, "formErrorPage", CollapsedStringAdapter.class, String.class, String.class, e); } - if (formErrorPage != null) { + if (formErrorPage!= null) { writer.writeStartElement(prefix, "form-error-page", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(formErrorPage); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Function$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Function$JAXB.java index 0d04c46933f..1f569d29a67 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Function$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Function$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -40,30 +41,35 @@ "StringEquality" }) public class Function$JAXB - extends JAXBObject { + extends JAXBObject +{ public Function$JAXB() { super(Function.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "functionType".intern()), Text$JAXB.class, Icon$JAXB.class, TldExtension$JAXB.class); } - public static Function readFunction(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Function readFunction(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeFunction(final XoXMLStreamWriter writer, final Function function, final RuntimeContext context) - throws Exception { + public static void writeFunction(XoXMLStreamWriter writer, Function function, RuntimeContext context) + throws Exception + { _write(writer, function, context); } - public void write(final XoXMLStreamWriter writer, final Function function, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Function function, RuntimeContext context) + throws Exception + { _write(writer, function, context); } - public final static Function _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Function _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,7 +80,7 @@ public final static Function _read(final XoXMLStreamReader reader, RuntimeContex context = new RuntimeContext(); } - final Function function = new Function(); + Function function = new Function(); context.beforeUnmarshal(function, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -83,114 +89,114 @@ public final static Function _read(final XoXMLStreamReader reader, RuntimeContex List functionExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("functionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("functionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Function.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, function); function.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = function.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + String nameRaw = elementReader.getElementText(); - final String name; + String name; try { name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } function.name = name; - } else if (("function-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("function-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: functionClass - final String functionClassRaw = elementReader.getElementAsString(); + String functionClassRaw = elementReader.getElementText(); - final String functionClass; + String functionClass; try { functionClass = Adapters.collapsedStringAdapterAdapter.unmarshal(functionClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } function.functionClass = functionClass; - } else if (("function-signature" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("function-signature" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: functionSignature - final String functionSignatureRaw = elementReader.getElementAsString(); + String functionSignatureRaw = elementReader.getElementText(); - final String functionSignature; + String functionSignature; try { functionSignature = Adapters.collapsedStringAdapterAdapter.unmarshal(functionSignatureRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } function.functionSignature = functionSignature; - } else if (("example" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("example" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: example - final String exampleRaw = elementReader.getElementAsString(); + String exampleRaw = elementReader.getElementText(); - final String example; + String example; try { example = Adapters.collapsedStringAdapterAdapter.unmarshal(exampleRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } function.example = example; - } else if (("function-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("function-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: functionExtension - final TldExtension functionExtensionItem = readTldExtension(elementReader, context); + TldExtension functionExtensionItem = readTldExtension(elementReader, context); if (functionExtension == null) { functionExtension = function.functionExtension; - if (functionExtension != null) { + if (functionExtension!= null) { functionExtension.clear(); } else { - functionExtension = new ArrayList(); + functionExtension = new ArrayList<>(); } } functionExtension.add(functionExtensionItem); @@ -198,24 +204,24 @@ public final static Function _read(final XoXMLStreamReader reader, RuntimeContex 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", "name"), new QName("http://java.sun.com/xml/ns/javaee", "function-class"), new QName("http://java.sun.com/xml/ns/javaee", "function-signature"), new QName("http://java.sun.com/xml/ns/javaee", "example"), new QName("http://java.sun.com/xml/ns/javaee", "function-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - function.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + function.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Function.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - function.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + function.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, Function.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { function.icon = icon; } - if (functionExtension != null) { + if (functionExtension!= null) { function.functionExtension = functionExtension; } @@ -224,38 +230,40 @@ public final static Function _read(final XoXMLStreamReader reader, RuntimeContex return function; } - public final Function read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Function read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Function function, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Function function, RuntimeContext context) + throws Exception + { if (function == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Function.class != function.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Function.class!= function.getClass()) { context.unexpectedSubclass(writer, function, Function.class); - return; + return ; } context.beforeMarshal(function, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = function.id; - if (idRaw != null) { + String idRaw = function.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(function, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -265,12 +273,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Function f Text[] descriptions = null; try { descriptions = function.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(function, "descriptions", Function.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -284,12 +292,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Function f Text[] displayNames = null; try { displayNames = function.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(function, "displayNames", Function.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -300,10 +308,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Function f } // ELEMENT: icon - final LocalCollection icon = function.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = function.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -314,14 +322,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Function f } // ELEMENT: name - final String nameRaw = function.name; + String nameRaw = function.name; String name = null; try { name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(function, "name", CollapsedStringAdapter.class, String.class, String.class, e); } - if (name != null) { + if (name!= null) { writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(name); writer.writeEndElement(); @@ -330,14 +338,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Function f } // ELEMENT: functionClass - final String functionClassRaw = function.functionClass; + String functionClassRaw = function.functionClass; String functionClass = null; try { functionClass = Adapters.collapsedStringAdapterAdapter.marshal(functionClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(function, "functionClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (functionClass != null) { + if (functionClass!= null) { writer.writeStartElement(prefix, "function-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(functionClass); writer.writeEndElement(); @@ -346,14 +354,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Function f } // ELEMENT: functionSignature - final String functionSignatureRaw = function.functionSignature; + String functionSignatureRaw = function.functionSignature; String functionSignature = null; try { functionSignature = Adapters.collapsedStringAdapterAdapter.marshal(functionSignatureRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(function, "functionSignature", CollapsedStringAdapter.class, String.class, String.class, e); } - if (functionSignature != null) { + if (functionSignature!= null) { writer.writeStartElement(prefix, "function-signature", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(functionSignature); writer.writeEndElement(); @@ -362,24 +370,24 @@ public final static void _write(final XoXMLStreamWriter writer, final Function f } // ELEMENT: example - final String exampleRaw = function.example; + String exampleRaw = function.example; String example = null; try { example = Adapters.collapsedStringAdapterAdapter.marshal(exampleRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(function, "example", CollapsedStringAdapter.class, String.class, String.class, e); } - if (example != null) { + if (example!= null) { writer.writeStartElement(prefix, "example", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(example); writer.writeEndElement(); } // ELEMENT: functionExtension - final List functionExtension = function.functionExtension; - if (functionExtension != null) { - for (final TldExtension functionExtensionItem : functionExtension) { - if (functionExtensionItem != null) { + List functionExtension = function.functionExtension; + if (functionExtension!= null) { + for (TldExtension functionExtensionItem: functionExtension) { + if (functionExtensionItem!= null) { writer.writeStartElement(prefix, "function-extension", "http://java.sun.com/xml/ns/javaee"); writeTldExtension(writer, functionExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Handler$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Handler$JAXB.java index a3014048634..15f8a131b43 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Handler$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Handler$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -40,30 +41,35 @@ "StringEquality" }) public class Handler$JAXB - extends JAXBObject { + extends JAXBObject +{ public Handler$JAXB() { super(Handler.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "handlerType".intern()), Text$JAXB.class, Icon$JAXB.class, ParamValue$JAXB.class); } - public static Handler readHandler(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Handler readHandler(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeHandler(final XoXMLStreamWriter writer, final Handler handler, final RuntimeContext context) - throws Exception { + public static void writeHandler(XoXMLStreamWriter writer, Handler handler, RuntimeContext context) + throws Exception + { _write(writer, handler, context); } - public void write(final XoXMLStreamWriter writer, final Handler handler, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Handler handler, RuntimeContext context) + throws Exception + { _write(writer, handler, context); } - public final static Handler _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Handler _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,7 +80,7 @@ public final static Handler _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final Handler handler = new Handler(); + Handler handler = new Handler(); context.beforeUnmarshal(handler, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -86,142 +92,142 @@ public final static Handler _read(final XoXMLStreamReader reader, RuntimeContext List portName = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("handlerType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("handlerType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Handler.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, handler); handler.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = handler.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("handler-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("handler-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: handlerName - final String handlerNameRaw = elementReader.getElementAsString(); + String handlerNameRaw = elementReader.getElementText(); - final String handlerName; + String handlerName; try { handlerName = Adapters.collapsedStringAdapterAdapter.unmarshal(handlerNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } handler.handlerName = handlerName; - } else if (("handler-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("handler-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: handlerClass - final String handlerClassRaw = elementReader.getElementAsString(); + String handlerClassRaw = elementReader.getElementText(); - final String handlerClass; + String handlerClass; try { handlerClass = Adapters.collapsedStringAdapterAdapter.unmarshal(handlerClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } handler.handlerClass = handlerClass; - } else if (("init-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("init-param" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: initParam - final ParamValue initParamItem = readParamValue(elementReader, context); + ParamValue initParamItem = readParamValue(elementReader, context); if (initParam == null) { initParam = handler.initParam; - if (initParam != null) { + if (initParam!= null) { initParam.clear(); } else { - initParam = new ArrayList(); + initParam = new ArrayList<>(); } } initParam.add(initParamItem); - } else if (("soap-header" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("soap-header" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: soapHeader - final QName soapHeaderItem = elementReader.getElementAsQName(); + QName soapHeaderItem = elementReader.getElementAsQName(); if (soapHeader == null) { soapHeader = handler.soapHeader; - if (soapHeader != null) { + if (soapHeader!= null) { soapHeader.clear(); } else { - soapHeader = new ArrayList(); + soapHeader = new ArrayList<>(); } } soapHeader.add(soapHeaderItem); - } else if (("soap-role" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("soap-role" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: soapRole - final String soapRoleItemRaw = elementReader.getElementAsString(); + String soapRoleItemRaw = elementReader.getElementText(); - final String soapRoleItem; + String soapRoleItem; try { soapRoleItem = Adapters.collapsedStringAdapterAdapter.unmarshal(soapRoleItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (soapRole == null) { soapRole = handler.soapRole; - if (soapRole != null) { + if (soapRole!= null) { soapRole.clear(); } else { - soapRole = new ArrayList(); + soapRole = new ArrayList<>(); } } soapRole.add(soapRoleItem); - } else if (("port-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("port-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: portName - final String portNameItemRaw = elementReader.getElementAsString(); + String portNameItemRaw = elementReader.getElementText(); - final String portNameItem; + String portNameItem; try { portNameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(portNameItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (portName == null) { portName = handler.portName; - if (portName != null) { + if (portName!= null) { portName.clear(); } else { - portName = new ArrayList(); + portName = new ArrayList<>(); } } portName.add(portNameItem); @@ -229,33 +235,33 @@ public final static Handler _read(final XoXMLStreamReader reader, RuntimeContext 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", "handler-name"), new QName("http://java.sun.com/xml/ns/javaee", "handler-class"), new QName("http://java.sun.com/xml/ns/javaee", "init-param"), new QName("http://java.sun.com/xml/ns/javaee", "soap-header"), new QName("http://java.sun.com/xml/ns/javaee", "soap-role"), new QName("http://java.sun.com/xml/ns/javaee", "port-name")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - handler.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + handler.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Handler.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - handler.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + handler.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, Handler.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { handler.icon = icon; } - if (initParam != null) { + if (initParam!= null) { handler.initParam = initParam; } - if (soapHeader != null) { + if (soapHeader!= null) { handler.soapHeader = soapHeader; } - if (soapRole != null) { + if (soapRole!= null) { handler.soapRole = soapRole; } - if (portName != null) { + if (portName!= null) { handler.portName = portName; } @@ -264,38 +270,40 @@ public final static Handler _read(final XoXMLStreamReader reader, RuntimeContext return handler; } - public final Handler read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Handler read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Handler handler, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Handler handler, RuntimeContext context) + throws Exception + { if (handler == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Handler.class != handler.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Handler.class!= handler.getClass()) { context.unexpectedSubclass(writer, handler, Handler.class); - return; + return ; } context.beforeMarshal(handler, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = handler.id; - if (idRaw != null) { + String idRaw = handler.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(handler, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -305,12 +313,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Handler ha Text[] descriptions = null; try { descriptions = handler.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(handler, "descriptions", Handler.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -324,12 +332,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Handler ha Text[] displayNames = null; try { displayNames = handler.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(handler, "displayNames", Handler.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -340,10 +348,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Handler ha } // ELEMENT: icon - final LocalCollection icon = handler.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = handler.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -352,14 +360,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Handler ha } // ELEMENT: handlerName - final String handlerNameRaw = handler.handlerName; + String handlerNameRaw = handler.handlerName; String handlerName = null; try { handlerName = Adapters.collapsedStringAdapterAdapter.marshal(handlerNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(handler, "handlerName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (handlerName != null) { + if (handlerName!= null) { writer.writeStartElement(prefix, "handler-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(handlerName); writer.writeEndElement(); @@ -368,14 +376,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Handler ha } // ELEMENT: handlerClass - final String handlerClassRaw = handler.handlerClass; + String handlerClassRaw = handler.handlerClass; String handlerClass = null; try { handlerClass = Adapters.collapsedStringAdapterAdapter.marshal(handlerClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(handler, "handlerClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (handlerClass != null) { + if (handlerClass!= null) { writer.writeStartElement(prefix, "handler-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(handlerClass); writer.writeEndElement(); @@ -384,10 +392,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Handler ha } // ELEMENT: initParam - final List initParam = handler.initParam; - if (initParam != null) { - for (final ParamValue initParamItem : initParam) { - if (initParamItem != null) { + List initParam = handler.initParam; + if (initParam!= null) { + for (ParamValue initParamItem: initParam) { + if (initParamItem!= null) { writer.writeStartElement(prefix, "init-param", "http://java.sun.com/xml/ns/javaee"); writeParamValue(writer, initParamItem, context); writer.writeEndElement(); @@ -396,10 +404,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Handler ha } // ELEMENT: soapHeader - final List soapHeader = handler.soapHeader; - if (soapHeader != null) { - for (final QName soapHeaderItem : soapHeader) { - if (soapHeaderItem != null) { + List soapHeader = handler.soapHeader; + if (soapHeader!= null) { + for (QName soapHeaderItem: soapHeader) { + if (soapHeaderItem!= null) { writer.writeStartElement(prefix, "soap-header", "http://java.sun.com/xml/ns/javaee"); writer.writeQName(soapHeaderItem); writer.writeEndElement(); @@ -408,16 +416,16 @@ public final static void _write(final XoXMLStreamWriter writer, final Handler ha } // ELEMENT: soapRole - final List soapRoleRaw = handler.soapRole; - if (soapRoleRaw != null) { - for (final String soapRoleItem : soapRoleRaw) { + List soapRoleRaw = handler.soapRole; + if (soapRoleRaw!= null) { + for (String soapRoleItem: soapRoleRaw) { String soapRole = null; try { soapRole = Adapters.collapsedStringAdapterAdapter.marshal(soapRoleItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(handler, "soapRole", CollapsedStringAdapter.class, List.class, List.class, e); } - if (soapRole != null) { + if (soapRole!= null) { writer.writeStartElement(prefix, "soap-role", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(soapRole); writer.writeEndElement(); @@ -426,16 +434,16 @@ public final static void _write(final XoXMLStreamWriter writer, final Handler ha } // ELEMENT: portName - final List portNameRaw = handler.portName; - if (portNameRaw != null) { - for (final String portNameItem : portNameRaw) { + List portNameRaw = handler.portName; + if (portNameRaw!= null) { + for (String portNameItem: portNameRaw) { String portName = null; try { portName = Adapters.collapsedStringAdapterAdapter.marshal(portNameItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(handler, "portName", CollapsedStringAdapter.class, List.class, List.class, e); } - if (portName != null) { + if (portName!= null) { writer.writeStartElement(prefix, "port-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(portName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/HandlerChain$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/HandlerChain$JAXB.java index 444dd4916bb..f23b6fd972f 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/HandlerChain$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/HandlerChain$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Handler$JAXB.readHandler; import static org.apache.openejb.jee.Handler$JAXB.writeHandler; @@ -36,30 +37,35 @@ "StringEquality" }) public class HandlerChain$JAXB - extends JAXBObject { + extends JAXBObject +{ public HandlerChain$JAXB() { super(HandlerChain.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "handler-chainType".intern()), Handler$JAXB.class); } - public static HandlerChain readHandlerChain(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static HandlerChain readHandlerChain(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeHandlerChain(final XoXMLStreamWriter writer, final HandlerChain handlerChain, final RuntimeContext context) - throws Exception { + public static void writeHandlerChain(XoXMLStreamWriter writer, HandlerChain handlerChain, RuntimeContext context) + throws Exception + { _write(writer, handlerChain, context); } - public void write(final XoXMLStreamWriter writer, final HandlerChain handlerChain, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, HandlerChain handlerChain, RuntimeContext context) + throws Exception + { _write(writer, handlerChain, context); } - public final static HandlerChain _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final HandlerChain _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,91 +76,91 @@ public final static HandlerChain _read(final XoXMLStreamReader reader, RuntimeCo context = new RuntimeContext(); } - final HandlerChain handlerChain = new HandlerChain(); + HandlerChain handlerChain = new HandlerChain(); context.beforeUnmarshal(handlerChain, LifecycleCallback.NONE); List protocolBindings = null; List handler = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("handler-chainType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("handler-chainType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, HandlerChain.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, handlerChain); handlerChain.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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-name-pattern" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("service-name-pattern" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceNamePattern - final String serviceNamePatternRaw = elementReader.getElementAsString(); + String serviceNamePatternRaw = elementReader.getElementText(); - final QName serviceNamePattern; + QName serviceNamePattern; try { serviceNamePattern = Adapters.handlerChainsStringQNameAdapterAdapter.unmarshal(serviceNamePatternRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, HandlerChainsStringQNameAdapter.class, QName.class, QName.class, e); continue; } handlerChain.serviceNamePattern = serviceNamePattern; - } else if (("port-name-pattern" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("port-name-pattern" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: portNamePattern - final String portNamePatternRaw = elementReader.getElementAsString(); + String portNamePatternRaw = elementReader.getElementText(); - final QName portNamePattern; + QName portNamePattern; try { portNamePattern = Adapters.handlerChainsStringQNameAdapterAdapter.unmarshal(portNamePatternRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, HandlerChainsStringQNameAdapter.class, QName.class, QName.class, e); continue; } handlerChain.portNamePattern = portNamePattern; - } else if (("protocol-bindings" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("protocol-bindings" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: protocolBindings - for (final String protocolBindingsItem : elementReader.getElementAsXmlList()) { + for (String protocolBindingsItem: elementReader.getElementAsXmlList()) { - final String protocolBindingsItem1; + String protocolBindingsItem1; try { protocolBindingsItem1 = Adapters.collapsedStringAdapterAdapter.unmarshal(protocolBindingsItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (protocolBindings == null) { protocolBindings = handlerChain.protocolBindings; - if (protocolBindings != null) { + if (protocolBindings!= null) { protocolBindings.clear(); } else { - protocolBindings = new ArrayList(); + protocolBindings = new ArrayList<>(); } } protocolBindings.add(protocolBindingsItem1); } - } else if (("handler" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("handler" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: handler - final Handler handlerItem = readHandler(elementReader, context); + Handler handlerItem = readHandler(elementReader, context); if (handler == null) { handler = handlerChain.handler; - if (handler != null) { + if (handler!= null) { handler.clear(); } else { - handler = new ArrayList(); + handler = new ArrayList<>(); } } handler.add(handlerItem); @@ -162,10 +168,10 @@ public final static HandlerChain _read(final XoXMLStreamReader reader, RuntimeCo context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "service-name-pattern"), new QName("http://java.sun.com/xml/ns/javaee", "port-name-pattern"), new QName("http://java.sun.com/xml/ns/javaee", "protocol-bindings"), new QName("http://java.sun.com/xml/ns/javaee", "handler")); } } - if (protocolBindings != null) { + if (protocolBindings!= null) { handlerChain.protocolBindings = protocolBindings; } - if (handler != null) { + if (handler!= null) { handlerChain.handler = handler; } @@ -174,84 +180,86 @@ public final static HandlerChain _read(final XoXMLStreamReader reader, RuntimeCo return handlerChain; } - public final HandlerChain read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final HandlerChain read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final HandlerChain handlerChain, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, HandlerChain handlerChain, RuntimeContext context) + throws Exception + { if (handlerChain == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (HandlerChain.class != handlerChain.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (HandlerChain.class!= handlerChain.getClass()) { context.unexpectedSubclass(writer, handlerChain, HandlerChain.class); - return; + return ; } context.beforeMarshal(handlerChain, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = handlerChain.id; - if (idRaw != null) { + String idRaw = handlerChain.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(handlerChain, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: serviceNamePattern - final QName serviceNamePatternRaw = handlerChain.serviceNamePattern; + QName serviceNamePatternRaw = handlerChain.serviceNamePattern; String serviceNamePattern = null; try { serviceNamePattern = Adapters.handlerChainsStringQNameAdapterAdapter.marshal(serviceNamePatternRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(handlerChain, "serviceNamePattern", HandlerChainsStringQNameAdapter.class, QName.class, QName.class, e); } - if (serviceNamePattern != null) { + if (serviceNamePattern!= null) { writer.writeStartElement(prefix, "service-name-pattern", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(serviceNamePattern); writer.writeEndElement(); } // ELEMENT: portNamePattern - final QName portNamePatternRaw = handlerChain.portNamePattern; + QName portNamePatternRaw = handlerChain.portNamePattern; String portNamePattern = null; try { portNamePattern = Adapters.handlerChainsStringQNameAdapterAdapter.marshal(portNamePatternRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(handlerChain, "portNamePattern", HandlerChainsStringQNameAdapter.class, QName.class, QName.class, e); } - if (portNamePattern != null) { + if (portNamePattern!= null) { writer.writeStartElement(prefix, "port-name-pattern", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(portNamePattern); writer.writeEndElement(); } // ELEMENT: protocolBindings - final List protocolBindingsRaw = handlerChain.protocolBindings; - if (protocolBindingsRaw != null) { + List protocolBindingsRaw = handlerChain.protocolBindings; + if (protocolBindingsRaw!= null) { writer.writeStartElement(prefix, "protocol-bindings", "http://java.sun.com/xml/ns/javaee"); boolean protocolBindingsFirst = true; - for (final String protocolBindingsItem : protocolBindingsRaw) { + for (String protocolBindingsItem: protocolBindingsRaw) { String protocolBindings = null; try { protocolBindings = Adapters.collapsedStringAdapterAdapter.marshal(protocolBindingsItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(handlerChain, "protocolBindings", CollapsedStringAdapter.class, List.class, List.class, e); } - if (protocolBindings != null) { + if (protocolBindings!= null) { if (!protocolBindingsFirst) { writer.writeCharacters(" "); } @@ -263,10 +271,10 @@ public final static void _write(final XoXMLStreamWriter writer, final HandlerCha } // ELEMENT: handler - final List handler = handlerChain.handler; - if (handler != null) { - for (final Handler handlerItem : handler) { - if (handlerItem != null) { + List handler = handlerChain.handler; + if (handler!= null) { + for (Handler handlerItem: handler) { + if (handlerItem!= null) { writer.writeStartElement(prefix, "handler", "http://java.sun.com/xml/ns/javaee"); writeHandler(writer, handlerItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/HandlerChains$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/HandlerChains$JAXB.java index 55d8c0bb3e7..76d7184b113 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/HandlerChains$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/HandlerChains$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.HandlerChain$JAXB.readHandlerChain; import static org.apache.openejb.jee.HandlerChain$JAXB.writeHandlerChain; @@ -36,29 +37,35 @@ "StringEquality" }) public class HandlerChains$JAXB - extends JAXBObject { + extends JAXBObject +{ + public HandlerChains$JAXB() { super(HandlerChains.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "handler-chains".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "handler-chainsType".intern()), HandlerChain$JAXB.class); } - public static HandlerChains readHandlerChains(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static HandlerChains readHandlerChains(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeHandlerChains(final XoXMLStreamWriter writer, final HandlerChains handlerChains, final RuntimeContext context) - throws Exception { + public static void writeHandlerChains(XoXMLStreamWriter writer, HandlerChains handlerChains, RuntimeContext context) + throws Exception + { _write(writer, handlerChains, context); } - public void write(final XoXMLStreamWriter writer, final HandlerChains handlerChains, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, HandlerChains handlerChains, RuntimeContext context) + throws Exception + { _write(writer, handlerChains, context); } - public final static HandlerChains _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final HandlerChains _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,42 +76,42 @@ public final static HandlerChains _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final HandlerChains handlerChains = new HandlerChains(); + HandlerChains handlerChains = new HandlerChains(); context.beforeUnmarshal(handlerChains, LifecycleCallback.NONE); List handlerChain = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("handler-chainsType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("handler-chainsType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, HandlerChains.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, handlerChains); handlerChains.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("handler-chain" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("handler-chain" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: handlerChain - final HandlerChain handlerChainItem = readHandlerChain(elementReader, context); + HandlerChain handlerChainItem = readHandlerChain(elementReader, context); if (handlerChain == null) { handlerChain = handlerChains.handlerChain; - if (handlerChain != null) { + if (handlerChain!= null) { handlerChain.clear(); } else { - handlerChain = new ArrayList(); + handlerChain = new ArrayList<>(); } } handlerChain.add(handlerChainItem); @@ -112,7 +119,7 @@ public final static HandlerChains _read(final XoXMLStreamReader reader, RuntimeC context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "handler-chain")); } } - if (handlerChain != null) { + if (handlerChain!= null) { handlerChains.handlerChain = handlerChain; } @@ -121,47 +128,49 @@ public final static HandlerChains _read(final XoXMLStreamReader reader, RuntimeC return handlerChains; } - public final HandlerChains read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final HandlerChains read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final HandlerChains handlerChains, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, HandlerChains handlerChains, RuntimeContext context) + throws Exception + { if (handlerChains == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (HandlerChains.class != handlerChains.getClass()) { + if (HandlerChains.class!= handlerChains.getClass()) { context.unexpectedSubclass(writer, handlerChains, HandlerChains.class); - return; + return ; } context.beforeMarshal(handlerChains, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = handlerChains.id; - if (idRaw != null) { + String idRaw = handlerChains.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(handlerChains, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: handlerChain - final List handlerChain = handlerChains.handlerChain; - if (handlerChain != null) { - for (final HandlerChain handlerChainItem : handlerChain) { - if (handlerChainItem != null) { + List handlerChain = handlerChains.handlerChain; + if (handlerChain!= null) { + for (HandlerChain handlerChainItem: handlerChain) { + if (handlerChainItem!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "handler-chain"); writeHandlerChain(writer, handlerChainItem, context); writer.writeEndElement(); @@ -171,4 +180,5 @@ public final static void _write(final XoXMLStreamWriter writer, final HandlerCha context.afterMarshal(handlerChains, LifecycleCallback.NONE); } + } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Icon$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Icon$JAXB.java index a3dde76038e..d4b3612a6ae 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Icon$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Icon$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class Icon$JAXB - extends JAXBObject { + extends JAXBObject +{ public Icon$JAXB() { super(Icon.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "iconType".intern())); } - public static Icon readIcon(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Icon readIcon(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeIcon(final XoXMLStreamWriter writer, final Icon icon, final RuntimeContext context) - throws Exception { + public static void writeIcon(XoXMLStreamWriter writer, Icon icon, RuntimeContext context) + throws Exception + { _write(writer, icon, context); } - public void write(final XoXMLStreamWriter writer, final Icon icon, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Icon icon, RuntimeContext context) + throws Exception + { _write(writer, icon, context); } - public final static Icon _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Icon _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,56 +70,56 @@ public final static Icon _read(final XoXMLStreamReader reader, RuntimeContext co context = new RuntimeContext(); } - final Icon icon = new Icon(); + Icon icon = new Icon(); context.beforeUnmarshal(icon, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("iconType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("iconType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Icon.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, icon); icon.id = id; - } else if (("lang" == attribute.getLocalName()) && ("http://www.w3.org/XML/1998/namespace" == attribute.getNamespace())) { + } else if (("lang" == attribute.getLocalName())&&("http://www.w3.org/XML/1998/namespace" == attribute.getNamespace())) { // ATTRIBUTE: lang icon.lang = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("http://www.w3.org/XML/1998/namespace", "lang")); } } // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("small-icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("small-icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: smallIcon - final String smallIconRaw = elementReader.getElementAsString(); + String smallIconRaw = elementReader.getElementText(); - final String smallIcon; + String smallIcon; try { smallIcon = Adapters.collapsedStringAdapterAdapter.unmarshal(smallIconRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } icon.smallIcon = smallIcon; - } else if (("large-icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("large-icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: largeIcon - final String largeIconRaw = elementReader.getElementAsString(); + String largeIconRaw = elementReader.getElementText(); - final String largeIcon; + String largeIcon; try { largeIcon = Adapters.collapsedStringAdapterAdapter.unmarshal(largeIconRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -130,78 +135,80 @@ public final static Icon _read(final XoXMLStreamReader reader, RuntimeContext co return icon; } - public final Icon read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Icon read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Icon icon, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Icon icon, RuntimeContext context) + throws Exception + { if (icon == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Icon.class != icon.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Icon.class!= icon.getClass()) { context.unexpectedSubclass(writer, icon, Icon.class); - return; + return ; } context.beforeMarshal(icon, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = icon.id; - if (idRaw != null) { + String idRaw = icon.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(icon, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: lang - final String langRaw = icon.lang; - if (langRaw != null) { + String langRaw = icon.lang; + if (langRaw!= null) { String lang = null; try { lang = Adapters.collapsedStringAdapterAdapter.marshal(langRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(icon, "lang", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("xml", "http://www.w3.org/XML/1998/namespace", "lang", lang); } // ELEMENT: smallIcon - final String smallIconRaw = icon.smallIcon; + String smallIconRaw = icon.smallIcon; String smallIcon = null; try { smallIcon = Adapters.collapsedStringAdapterAdapter.marshal(smallIconRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(icon, "smallIcon", CollapsedStringAdapter.class, String.class, String.class, e); } - if (smallIcon != null) { + if (smallIcon!= null) { writer.writeStartElement(prefix, "small-icon", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(smallIcon); writer.writeEndElement(); } // ELEMENT: largeIcon - final String largeIconRaw = icon.largeIcon; + String largeIconRaw = icon.largeIcon; String largeIcon = null; try { largeIcon = Adapters.collapsedStringAdapterAdapter.marshal(largeIconRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(icon, "largeIcon", CollapsedStringAdapter.class, String.class, String.class, e); } - if (largeIcon != null) { + if (largeIcon!= null) { writer.writeStartElement(prefix, "large-icon", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(largeIcon); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InboundResourceadapter$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InboundResourceadapter$JAXB.java index 7f8f6e856e9..cdb49a5e5e5 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InboundResourceadapter$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InboundResourceadapter$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.MessageAdapter$JAXB.readMessageAdapter; import static org.apache.openejb.jee.MessageAdapter$JAXB.writeMessageAdapter; @@ -34,30 +35,35 @@ "StringEquality" }) public class InboundResourceadapter$JAXB - extends JAXBObject { + extends JAXBObject +{ public InboundResourceadapter$JAXB() { super(InboundResourceadapter.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "inbound-resourceadapterType".intern()), MessageAdapter$JAXB.class); } - public static InboundResourceadapter readInboundResourceadapter(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static InboundResourceadapter readInboundResourceadapter(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeInboundResourceadapter(final XoXMLStreamWriter writer, final InboundResourceadapter inboundResourceadapter, final RuntimeContext context) - throws Exception { + public static void writeInboundResourceadapter(XoXMLStreamWriter writer, InboundResourceadapter inboundResourceadapter, RuntimeContext context) + throws Exception + { _write(writer, inboundResourceadapter, context); } - public void write(final XoXMLStreamWriter writer, final InboundResourceadapter inboundResourceadapter, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, InboundResourceadapter inboundResourceadapter, RuntimeContext context) + throws Exception + { _write(writer, inboundResourceadapter, context); } - public final static InboundResourceadapter _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final InboundResourceadapter _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -68,35 +74,35 @@ public final static InboundResourceadapter _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final InboundResourceadapter inboundResourceadapter = new InboundResourceadapter(); + InboundResourceadapter inboundResourceadapter = new InboundResourceadapter(); context.beforeUnmarshal(inboundResourceadapter, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("inbound-resourceadapterType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("inbound-resourceadapterType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, InboundResourceadapter.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, inboundResourceadapter); inboundResourceadapter.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("messageadapter" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("messageadapter" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageAdapter - final MessageAdapter messageAdapter = readMessageAdapter(elementReader, context); + MessageAdapter messageAdapter = readMessageAdapter(elementReader, context); inboundResourceadapter.messageAdapter = messageAdapter; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "messageadapter")); @@ -108,45 +114,47 @@ public final static InboundResourceadapter _read(final XoXMLStreamReader reader, return inboundResourceadapter; } - public final InboundResourceadapter read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final InboundResourceadapter read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final InboundResourceadapter inboundResourceadapter, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, InboundResourceadapter inboundResourceadapter, RuntimeContext context) + throws Exception + { if (inboundResourceadapter == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (InboundResourceadapter.class != inboundResourceadapter.getClass()) { + if (InboundResourceadapter.class!= inboundResourceadapter.getClass()) { context.unexpectedSubclass(writer, inboundResourceadapter, InboundResourceadapter.class); - return; + return ; } context.beforeMarshal(inboundResourceadapter, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = inboundResourceadapter.id; - if (idRaw != null) { + String idRaw = inboundResourceadapter.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(inboundResourceadapter, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: messageAdapter - final MessageAdapter messageAdapter = inboundResourceadapter.messageAdapter; - if (messageAdapter != null) { + MessageAdapter messageAdapter = inboundResourceadapter.messageAdapter; + if (messageAdapter!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "messageadapter"); writeMessageAdapter(writer, messageAdapter, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InitMethod$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InitMethod$JAXB.java index 5e4e1b136fd..82e877fc88c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InitMethod$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InitMethod$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.NamedMethod$JAXB.readNamedMethod; import static org.apache.openejb.jee.NamedMethod$JAXB.writeNamedMethod; @@ -34,30 +35,35 @@ "StringEquality" }) public class InitMethod$JAXB - extends JAXBObject { + extends JAXBObject +{ public InitMethod$JAXB() { super(InitMethod.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "init-methodType".intern()), NamedMethod$JAXB.class); } - public static InitMethod readInitMethod(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static InitMethod readInitMethod(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeInitMethod(final XoXMLStreamWriter writer, final InitMethod initMethod, final RuntimeContext context) - throws Exception { + public static void writeInitMethod(XoXMLStreamWriter writer, InitMethod initMethod, RuntimeContext context) + throws Exception + { _write(writer, initMethod, context); } - public void write(final XoXMLStreamWriter writer, final InitMethod initMethod, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, InitMethod initMethod, RuntimeContext context) + throws Exception + { _write(writer, initMethod, context); } - public final static InitMethod _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final InitMethod _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -68,39 +74,39 @@ public final static InitMethod _read(final XoXMLStreamReader reader, RuntimeCont context = new RuntimeContext(); } - final InitMethod initMethod = new InitMethod(); + InitMethod initMethod = new InitMethod(); context.beforeUnmarshal(initMethod, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("init-methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("init-methodType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, InitMethod.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, initMethod); initMethod.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("create-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("create-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: createMethod - final NamedMethod createMethod = readNamedMethod(elementReader, context); + NamedMethod createMethod = readNamedMethod(elementReader, context); initMethod.createMethod = createMethod; - } else if (("bean-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("bean-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: beanMethod - final NamedMethod beanMethod = readNamedMethod(elementReader, context); + NamedMethod beanMethod = readNamedMethod(elementReader, context); initMethod.beanMethod = beanMethod; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "create-method"), new QName("http://java.sun.com/xml/ns/javaee", "bean-method")); @@ -112,46 +118,48 @@ public final static InitMethod _read(final XoXMLStreamReader reader, RuntimeCont return initMethod; } - public final InitMethod read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final InitMethod read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final InitMethod initMethod, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, InitMethod initMethod, RuntimeContext context) + throws Exception + { if (initMethod == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (InitMethod.class != initMethod.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (InitMethod.class!= initMethod.getClass()) { context.unexpectedSubclass(writer, initMethod, InitMethod.class); - return; + return ; } context.beforeMarshal(initMethod, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = initMethod.id; - if (idRaw != null) { + String idRaw = initMethod.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(initMethod, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: createMethod - final NamedMethod createMethod = initMethod.createMethod; - if (createMethod != null) { + NamedMethod createMethod = initMethod.createMethod; + if (createMethod!= null) { writer.writeStartElement(prefix, "create-method", "http://java.sun.com/xml/ns/javaee"); writeNamedMethod(writer, createMethod, context); writer.writeEndElement(); @@ -160,8 +168,8 @@ public final static void _write(final XoXMLStreamWriter writer, final InitMethod } // ELEMENT: beanMethod - final NamedMethod beanMethod = initMethod.beanMethod; - if (beanMethod != null) { + NamedMethod beanMethod = initMethod.beanMethod; + if (beanMethod!= null) { writer.writeStartElement(prefix, "bean-method", "http://java.sun.com/xml/ns/javaee"); writeNamedMethod(writer, beanMethod, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InjectionTarget$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InjectionTarget$JAXB.java index c825a7ee2e3..4f907cfd2d7 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InjectionTarget$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InjectionTarget$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class InjectionTarget$JAXB - extends JAXBObject { + extends JAXBObject +{ public InjectionTarget$JAXB() { super(InjectionTarget.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "injection-targetType".intern())); } - public static InjectionTarget readInjectionTarget(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static InjectionTarget readInjectionTarget(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeInjectionTarget(final XoXMLStreamWriter writer, final InjectionTarget injectionTarget, final RuntimeContext context) - throws Exception { + public static void writeInjectionTarget(XoXMLStreamWriter writer, InjectionTarget injectionTarget, RuntimeContext context) + throws Exception + { _write(writer, injectionTarget, context); } - public void write(final XoXMLStreamWriter writer, final InjectionTarget injectionTarget, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, InjectionTarget injectionTarget, RuntimeContext context) + throws Exception + { _write(writer, injectionTarget, context); } - public final static InjectionTarget _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final InjectionTarget _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,48 +70,48 @@ public final static InjectionTarget _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final InjectionTarget injectionTarget = new InjectionTarget(); + InjectionTarget injectionTarget = new InjectionTarget(); context.beforeUnmarshal(injectionTarget, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("injection-targetType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("injection-targetType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, InjectionTarget.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("injection-target-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("injection-target-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: injectionTargetClass - final String injectionTargetClassRaw = elementReader.getElementAsString(); + String injectionTargetClassRaw = elementReader.getElementText(); - final String injectionTargetClass; + String injectionTargetClass; try { injectionTargetClass = Adapters.collapsedStringAdapterAdapter.unmarshal(injectionTargetClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } injectionTarget.injectionTargetClass = injectionTargetClass; - } else if (("injection-target-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("injection-target-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: injectionTargetName - final String injectionTargetNameRaw = elementReader.getElementAsString(); + String injectionTargetNameRaw = elementReader.getElementText(); - final String injectionTargetName; + String injectionTargetName; try { injectionTargetName = Adapters.collapsedStringAdapterAdapter.unmarshal(injectionTargetNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -122,40 +127,42 @@ public final static InjectionTarget _read(final XoXMLStreamReader reader, Runtim return injectionTarget; } - public final InjectionTarget read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final InjectionTarget read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final InjectionTarget injectionTarget, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, InjectionTarget injectionTarget, RuntimeContext context) + throws Exception + { if (injectionTarget == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (InjectionTarget.class != injectionTarget.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (InjectionTarget.class!= injectionTarget.getClass()) { context.unexpectedSubclass(writer, injectionTarget, InjectionTarget.class); - return; + return ; } context.beforeMarshal(injectionTarget, LifecycleCallback.NONE); // ELEMENT: injectionTargetClass - final String injectionTargetClassRaw = injectionTarget.injectionTargetClass; + String injectionTargetClassRaw = injectionTarget.injectionTargetClass; String injectionTargetClass = null; try { injectionTargetClass = Adapters.collapsedStringAdapterAdapter.marshal(injectionTargetClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(injectionTarget, "injectionTargetClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (injectionTargetClass != null) { + if (injectionTargetClass!= null) { writer.writeStartElement(prefix, "injection-target-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(injectionTargetClass); writer.writeEndElement(); @@ -164,14 +171,14 @@ public final static void _write(final XoXMLStreamWriter writer, final InjectionT } // ELEMENT: injectionTargetName - final String injectionTargetNameRaw = injectionTarget.injectionTargetName; + String injectionTargetNameRaw = injectionTarget.injectionTargetName; String injectionTargetName = null; try { injectionTargetName = Adapters.collapsedStringAdapterAdapter.marshal(injectionTargetNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(injectionTarget, "injectionTargetName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (injectionTargetName != null) { + if (injectionTargetName!= null) { writer.writeStartElement(prefix, "injection-target-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(injectionTargetName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptor$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptor$JAXB.java index d457586aebb..7ab0143ab76 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptor$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptor$JAXB.java @@ -1,37 +1,41 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.AroundInvoke$JAXB.readAroundInvoke; import static org.apache.openejb.jee.AroundInvoke$JAXB.writeAroundInvoke; import static org.apache.openejb.jee.AroundTimeout$JAXB.readAroundTimeout; import static org.apache.openejb.jee.AroundTimeout$JAXB.writeAroundTimeout; +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; @@ -40,6 +44,10 @@ import static org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef; import static org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry; import static org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback; import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef; @@ -61,30 +69,36 @@ "StringEquality" }) public class Interceptor$JAXB - extends JAXBObject { + extends JAXBObject +{ + private static final FieldAccessor> interceptorContextService = new FieldAccessor<>(Interceptor.class, "contextService"); public Interceptor$JAXB() { - super(Interceptor.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "interceptorType".intern()), Text$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class); + super(Interceptor.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "interceptorType".intern()), Text$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, ContextService$JAXB.class); } - public static Interceptor readInterceptor(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Interceptor readInterceptor(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeInterceptor(final XoXMLStreamWriter writer, final Interceptor interceptor, final RuntimeContext context) - throws Exception { + public static void writeInterceptor(XoXMLStreamWriter writer, Interceptor interceptor, RuntimeContext context) + throws Exception + { _write(writer, interceptor, context); } - public void write(final XoXMLStreamWriter writer, final Interceptor interceptor, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Interceptor interceptor, RuntimeContext context) + throws Exception + { _write(writer, interceptor, context); } - public final static Interceptor _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Interceptor _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -95,7 +109,7 @@ public final static Interceptor _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final Interceptor interceptor = new Interceptor(); + Interceptor interceptor = new Interceptor(); context.beforeUnmarshal(interceptor, org.metatype.sxc.jaxb.LifecycleCallback.NONE); ArrayList descriptions = null; @@ -110,391 +124,457 @@ public final static Interceptor _read(final XoXMLStreamReader reader, RuntimeCon KeyedCollection messageDestinationRef = null; KeyedCollection persistenceContextRef = null; KeyedCollection persistenceUnitRef = null; + List aroundConstruct = null; List postConstruct = null; List preDestroy = null; KeyedCollection dataSource = null; + KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; List postActivate = null; List prePassivate = null; List afterBegin = null; List beforeCompletion = null; List afterCompletion = null; + KeyedCollection contextService = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("interceptorType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("interceptorType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Interceptor.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, interceptor); interceptor.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("interceptor-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("interceptor-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: interceptorClass - final String interceptorClassRaw = elementReader.getElementAsString(); + String interceptorClassRaw = elementReader.getElementText(); - final String interceptorClass; + String interceptorClass; try { interceptorClass = Adapters.collapsedStringAdapterAdapter.unmarshal(interceptorClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } interceptor.interceptorClass = interceptorClass; - } else if (("around-invoke" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("around-invoke" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: aroundInvoke - final AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context); + AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context); if (aroundInvoke == null) { aroundInvoke = interceptor.aroundInvoke; - if (aroundInvoke != null) { + if (aroundInvoke!= null) { aroundInvoke.clear(); } else { - aroundInvoke = new ArrayList(); + aroundInvoke = new ArrayList<>(); } } aroundInvoke.add(aroundInvokeItem); - } else if (("around-timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("around-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: aroundTimeout - final AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context); + AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context); if (aroundTimeout == null) { aroundTimeout = interceptor.aroundTimeout; - if (aroundTimeout != null) { + if (aroundTimeout!= null) { aroundTimeout.clear(); } else { - aroundTimeout = new ArrayList(); + aroundTimeout = new ArrayList<>(); } } aroundTimeout.add(aroundTimeoutItem); - } else if (("env-entry" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: envEntry - final EnvEntry envEntryItem = readEnvEntry(elementReader, context); + EnvEntry envEntryItem = readEnvEntry(elementReader, context); if (envEntry == null) { envEntry = interceptor.envEntry; - if (envEntry != null) { + if (envEntry!= null) { envEntry.clear(); } else { - envEntry = new KeyedCollection(); + envEntry = new KeyedCollection<>(); } } envEntry.add(envEntryItem); - } else if (("ejb-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRef - final EjbRef ejbRefItem = readEjbRef(elementReader, context); + EjbRef ejbRefItem = readEjbRef(elementReader, context); if (ejbRef == null) { ejbRef = interceptor.ejbRef; - if (ejbRef != null) { + if (ejbRef!= null) { ejbRef.clear(); } else { - ejbRef = new KeyedCollection(); + ejbRef = new KeyedCollection<>(); } } ejbRef.add(ejbRefItem); - } else if (("ejb-local-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbLocalRef - final EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); if (ejbLocalRef == null) { ejbLocalRef = interceptor.ejbLocalRef; - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { ejbLocalRef.clear(); } else { - ejbLocalRef = new KeyedCollection(); + ejbLocalRef = new KeyedCollection<>(); } } ejbLocalRef.add(ejbLocalRefItem); - } else if (("service-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceRef - final ServiceRef serviceRefItem = readServiceRef(elementReader, context); + ServiceRef serviceRefItem = readServiceRef(elementReader, context); if (serviceRef == null) { serviceRef = interceptor.serviceRef; - if (serviceRef != null) { + if (serviceRef!= null) { serviceRef.clear(); } else { - serviceRef = new KeyedCollection(); + serviceRef = new KeyedCollection<>(); } } serviceRef.add(serviceRefItem); - } else if (("resource-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceRef - final ResourceRef resourceRefItem = readResourceRef(elementReader, context); + ResourceRef resourceRefItem = readResourceRef(elementReader, context); if (resourceRef == null) { resourceRef = interceptor.resourceRef; - if (resourceRef != null) { + if (resourceRef!= null) { resourceRef.clear(); } else { - resourceRef = new KeyedCollection(); + resourceRef = new KeyedCollection<>(); } } resourceRef.add(resourceRefItem); - } else if (("resource-env-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceEnvRef - final ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); if (resourceEnvRef == null) { resourceEnvRef = interceptor.resourceEnvRef; - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { resourceEnvRef.clear(); } else { - resourceEnvRef = new KeyedCollection(); + resourceEnvRef = new KeyedCollection<>(); } } resourceEnvRef.add(resourceEnvRefItem); - } else if (("message-destination-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationRef - final MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); if (messageDestinationRef == null) { messageDestinationRef = interceptor.messageDestinationRef; - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { messageDestinationRef.clear(); } else { - messageDestinationRef = new KeyedCollection(); + messageDestinationRef = new KeyedCollection<>(); } } messageDestinationRef.add(messageDestinationRefItem); - } else if (("persistence-context-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceContextRef - final PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); if (persistenceContextRef == null) { persistenceContextRef = interceptor.persistenceContextRef; - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { persistenceContextRef.clear(); } else { - persistenceContextRef = new KeyedCollection(); + persistenceContextRef = new KeyedCollection<>(); } } persistenceContextRef.add(persistenceContextRefItem); - } else if (("persistence-unit-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceUnitRef - final PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); if (persistenceUnitRef == null) { persistenceUnitRef = interceptor.persistenceUnitRef; - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { persistenceUnitRef.clear(); } else { - persistenceUnitRef = new KeyedCollection(); + persistenceUnitRef = new KeyedCollection<>(); } } persistenceUnitRef.add(persistenceUnitRefItem); - } else if (("post-construct" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("around-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: aroundConstruct + org.apache.openejb.jee.LifecycleCallback aroundConstructItem = readLifecycleCallback(elementReader, context); + if (aroundConstruct == null) { + aroundConstruct = interceptor.aroundConstruct; + if (aroundConstruct!= null) { + aroundConstruct.clear(); + } else { + aroundConstruct = new ArrayList<>(); + } + } + aroundConstruct.add(aroundConstructItem); + } else if (("post-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: postConstruct - final org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); if (postConstruct == null) { postConstruct = interceptor.postConstruct; - if (postConstruct != null) { + if (postConstruct!= null) { postConstruct.clear(); } else { - postConstruct = new ArrayList(); + postConstruct = new ArrayList<>(); } } postConstruct.add(postConstructItem); - } else if (("pre-destroy" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("pre-destroy" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: preDestroy - final org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); if (preDestroy == null) { preDestroy = interceptor.preDestroy; - if (preDestroy != null) { + if (preDestroy!= null) { preDestroy.clear(); } else { - preDestroy = new ArrayList(); + preDestroy = new ArrayList<>(); } } preDestroy.add(preDestroyItem); - } else if (("data-source" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dataSource - final DataSource dataSourceItem = readDataSource(elementReader, context); + DataSource dataSourceItem = readDataSource(elementReader, context); if (dataSource == null) { dataSource = interceptor.dataSource; - if (dataSource != null) { + if (dataSource!= null) { dataSource.clear(); } else { - dataSource = new KeyedCollection(); + dataSource = new KeyedCollection<>(); } } dataSource.add(dataSourceItem); - } else if (("post-activate" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); + if (jmsConnectionFactories == null) { + jmsConnectionFactories = interceptor.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + jmsConnectionFactories.clear(); + } else { + jmsConnectionFactories = new KeyedCollection<>(); + } + } + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = interceptor.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("post-activate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: postActivate - final org.apache.openejb.jee.LifecycleCallback postActivateItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback postActivateItem = readLifecycleCallback(elementReader, context); if (postActivate == null) { postActivate = interceptor.postActivate; - if (postActivate != null) { + if (postActivate!= null) { postActivate.clear(); } else { - postActivate = new ArrayList(); + postActivate = new ArrayList<>(); } } postActivate.add(postActivateItem); - } else if (("pre-passivate" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("pre-passivate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: prePassivate - final org.apache.openejb.jee.LifecycleCallback prePassivateItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback prePassivateItem = readLifecycleCallback(elementReader, context); if (prePassivate == null) { prePassivate = interceptor.prePassivate; - if (prePassivate != null) { + if (prePassivate!= null) { prePassivate.clear(); } else { - prePassivate = new ArrayList(); + prePassivate = new ArrayList<>(); } } prePassivate.add(prePassivateItem); - } else if (("after-begin" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("after-begin" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: afterBegin - final org.apache.openejb.jee.LifecycleCallback afterBeginItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback afterBeginItem = readLifecycleCallback(elementReader, context); if (afterBegin == null) { afterBegin = interceptor.afterBegin; - if (afterBegin != null) { + if (afterBegin!= null) { afterBegin.clear(); } else { - afterBegin = new ArrayList(); + afterBegin = new ArrayList<>(); } } afterBegin.add(afterBeginItem); - } else if (("before-completion" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("before-completion" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: beforeCompletion - final org.apache.openejb.jee.LifecycleCallback beforeCompletionItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback beforeCompletionItem = readLifecycleCallback(elementReader, context); if (beforeCompletion == null) { beforeCompletion = interceptor.beforeCompletion; - if (beforeCompletion != null) { + if (beforeCompletion!= null) { beforeCompletion.clear(); } else { - beforeCompletion = new ArrayList(); + beforeCompletion = new ArrayList<>(); } } beforeCompletion.add(beforeCompletionItem); - } else if (("after-completion" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("after-completion" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: afterCompletion - final org.apache.openejb.jee.LifecycleCallback afterCompletionItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback afterCompletionItem = readLifecycleCallback(elementReader, context); if (afterCompletion == null) { afterCompletion = interceptor.afterCompletion; - if (afterCompletion != null) { + if (afterCompletion!= null) { afterCompletion.clear(); } else { - afterCompletion = new ArrayList(); + afterCompletion = new ArrayList<>(); } } afterCompletion.add(afterCompletionItem); + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = interceptorContextService.getObject(reader, context, interceptor); + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } + } + contextService.add(contextServiceItem); } else { - context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "interceptor-class"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "post-activate"), new QName("http://java.sun.com/xml/ns/javaee", "pre-passivate"), new QName("http://java.sun.com/xml/ns/javaee", "after-begin"), new QName("http://java.sun.com/xml/ns/javaee", "before-completion"), new QName("http://java.sun.com/xml/ns/javaee", "after-completion")); + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "interceptor-class"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), 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", "around-construct"), new QName("http://java.sun.com/xml/ns/javaee", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "post-activate"), new QName("http://java.sun.com/xml/ns/javaee", "pre-passivate"), new QName("http://java.sun.com/xml/ns/javaee", "after-begin"), new QName("http://java.sun.com/xml/ns/javaee", "before-completion"), new QName("http://java.sun.com/xml/ns/javaee", "after-completion"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - interceptor.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + interceptor.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Interceptor.class, "setDescriptions", Text[].class, e); } } - if (aroundInvoke != null) { + if (aroundInvoke!= null) { interceptor.aroundInvoke = aroundInvoke; } - if (aroundTimeout != null) { + if (aroundTimeout!= null) { interceptor.aroundTimeout = aroundTimeout; } - if (envEntry != null) { + if (envEntry!= null) { interceptor.envEntry = envEntry; } - if (ejbRef != null) { + if (ejbRef!= null) { interceptor.ejbRef = ejbRef; } - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { interceptor.ejbLocalRef = ejbLocalRef; } - if (serviceRef != null) { + if (serviceRef!= null) { interceptor.serviceRef = serviceRef; } - if (resourceRef != null) { + if (resourceRef!= null) { interceptor.resourceRef = resourceRef; } - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { interceptor.resourceEnvRef = resourceEnvRef; } - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { interceptor.messageDestinationRef = messageDestinationRef; } - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { interceptor.persistenceContextRef = persistenceContextRef; } - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { interceptor.persistenceUnitRef = persistenceUnitRef; } - if (postConstruct != null) { + if (aroundConstruct!= null) { + interceptor.aroundConstruct = aroundConstruct; + } + if (postConstruct!= null) { interceptor.postConstruct = postConstruct; } - if (preDestroy != null) { + if (preDestroy!= null) { interceptor.preDestroy = preDestroy; } - if (dataSource != null) { + if (dataSource!= null) { interceptor.dataSource = dataSource; } - if (postActivate != null) { + if (jmsConnectionFactories!= null) { + interceptor.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + interceptor.jmsDestinations = jmsDestinations; + } + if (postActivate!= null) { interceptor.postActivate = postActivate; } - if (prePassivate != null) { + if (prePassivate!= null) { interceptor.prePassivate = prePassivate; } - if (afterBegin != null) { + if (afterBegin!= null) { interceptor.afterBegin = afterBegin; } - if (beforeCompletion != null) { + if (beforeCompletion!= null) { interceptor.beforeCompletion = beforeCompletion; } - if (afterCompletion != null) { + if (afterCompletion!= null) { interceptor.afterCompletion = afterCompletion; } + if (contextService!= null) { + interceptorContextService.setObject(reader, context, interceptor, contextService); + } context.afterUnmarshal(interceptor, org.metatype.sxc.jaxb.LifecycleCallback.NONE); return interceptor; } - public final Interceptor read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Interceptor read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Interceptor interceptor, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Interceptor interceptor, RuntimeContext context) + throws Exception + { if (interceptor == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Interceptor.class != interceptor.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Interceptor.class!= interceptor.getClass()) { context.unexpectedSubclass(writer, interceptor, Interceptor.class); - return; + return ; } context.beforeMarshal(interceptor, org.metatype.sxc.jaxb.LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = interceptor.id; - if (idRaw != null) { + String idRaw = interceptor.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(interceptor, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -504,12 +584,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto Text[] descriptions = null; try { descriptions = interceptor.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(interceptor, "descriptions", Interceptor.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -520,14 +600,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: interceptorClass - final String interceptorClassRaw = interceptor.interceptorClass; + String interceptorClassRaw = interceptor.interceptorClass; String interceptorClass = null; try { interceptorClass = Adapters.collapsedStringAdapterAdapter.marshal(interceptorClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(interceptor, "interceptorClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (interceptorClass != null) { + if (interceptorClass!= null) { writer.writeStartElement(prefix, "interceptor-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(interceptorClass); writer.writeEndElement(); @@ -536,10 +616,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: aroundInvoke - final List aroundInvoke = interceptor.aroundInvoke; - if (aroundInvoke != null) { - for (final AroundInvoke aroundInvokeItem : aroundInvoke) { - if (aroundInvokeItem != null) { + List aroundInvoke = interceptor.aroundInvoke; + if (aroundInvoke!= null) { + for (AroundInvoke aroundInvokeItem: aroundInvoke) { + if (aroundInvokeItem!= null) { writer.writeStartElement(prefix, "around-invoke", "http://java.sun.com/xml/ns/javaee"); writeAroundInvoke(writer, aroundInvokeItem, context); writer.writeEndElement(); @@ -550,10 +630,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: aroundTimeout - final List aroundTimeout = interceptor.aroundTimeout; - if (aroundTimeout != null) { - for (final AroundTimeout aroundTimeoutItem : aroundTimeout) { - if (aroundTimeoutItem != null) { + List aroundTimeout = interceptor.aroundTimeout; + if (aroundTimeout!= null) { + for (AroundTimeout aroundTimeoutItem: aroundTimeout) { + if (aroundTimeoutItem!= null) { writer.writeStartElement(prefix, "around-timeout", "http://java.sun.com/xml/ns/javaee"); writeAroundTimeout(writer, aroundTimeoutItem, context); writer.writeEndElement(); @@ -562,10 +642,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: envEntry - final KeyedCollection envEntry = interceptor.envEntry; - if (envEntry != null) { - for (final EnvEntry envEntryItem : envEntry) { - if (envEntryItem != null) { + KeyedCollection envEntry = interceptor.envEntry; + if (envEntry!= null) { + for (EnvEntry envEntryItem: envEntry) { + if (envEntryItem!= null) { writer.writeStartElement(prefix, "env-entry", "http://java.sun.com/xml/ns/javaee"); writeEnvEntry(writer, envEntryItem, context); writer.writeEndElement(); @@ -576,10 +656,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: ejbRef - final KeyedCollection ejbRef = interceptor.ejbRef; - if (ejbRef != null) { - for (final EjbRef ejbRefItem : ejbRef) { - if (ejbRefItem != null) { + KeyedCollection ejbRef = interceptor.ejbRef; + if (ejbRef!= null) { + for (EjbRef ejbRefItem: ejbRef) { + if (ejbRefItem!= null) { writer.writeStartElement(prefix, "ejb-ref", "http://java.sun.com/xml/ns/javaee"); writeEjbRef(writer, ejbRefItem, context); writer.writeEndElement(); @@ -590,10 +670,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: ejbLocalRef - final KeyedCollection ejbLocalRef = interceptor.ejbLocalRef; - if (ejbLocalRef != null) { - for (final EjbLocalRef ejbLocalRefItem : ejbLocalRef) { - if (ejbLocalRefItem != null) { + KeyedCollection ejbLocalRef = interceptor.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(); @@ -604,10 +684,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: serviceRef - final KeyedCollection serviceRef = interceptor.serviceRef; - if (serviceRef != null) { - for (final ServiceRef serviceRefItem : serviceRef) { - if (serviceRefItem != null) { + KeyedCollection serviceRef = interceptor.serviceRef; + if (serviceRef!= null) { + for (ServiceRef serviceRefItem: serviceRef) { + if (serviceRefItem!= null) { writer.writeStartElement(prefix, "service-ref", "http://java.sun.com/xml/ns/javaee"); writeServiceRef(writer, serviceRefItem, context); writer.writeEndElement(); @@ -618,10 +698,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: resourceRef - final KeyedCollection resourceRef = interceptor.resourceRef; - if (resourceRef != null) { - for (final ResourceRef resourceRefItem : resourceRef) { - if (resourceRefItem != null) { + KeyedCollection resourceRef = interceptor.resourceRef; + if (resourceRef!= null) { + for (ResourceRef resourceRefItem: resourceRef) { + if (resourceRefItem!= null) { writer.writeStartElement(prefix, "resource-ref", "http://java.sun.com/xml/ns/javaee"); writeResourceRef(writer, resourceRefItem, context); writer.writeEndElement(); @@ -632,10 +712,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: resourceEnvRef - final KeyedCollection resourceEnvRef = interceptor.resourceEnvRef; - if (resourceEnvRef != null) { - for (final ResourceEnvRef resourceEnvRefItem : resourceEnvRef) { - if (resourceEnvRefItem != null) { + KeyedCollection resourceEnvRef = interceptor.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(); @@ -646,10 +726,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: messageDestinationRef - final KeyedCollection messageDestinationRef = interceptor.messageDestinationRef; - if (messageDestinationRef != null) { - for (final MessageDestinationRef messageDestinationRefItem : messageDestinationRef) { - if (messageDestinationRefItem != null) { + KeyedCollection messageDestinationRef = interceptor.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(); @@ -660,10 +740,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: persistenceContextRef - final KeyedCollection persistenceContextRef = interceptor.persistenceContextRef; - if (persistenceContextRef != null) { - for (final PersistenceContextRef persistenceContextRefItem : persistenceContextRef) { - if (persistenceContextRefItem != null) { + KeyedCollection persistenceContextRef = interceptor.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(); @@ -674,10 +754,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: persistenceUnitRef - final KeyedCollection persistenceUnitRef = interceptor.persistenceUnitRef; - if (persistenceUnitRef != null) { - for (final PersistenceUnitRef persistenceUnitRefItem : persistenceUnitRef) { - if (persistenceUnitRefItem != null) { + KeyedCollection persistenceUnitRef = interceptor.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(); @@ -687,11 +767,25 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } } + // ELEMENT: aroundConstruct + List aroundConstruct = interceptor.aroundConstruct; + if (aroundConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback aroundConstructItem: aroundConstruct) { + if (aroundConstructItem!= null) { + writer.writeStartElement(prefix, "around-construct", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, aroundConstructItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(interceptor, "aroundConstruct"); + } + } + } + // ELEMENT: postConstruct - final List postConstruct = interceptor.postConstruct; - if (postConstruct != null) { - for (final org.apache.openejb.jee.LifecycleCallback postConstructItem : postConstruct) { - if (postConstructItem != null) { + List postConstruct = interceptor.postConstruct; + if (postConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback postConstructItem: postConstruct) { + if (postConstructItem!= null) { writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, postConstructItem, context); writer.writeEndElement(); @@ -702,10 +796,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: preDestroy - final List preDestroy = interceptor.preDestroy; - if (preDestroy != null) { - for (final org.apache.openejb.jee.LifecycleCallback preDestroyItem : preDestroy) { - if (preDestroyItem != null) { + List preDestroy = interceptor.preDestroy; + if (preDestroy!= null) { + for (org.apache.openejb.jee.LifecycleCallback preDestroyItem: preDestroy) { + if (preDestroyItem!= null) { writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, preDestroyItem, context); writer.writeEndElement(); @@ -716,10 +810,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: dataSource - final KeyedCollection dataSource = interceptor.dataSource; - if (dataSource != null) { - for (final DataSource dataSourceItem : dataSource) { - if (dataSourceItem != null) { + KeyedCollection dataSource = interceptor.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); writeDataSource(writer, dataSourceItem, context); writer.writeEndElement(); @@ -729,11 +823,37 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } } + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = interceptor.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(interceptor, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = interceptor.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + // ELEMENT: postActivate - final List postActivate = interceptor.postActivate; - if (postActivate != null) { - for (final org.apache.openejb.jee.LifecycleCallback postActivateItem : postActivate) { - if (postActivateItem != null) { + List postActivate = interceptor.postActivate; + if (postActivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback postActivateItem: postActivate) { + if (postActivateItem!= null) { writer.writeStartElement(prefix, "post-activate", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, postActivateItem, context); writer.writeEndElement(); @@ -744,10 +864,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: prePassivate - final List prePassivate = interceptor.prePassivate; - if (prePassivate != null) { - for (final org.apache.openejb.jee.LifecycleCallback prePassivateItem : prePassivate) { - if (prePassivateItem != null) { + List prePassivate = interceptor.prePassivate; + if (prePassivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback prePassivateItem: prePassivate) { + if (prePassivateItem!= null) { writer.writeStartElement(prefix, "pre-passivate", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, prePassivateItem, context); writer.writeEndElement(); @@ -758,10 +878,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: afterBegin - final List afterBegin = interceptor.afterBegin; - if (afterBegin != null) { - for (final org.apache.openejb.jee.LifecycleCallback afterBeginItem : afterBegin) { - if (afterBeginItem != null) { + List afterBegin = interceptor.afterBegin; + if (afterBegin!= null) { + for (org.apache.openejb.jee.LifecycleCallback afterBeginItem: afterBegin) { + if (afterBeginItem!= null) { writer.writeStartElement(prefix, "after-begin", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, afterBeginItem, context); writer.writeEndElement(); @@ -772,10 +892,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: beforeCompletion - final List beforeCompletion = interceptor.beforeCompletion; - if (beforeCompletion != null) { - for (final org.apache.openejb.jee.LifecycleCallback beforeCompletionItem : beforeCompletion) { - if (beforeCompletionItem != null) { + List beforeCompletion = interceptor.beforeCompletion; + if (beforeCompletion!= null) { + for (org.apache.openejb.jee.LifecycleCallback beforeCompletionItem: beforeCompletion) { + if (beforeCompletionItem!= null) { writer.writeStartElement(prefix, "before-completion", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, beforeCompletionItem, context); writer.writeEndElement(); @@ -786,10 +906,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: afterCompletion - final List afterCompletion = interceptor.afterCompletion; - if (afterCompletion != null) { - for (final org.apache.openejb.jee.LifecycleCallback afterCompletionItem : afterCompletion) { - if (afterCompletionItem != null) { + List afterCompletion = interceptor.afterCompletion; + if (afterCompletion!= null) { + for (org.apache.openejb.jee.LifecycleCallback afterCompletionItem: afterCompletion) { + if (afterCompletionItem!= null) { writer.writeStartElement(prefix, "after-completion", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, afterCompletionItem, context); writer.writeEndElement(); @@ -799,6 +919,18 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } } + // ELEMENT: contextService + KeyedCollection contextService = interceptorContextService.getObject(interceptor, context, interceptor); + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + context.afterMarshal(interceptor, org.metatype.sxc.jaxb.LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InterceptorBinding$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InterceptorBinding$JAXB.java index 58ec4368d6a..0b582439d25 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InterceptorBinding$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InterceptorBinding$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.InterceptorOrder$JAXB.readInterceptorOrder; import static org.apache.openejb.jee.InterceptorOrder$JAXB.writeInterceptorOrder; @@ -40,30 +41,35 @@ "StringEquality" }) public class InterceptorBinding$JAXB - extends JAXBObject { + extends JAXBObject +{ public InterceptorBinding$JAXB() { super(InterceptorBinding.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "interceptor-bindingType".intern()), Text$JAXB.class, InterceptorOrder$JAXB.class, NamedMethod$JAXB.class); } - public static InterceptorBinding readInterceptorBinding(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static InterceptorBinding readInterceptorBinding(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeInterceptorBinding(final XoXMLStreamWriter writer, final InterceptorBinding interceptorBinding, final RuntimeContext context) - throws Exception { + public static void writeInterceptorBinding(XoXMLStreamWriter writer, InterceptorBinding interceptorBinding, RuntimeContext context) + throws Exception + { _write(writer, interceptorBinding, context); } - public void write(final XoXMLStreamWriter writer, final InterceptorBinding interceptorBinding, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, InterceptorBinding interceptorBinding, RuntimeContext context) + throws Exception + { _write(writer, interceptorBinding, context); } - public final static InterceptorBinding _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final InterceptorBinding _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,103 +80,103 @@ public final static InterceptorBinding _read(final XoXMLStreamReader reader, Run context = new RuntimeContext(); } - final InterceptorBinding interceptorBinding = new InterceptorBinding(); + InterceptorBinding interceptorBinding = new InterceptorBinding(); context.beforeUnmarshal(interceptorBinding, LifecycleCallback.NONE); ArrayList descriptions = null; List interceptorClass = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("interceptor-bindingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("interceptor-bindingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, InterceptorBinding.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, interceptorBinding); interceptorBinding.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbName - final String ejbNameRaw = elementReader.getElementAsString(); + String ejbNameRaw = elementReader.getElementText(); - final String ejbName; + String ejbName; try { ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } interceptorBinding.ejbName = ejbName; - } else if (("interceptor-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("interceptor-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: interceptorClass - final String interceptorClassItemRaw = elementReader.getElementAsString(); + String interceptorClassItemRaw = elementReader.getElementText(); - final String interceptorClassItem; + String interceptorClassItem; try { interceptorClassItem = Adapters.collapsedStringAdapterAdapter.unmarshal(interceptorClassItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (interceptorClass == null) { interceptorClass = interceptorBinding.interceptorClass; - if (interceptorClass != null) { + if (interceptorClass!= null) { interceptorClass.clear(); } else { - interceptorClass = new ArrayList(); + interceptorClass = new ArrayList<>(); } } interceptorClass.add(interceptorClassItem); - } else if (("interceptor-order" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("interceptor-order" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: interceptorOrder - final InterceptorOrder interceptorOrder = readInterceptorOrder(elementReader, context); + InterceptorOrder interceptorOrder = readInterceptorOrder(elementReader, context); interceptorBinding.interceptorOrder = interceptorOrder; - } else if (("exclude-default-interceptors" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("exclude-default-interceptors" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: excludeDefaultInterceptors - final Boolean excludeDefaultInterceptors = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean excludeDefaultInterceptors = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); interceptorBinding.excludeDefaultInterceptors = excludeDefaultInterceptors; - } else if (("exclude-class-interceptors" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("exclude-class-interceptors" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: excludeClassInterceptors - final Boolean excludeClassInterceptors = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean excludeClassInterceptors = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); interceptorBinding.excludeClassInterceptors = excludeClassInterceptors; - } else if (("method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: method - final NamedMethod method = readNamedMethod(elementReader, context); + NamedMethod method = readNamedMethod(elementReader, context); interceptorBinding.method = method; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "interceptor-class"), new QName("http://java.sun.com/xml/ns/javaee", "interceptor-order"), new QName("http://java.sun.com/xml/ns/javaee", "exclude-default-interceptors"), new QName("http://java.sun.com/xml/ns/javaee", "exclude-class-interceptors"), new QName("http://java.sun.com/xml/ns/javaee", "method")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - interceptorBinding.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + interceptorBinding.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, InterceptorBinding.class, "setDescriptions", Text[].class, e); } } - if (interceptorClass != null) { + if (interceptorClass!= null) { interceptorBinding.interceptorClass = interceptorClass; } @@ -179,38 +185,40 @@ public final static InterceptorBinding _read(final XoXMLStreamReader reader, Run return interceptorBinding; } - public final InterceptorBinding read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final InterceptorBinding read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final InterceptorBinding interceptorBinding, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, InterceptorBinding interceptorBinding, RuntimeContext context) + throws Exception + { if (interceptorBinding == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (InterceptorBinding.class != interceptorBinding.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (InterceptorBinding.class!= interceptorBinding.getClass()) { context.unexpectedSubclass(writer, interceptorBinding, InterceptorBinding.class); - return; + return ; } context.beforeMarshal(interceptorBinding, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = interceptorBinding.id; - if (idRaw != null) { + String idRaw = interceptorBinding.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(interceptorBinding, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -220,12 +228,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto Text[] descriptions = null; try { descriptions = interceptorBinding.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(interceptorBinding, "descriptions", InterceptorBinding.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -236,14 +244,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: ejbName - final String ejbNameRaw = interceptorBinding.ejbName; + String ejbNameRaw = interceptorBinding.ejbName; String ejbName = null; try { ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(interceptorBinding, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbName != null) { + if (ejbName!= null) { writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbName); writer.writeEndElement(); @@ -252,16 +260,16 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: interceptorClass - final List interceptorClassRaw = interceptorBinding.interceptorClass; - if (interceptorClassRaw != null) { - for (final String interceptorClassItem : interceptorClassRaw) { + List interceptorClassRaw = interceptorBinding.interceptorClass; + if (interceptorClassRaw!= null) { + for (String interceptorClassItem: interceptorClassRaw) { String interceptorClass = null; try { interceptorClass = Adapters.collapsedStringAdapterAdapter.marshal(interceptorClassItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(interceptorBinding, "interceptorClass", CollapsedStringAdapter.class, List.class, List.class, e); } - if (interceptorClass != null) { + if (interceptorClass!= null) { writer.writeStartElement(prefix, "interceptor-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(interceptorClass); writer.writeEndElement(); @@ -272,28 +280,28 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto } // ELEMENT: interceptorOrder - final InterceptorOrder interceptorOrder = interceptorBinding.interceptorOrder; - if (interceptorOrder != null) { + InterceptorOrder interceptorOrder = interceptorBinding.interceptorOrder; + if (interceptorOrder!= null) { writer.writeStartElement(prefix, "interceptor-order", "http://java.sun.com/xml/ns/javaee"); writeInterceptorOrder(writer, interceptorOrder, context); writer.writeEndElement(); } // ELEMENT: excludeDefaultInterceptors - final Boolean excludeDefaultInterceptors = interceptorBinding.excludeDefaultInterceptors; + Boolean excludeDefaultInterceptors = interceptorBinding.excludeDefaultInterceptors; writer.writeStartElement(prefix, "exclude-default-interceptors", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(excludeDefaultInterceptors)); writer.writeEndElement(); // ELEMENT: excludeClassInterceptors - final Boolean excludeClassInterceptors = interceptorBinding.excludeClassInterceptors; + Boolean excludeClassInterceptors = interceptorBinding.excludeClassInterceptors; writer.writeStartElement(prefix, "exclude-class-interceptors", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(excludeClassInterceptors)); writer.writeEndElement(); // ELEMENT: method - final NamedMethod method = interceptorBinding.method; - if (method != null) { + NamedMethod method = interceptorBinding.method; + if (method!= null) { writer.writeStartElement(prefix, "method", "http://java.sun.com/xml/ns/javaee"); writeNamedMethod(writer, method, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InterceptorOrder$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InterceptorOrder$JAXB.java index 7ebe63e4a04..99434cb7a3a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InterceptorOrder$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/InterceptorOrder$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class InterceptorOrder$JAXB - extends JAXBObject { + extends JAXBObject +{ public InterceptorOrder$JAXB() { super(InterceptorOrder.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "interceptor-orderType".intern())); } - public static InterceptorOrder readInterceptorOrder(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static InterceptorOrder readInterceptorOrder(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeInterceptorOrder(final XoXMLStreamWriter writer, final InterceptorOrder interceptorOrder, final RuntimeContext context) - throws Exception { + public static void writeInterceptorOrder(XoXMLStreamWriter writer, InterceptorOrder interceptorOrder, RuntimeContext context) + throws Exception + { _write(writer, interceptorOrder, context); } - public void write(final XoXMLStreamWriter writer, final InterceptorOrder interceptorOrder, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, InterceptorOrder interceptorOrder, RuntimeContext context) + throws Exception + { _write(writer, interceptorOrder, context); } - public final static InterceptorOrder _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final InterceptorOrder _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,51 +72,51 @@ public final static InterceptorOrder _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final InterceptorOrder interceptorOrder = new InterceptorOrder(); + InterceptorOrder interceptorOrder = new InterceptorOrder(); context.beforeUnmarshal(interceptorOrder, LifecycleCallback.NONE); List interceptorClass = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("interceptor-orderType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("interceptor-orderType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, InterceptorOrder.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, interceptorOrder); interceptorOrder.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("interceptor-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("interceptor-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: interceptorClass - final String interceptorClassItemRaw = elementReader.getElementAsString(); + String interceptorClassItemRaw = elementReader.getElementText(); - final String interceptorClassItem; + String interceptorClassItem; try { interceptorClassItem = Adapters.collapsedStringAdapterAdapter.unmarshal(interceptorClassItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (interceptorClass == null) { interceptorClass = interceptorOrder.interceptorClass; - if (interceptorClass != null) { + if (interceptorClass!= null) { interceptorClass.clear(); } else { - interceptorClass = new ArrayList(); + interceptorClass = new ArrayList<>(); } } interceptorClass.add(interceptorClassItem); @@ -119,7 +124,7 @@ public final static InterceptorOrder _read(final XoXMLStreamReader reader, Runti context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "interceptor-class")); } } - if (interceptorClass != null) { + if (interceptorClass!= null) { interceptorOrder.interceptorClass = interceptorClass; } @@ -128,53 +133,55 @@ public final static InterceptorOrder _read(final XoXMLStreamReader reader, Runti return interceptorOrder; } - public final InterceptorOrder read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final InterceptorOrder read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final InterceptorOrder interceptorOrder, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, InterceptorOrder interceptorOrder, RuntimeContext context) + throws Exception + { if (interceptorOrder == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (InterceptorOrder.class != interceptorOrder.getClass()) { + if (InterceptorOrder.class!= interceptorOrder.getClass()) { context.unexpectedSubclass(writer, interceptorOrder, InterceptorOrder.class); - return; + return ; } context.beforeMarshal(interceptorOrder, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = interceptorOrder.id; - if (idRaw != null) { + String idRaw = interceptorOrder.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(interceptorOrder, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: interceptorClass - final List interceptorClassRaw = interceptorOrder.interceptorClass; - if (interceptorClassRaw != null) { - for (final String interceptorClassItem : interceptorClassRaw) { + List interceptorClassRaw = interceptorOrder.interceptorClass; + if (interceptorClassRaw!= null) { + for (String interceptorClassItem: interceptorClassRaw) { String interceptorClass = null; try { interceptorClass = Adapters.collapsedStringAdapterAdapter.marshal(interceptorClassItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(interceptorOrder, "interceptorClass", CollapsedStringAdapter.class, List.class, List.class, e); } - if (interceptorClass != null) { + if (interceptorClass!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "interceptor-class"); writer.writeCharacters(interceptorClass); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptors$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptors$JAXB.java index 83c0011ae12..bdd4849aa63 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptors$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptors$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Interceptor$JAXB.readInterceptor; import static org.apache.openejb.jee.Interceptor$JAXB.writeInterceptor; @@ -37,30 +38,35 @@ "StringEquality" }) public class Interceptors$JAXB - extends JAXBObject { + extends JAXBObject +{ public Interceptors$JAXB() { super(Interceptors.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "interceptorsType".intern()), Text$JAXB.class, Interceptor$JAXB.class); } - public static Interceptors readInterceptors(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Interceptors readInterceptors(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeInterceptors(final XoXMLStreamWriter writer, final Interceptors interceptors, final RuntimeContext context) - throws Exception { + public static void writeInterceptors(XoXMLStreamWriter writer, Interceptors interceptors, RuntimeContext context) + throws Exception + { _write(writer, interceptors, context); } - public void write(final XoXMLStreamWriter writer, final Interceptors interceptors, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Interceptors interceptors, RuntimeContext context) + throws Exception + { _write(writer, interceptors, context); } - public final static Interceptors _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Interceptors _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -71,63 +77,63 @@ public final static Interceptors _read(final XoXMLStreamReader reader, RuntimeCo context = new RuntimeContext(); } - final Interceptors interceptors = new Interceptors(); + Interceptors interceptors = new Interceptors(); context.beforeUnmarshal(interceptors, LifecycleCallback.NONE); ArrayList descriptions = null; ArrayList interceptor = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("interceptorsType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("interceptorsType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Interceptors.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, interceptors); interceptors.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("interceptor" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("interceptor" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: interceptor - final Interceptor interceptorItem = readInterceptor(elementReader, context); + Interceptor interceptorItem = readInterceptor(elementReader, context); if (interceptor == null) { - interceptor = new ArrayList(); + interceptor = new ArrayList<>(); } interceptor.add(interceptorItem); } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "interceptor")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - interceptors.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + interceptors.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Interceptors.class, "setDescriptions", Text[].class, e); } } - if (interceptor != null) { + if (interceptor!= null) { try { - interceptors.setInterceptor(interceptor.toArray(new Interceptor[interceptor.size()])); - } catch (final Exception e) { + interceptors.setInterceptor(interceptor.toArray(new Interceptor[interceptor.size()] )); + } catch (Exception e) { context.setterError(reader, Interceptors.class, "setInterceptor", Interceptor[].class, e); } } @@ -137,38 +143,40 @@ public final static Interceptors _read(final XoXMLStreamReader reader, RuntimeCo return interceptors; } - public final Interceptors read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Interceptors read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Interceptors interceptors, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Interceptors interceptors, RuntimeContext context) + throws Exception + { if (interceptors == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Interceptors.class != interceptors.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Interceptors.class!= interceptors.getClass()) { context.unexpectedSubclass(writer, interceptors, Interceptors.class); - return; + return ; } context.beforeMarshal(interceptors, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = interceptors.id; - if (idRaw != null) { + String idRaw = interceptors.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(interceptors, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -178,12 +186,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto Text[] descriptions = null; try { descriptions = interceptors.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(interceptors, "descriptions", Interceptors.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -197,12 +205,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Intercepto Interceptor[] interceptor = null; try { interceptor = interceptors.getInterceptor(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(interceptors, "interceptor", Interceptors.class, "getInterceptor", e); } - if (interceptor != null) { - for (final Interceptor interceptorItem : interceptor) { - if (interceptorItem != null) { + if (interceptor!= null) { + for (Interceptor interceptorItem: interceptor) { + if (interceptorItem!= null) { writer.writeStartElement(prefix, "interceptor", "http://java.sun.com/xml/ns/javaee"); writeInterceptor(writer, interceptorItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/IsolationLevel$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/IsolationLevel$JAXB.java index 85624c36d2f..4e40b18c83b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/IsolationLevel$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/IsolationLevel$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class IsolationLevel$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public IsolationLevel$JAXB() { super(IsolationLevel.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "isolation-levelType".intern())); } - public IsolationLevel parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public IsolationLevel parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseIsolationLevel(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final IsolationLevel isolationLevel) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, IsolationLevel isolationLevel) + throws Exception + { return toStringIsolationLevel(bean, parameterName, context, isolationLevel); } - public static IsolationLevel parseIsolationLevel(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static IsolationLevel parseIsolationLevel(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("TRANSACTION_READ_UNCOMMITTED".equals(value)) { return IsolationLevel.TRANSACTION_READ_UNCOMMITTED; } else if ("TRANSACTION_READ_COMMITTED".equals(value)) { @@ -56,8 +60,9 @@ public static IsolationLevel parseIsolationLevel(final XoXMLStreamReader reader, } } - public static String toStringIsolationLevel(final Object bean, final String parameterName, final RuntimeContext context, final IsolationLevel isolationLevel) - throws Exception { + public static String toStringIsolationLevel(Object bean, String parameterName, RuntimeContext context, IsolationLevel isolationLevel) + throws Exception + { if (IsolationLevel.TRANSACTION_READ_UNCOMMITTED == isolationLevel) { return "TRANSACTION_READ_UNCOMMITTED"; } else if (IsolationLevel.TRANSACTION_READ_COMMITTED == isolationLevel) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JMSConnectionFactory$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JMSConnectionFactory$JAXB.java index 76e125d2272..d9d7bd860c3 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JMSConnectionFactory$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JMSConnectionFactory$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +29,45 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Property$JAXB.readProperty; +import static org.apache.openejb.jee.Property$JAXB.writeProperty; import static org.apache.openejb.jee.Text$JAXB.readText; +import static org.apache.openejb.jee.Text$JAXB.writeText; @SuppressWarnings({ "StringEquality" }) public class JMSConnectionFactory$JAXB - extends JAXBObject { + extends JAXBObject +{ public JMSConnectionFactory$JAXB() { - super(JMSConnectionFactory.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "jms-connection-factoryType".intern()), Text$JAXB.class, Property$JAXB.class); + super(org.apache.openejb.jee.JMSConnectionFactory.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "jms-connection-factoryType".intern()), Text$JAXB.class, Property$JAXB.class); } - public static JMSConnectionFactory readJMSConnectionFactory(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static org.apache.openejb.jee.JMSConnectionFactory readJMSConnectionFactory(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public void write(final XoXMLStreamWriter writer, final JMSConnectionFactory JMSConnectionFactory, final RuntimeContext context) - throws Exception { + public static void writeJMSConnectionFactory(XoXMLStreamWriter writer, org.apache.openejb.jee.JMSConnectionFactory JMSConnectionFactory, RuntimeContext context) + throws Exception + { _write(writer, JMSConnectionFactory, context); } - public final static JMSConnectionFactory _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, org.apache.openejb.jee.JMSConnectionFactory JMSConnectionFactory, RuntimeContext context) + throws Exception + { + _write(writer, JMSConnectionFactory, context); + } + + public static final org.apache.openejb.jee.JMSConnectionFactory _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,164 +78,161 @@ public final static JMSConnectionFactory _read(final XoXMLStreamReader reader, R context = new RuntimeContext(); } - final JMSConnectionFactory JMSConnectionFactory = new JMSConnectionFactory(); + org.apache.openejb.jee.JMSConnectionFactory JMSConnectionFactory = new org.apache.openejb.jee.JMSConnectionFactory(); context.beforeUnmarshal(JMSConnectionFactory, LifecycleCallback.NONE); ArrayList descriptions = null; List property = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("jms-connection-factoryType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { - return context.unexpectedXsiType(reader, JMSConnectionFactory.class); + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("jms-connection-factoryType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, org.apache.openejb.jee.JMSConnectionFactory.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, JMSConnectionFactory); JMSConnectionFactory.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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(); - } - descriptions.add(descriptionsItem); - } else if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + String nameRaw = elementReader.getElementText(); - final String name; + String name; try { name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } JMSConnectionFactory.name = name; - } else if (("class-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + } else if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: descriptions + Text descriptionsItem = readText(elementReader, context); + if (descriptions == null) { + descriptions = new ArrayList<>(); + } + descriptions.add(descriptionsItem); + } else if (("class-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: className + String classNameRaw = elementReader.getElementText(); - final String name; + String className; try { - name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + className = Adapters.collapsedStringAdapterAdapter.unmarshal(classNameRaw); + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } - JMSConnectionFactory.className = name; - } else if (("interface-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + JMSConnectionFactory.className = className; + } else if (("interface-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: interfaceName + String interfaceNameRaw = elementReader.getElementText(); - final String name; + String interfaceName; try { - name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + interfaceName = Adapters.collapsedStringAdapterAdapter.unmarshal(interfaceNameRaw); + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } - JMSConnectionFactory.className = name; - } else if (("resource-adapter" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + JMSConnectionFactory.interfaceName = interfaceName; + } else if (("resource-adapter" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceAdapter + String resourceAdapterRaw = elementReader.getElementText(); - final String name; + String resourceAdapter; try { - name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + resourceAdapter = Adapters.collapsedStringAdapterAdapter.unmarshal(resourceAdapterRaw); + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } - JMSConnectionFactory.resourceAdapter = name; - } else if (("user" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + JMSConnectionFactory.resourceAdapter = resourceAdapter; + } else if (("user" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: user + String userRaw = elementReader.getElementText(); - final String name; + String user; try { - name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + user = Adapters.collapsedStringAdapterAdapter.unmarshal(userRaw); + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } - JMSConnectionFactory.user = name; - } else if (("password" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + JMSConnectionFactory.user = user; + } else if (("password" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: password + String passwordRaw = elementReader.getElementText(); - final String name; + String password; try { - name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + password = Adapters.collapsedStringAdapterAdapter.unmarshal(passwordRaw); + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } - JMSConnectionFactory.password = name; - } else if (("client-id" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + JMSConnectionFactory.password = password; + } else if (("clientId" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: clientId + String clientIdRaw = elementReader.getElementText(); - final String name; + String clientId; try { - name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + clientId = Adapters.collapsedStringAdapterAdapter.unmarshal(clientIdRaw); + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } - JMSConnectionFactory.clientId = name; - } else if (("max-pool-size" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - final Integer portNumber = Integer.valueOf(elementReader.getElementAsString()); - JMSConnectionFactory.maxPoolSize = portNumber; - } else if (("min-pool-size" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - final Integer portNumber = Integer.valueOf(elementReader.getElementAsString()); - JMSConnectionFactory.minPoolSize = portNumber; - } else if (("transactional" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - JMSConnectionFactory.transactional = Boolean.parseBoolean(elementReader.getElementAsString()); - } else if (("property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + JMSConnectionFactory.clientId = clientId; + } else if (("transactional" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: transactional + Boolean transactional = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + JMSConnectionFactory.transactional = transactional; + } else if (("max-pool-size" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: maxPoolSize + Integer maxPoolSize = Integer.valueOf(elementReader.getElementText()); + JMSConnectionFactory.maxPoolSize = maxPoolSize; + } else if (("min-pool-size" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: minPoolSize + Integer minPoolSize = Integer.valueOf(elementReader.getElementText()); + JMSConnectionFactory.minPoolSize = minPoolSize; + } else if (("property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: property - final Property propertyItem = readProperty(elementReader, context); + Property propertyItem = readProperty(elementReader, context); if (property == null) { property = JMSConnectionFactory.property; - if (property != null) { + if (property!= null) { property.clear(); } else { property = new ArrayList<>(); } } property.add(propertyItem); - } else if (!Boolean.getBoolean("tomee.xml.passthrough")) { // so to pass if not important - context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "class-name"), new QName("http://java.sun.com/xml/ns/javaee", "server-name"), new QName("http://java.sun.com/xml/ns/javaee", "port-number"), new QName("http://java.sun.com/xml/ns/javaee", "database-name"), new QName("http://java.sun.com/xml/ns/javaee", "url"), new QName("http://java.sun.com/xml/ns/javaee", "user"), new QName("http://java.sun.com/xml/ns/javaee", "password"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "login-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "transactional"), new QName("http://java.sun.com/xml/ns/javaee", "isolation-level"), new QName("http://java.sun.com/xml/ns/javaee", "initial-pool-size"), new QName("http://java.sun.com/xml/ns/javaee", "max-pool-size"), new QName("http://java.sun.com/xml/ns/javaee", "min-pool-size"), new QName("http://java.sun.com/xml/ns/javaee", "max-idle-time"), new QName("http://java.sun.com/xml/ns/javaee", "max-statements")); + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "class-name"), new QName("http://java.sun.com/xml/ns/javaee", "interface-name"), new QName("http://java.sun.com/xml/ns/javaee", "resource-adapter"), new QName("http://java.sun.com/xml/ns/javaee", "user"), new QName("http://java.sun.com/xml/ns/javaee", "password"), new QName("http://java.sun.com/xml/ns/javaee", "clientId"), new QName("http://java.sun.com/xml/ns/javaee", "transactional"), new QName("http://java.sun.com/xml/ns/javaee", "max-pool-size"), new QName("http://java.sun.com/xml/ns/javaee", "min-pool-size"), new QName("http://java.sun.com/xml/ns/javaee", "property")); } } - if (descriptions != null) { - try { - JMSConnectionFactory.description.set(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { - context.setterError(reader, JMSConnectionFactory.class, "setDescriptions", Text[].class, e); - } - } - if (property != null) { + if (property!= null) { JMSConnectionFactory.property = property; } @@ -231,14 +241,199 @@ public final static JMSConnectionFactory _read(final XoXMLStreamReader reader, R return JMSConnectionFactory; } - public final JMSConnectionFactory read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final org.apache.openejb.jee.JMSConnectionFactory read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final JMSConnectionFactory JMSConnectionFactory, RuntimeContext context) - throws Exception { - // no-op while not useful + public static final void _write(XoXMLStreamWriter writer, org.apache.openejb.jee.JMSConnectionFactory JMSConnectionFactory, RuntimeContext context) + throws Exception + { + if (JMSConnectionFactory == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (org.apache.openejb.jee.JMSConnectionFactory.class!= JMSConnectionFactory.getClass()) { + context.unexpectedSubclass(writer, JMSConnectionFactory, org.apache.openejb.jee.JMSConnectionFactory.class); + return ; + } + + context.beforeMarshal(JMSConnectionFactory, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = JMSConnectionFactory.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSConnectionFactory, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: name + String nameRaw = JMSConnectionFactory.name; + String name = null; + try { + name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSConnectionFactory, "name", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (name!= null) { + writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(name); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(JMSConnectionFactory, "name"); + } + + // ELEMENT: descriptions + Text[] descriptions = null; + try { + descriptions = JMSConnectionFactory.getDescriptions(); + } catch (Exception e) { + context.getterError(JMSConnectionFactory, "descriptions", org.apache.openejb.jee.JMSConnectionFactory.class, "getDescriptions", e); + } + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { + writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); + writeText(writer, descriptionsItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: className + String classNameRaw = JMSConnectionFactory.className; + String className = null; + try { + className = Adapters.collapsedStringAdapterAdapter.marshal(classNameRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSConnectionFactory, "className", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (className!= null) { + writer.writeStartElement(prefix, "class-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(className); + writer.writeEndElement(); + } + + // ELEMENT: interfaceName + String interfaceNameRaw = JMSConnectionFactory.interfaceName; + String interfaceName = null; + try { + interfaceName = Adapters.collapsedStringAdapterAdapter.marshal(interfaceNameRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSConnectionFactory, "interfaceName", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (interfaceName!= null) { + writer.writeStartElement(prefix, "interface-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(interfaceName); + writer.writeEndElement(); + } + + // ELEMENT: resourceAdapter + String resourceAdapterRaw = JMSConnectionFactory.resourceAdapter; + String resourceAdapter = null; + try { + resourceAdapter = Adapters.collapsedStringAdapterAdapter.marshal(resourceAdapterRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSConnectionFactory, "resourceAdapter", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (resourceAdapter!= null) { + writer.writeStartElement(prefix, "resource-adapter", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(resourceAdapter); + writer.writeEndElement(); + } + + // ELEMENT: user + String userRaw = JMSConnectionFactory.user; + String user = null; + try { + user = Adapters.collapsedStringAdapterAdapter.marshal(userRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSConnectionFactory, "user", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (user!= null) { + writer.writeStartElement(prefix, "user", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(user); + writer.writeEndElement(); + } + + // ELEMENT: password + String passwordRaw = JMSConnectionFactory.password; + String password = null; + try { + password = Adapters.collapsedStringAdapterAdapter.marshal(passwordRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSConnectionFactory, "password", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (password!= null) { + writer.writeStartElement(prefix, "password", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(password); + writer.writeEndElement(); + } + + // ELEMENT: clientId + String clientIdRaw = JMSConnectionFactory.clientId; + String clientId = null; + try { + clientId = Adapters.collapsedStringAdapterAdapter.marshal(clientIdRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSConnectionFactory, "clientId", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (clientId!= null) { + writer.writeStartElement(prefix, "clientId", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(clientId); + writer.writeEndElement(); + } + + // ELEMENT: transactional + Boolean transactional = JMSConnectionFactory.transactional; + writer.writeStartElement(prefix, "transactional", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Boolean.toString(transactional)); + writer.writeEndElement(); + + // ELEMENT: maxPoolSize + Integer maxPoolSize = JMSConnectionFactory.maxPoolSize; + if (maxPoolSize!= null) { + writer.writeStartElement(prefix, "max-pool-size", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Integer.toString(maxPoolSize)); + writer.writeEndElement(); + } + + // ELEMENT: minPoolSize + Integer minPoolSize = JMSConnectionFactory.minPoolSize; + if (minPoolSize!= null) { + writer.writeStartElement(prefix, "min-pool-size", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Integer.toString(minPoolSize)); + writer.writeEndElement(); + } + + // ELEMENT: property + List property = JMSConnectionFactory.property; + if (property!= null) { + for (Property propertyItem: property) { + writer.writeStartElement(prefix, "property", "http://java.sun.com/xml/ns/javaee"); + if (propertyItem!= null) { + writeProperty(writer, propertyItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + context.afterMarshal(JMSConnectionFactory, LifecycleCallback.NONE); } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JMSDestination$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JMSDestination$JAXB.java new file mode 100644 index 00000000000..ee0a3cd1dcc --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JMSDestination$JAXB.java @@ -0,0 +1,351 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.Property$JAXB.readProperty; +import static org.apache.openejb.jee.Property$JAXB.writeProperty; +import static org.apache.openejb.jee.Text$JAXB.readText; +import static org.apache.openejb.jee.Text$JAXB.writeText; + +@SuppressWarnings({ + "StringEquality" +}) +public class JMSDestination$JAXB + extends JAXBObject +{ + + + public JMSDestination$JAXB() { + super(org.apache.openejb.jee.JMSDestination.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "jms-destinationType".intern()), Text$JAXB.class, Property$JAXB.class); + } + + public static org.apache.openejb.jee.JMSDestination readJMSDestination(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeJMSDestination(XoXMLStreamWriter writer, org.apache.openejb.jee.JMSDestination JMSDestination, RuntimeContext context) + throws Exception + { + _write(writer, JMSDestination, context); + } + + public void write(XoXMLStreamWriter writer, org.apache.openejb.jee.JMSDestination JMSDestination, RuntimeContext context) + throws Exception + { + _write(writer, JMSDestination, context); + } + + public static final org.apache.openejb.jee.JMSDestination _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + org.apache.openejb.jee.JMSDestination JMSDestination = new org.apache.openejb.jee.JMSDestination(); + context.beforeUnmarshal(JMSDestination, LifecycleCallback.NONE); + + ArrayList descriptions = null; + List property = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("jms-destinationType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, org.apache.openejb.jee.JMSDestination.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, JMSDestination); + JMSDestination.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 (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: name + String nameRaw = elementReader.getElementText(); + + String name; + try { + name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + JMSDestination.name = name; + } else if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: descriptions + Text descriptionsItem = readText(elementReader, context); + if (descriptions == null) { + descriptions = new ArrayList<>(); + } + descriptions.add(descriptionsItem); + } else if (("class-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: className + String classNameRaw = elementReader.getElementText(); + + String className; + try { + className = Adapters.collapsedStringAdapterAdapter.unmarshal(classNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + JMSDestination.className = className; + } else if (("interface-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: interfaceName + String interfaceNameRaw = elementReader.getElementText(); + + String interfaceName; + try { + interfaceName = Adapters.collapsedStringAdapterAdapter.unmarshal(interfaceNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + JMSDestination.interfaceName = interfaceName; + } else if (("resource-adapter-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceAdapter + String resourceAdapterRaw = elementReader.getElementText(); + + String resourceAdapter; + try { + resourceAdapter = Adapters.collapsedStringAdapterAdapter.unmarshal(resourceAdapterRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + JMSDestination.resourceAdapter = resourceAdapter; + } else if (("destination-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: destinationName + String destinationNameRaw = elementReader.getElementText(); + + String destinationName; + try { + destinationName = Adapters.collapsedStringAdapterAdapter.unmarshal(destinationNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + JMSDestination.destinationName = destinationName; + } else if (("property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: property + Property propertyItem = readProperty(elementReader, context); + if (property == null) { + property = JMSDestination.property; + if (property!= null) { + property.clear(); + } else { + property = new ArrayList<>(); + } + } + property.add(propertyItem); + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "class-name"), new QName("http://java.sun.com/xml/ns/javaee", "interface-name"), new QName("http://java.sun.com/xml/ns/javaee", "resource-adapter-name"), new QName("http://java.sun.com/xml/ns/javaee", "destination-name"), new QName("http://java.sun.com/xml/ns/javaee", "property")); + } + } + if (property!= null) { + JMSDestination.property = property; + } + + context.afterUnmarshal(JMSDestination, LifecycleCallback.NONE); + + return JMSDestination; + } + + public final org.apache.openejb.jee.JMSDestination read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, org.apache.openejb.jee.JMSDestination JMSDestination, RuntimeContext context) + throws Exception + { + if (JMSDestination == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (org.apache.openejb.jee.JMSDestination.class!= JMSDestination.getClass()) { + context.unexpectedSubclass(writer, JMSDestination, org.apache.openejb.jee.JMSDestination.class); + return ; + } + + context.beforeMarshal(JMSDestination, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = JMSDestination.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSDestination, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: name + String nameRaw = JMSDestination.name; + String name = null; + try { + name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSDestination, "name", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (name!= null) { + writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(name); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(JMSDestination, "name"); + } + + // ELEMENT: descriptions + Text[] descriptions = null; + try { + descriptions = JMSDestination.getDescriptions(); + } catch (Exception e) { + context.getterError(JMSDestination, "descriptions", org.apache.openejb.jee.JMSDestination.class, "getDescriptions", e); + } + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { + writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); + writeText(writer, descriptionsItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: className + String classNameRaw = JMSDestination.className; + String className = null; + try { + className = Adapters.collapsedStringAdapterAdapter.marshal(classNameRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSDestination, "className", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (className!= null) { + writer.writeStartElement(prefix, "class-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(className); + writer.writeEndElement(); + } + + // ELEMENT: interfaceName + String interfaceNameRaw = JMSDestination.interfaceName; + String interfaceName = null; + try { + interfaceName = Adapters.collapsedStringAdapterAdapter.marshal(interfaceNameRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSDestination, "interfaceName", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (interfaceName!= null) { + writer.writeStartElement(prefix, "interface-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(interfaceName); + writer.writeEndElement(); + } + + // ELEMENT: resourceAdapter + String resourceAdapterRaw = JMSDestination.resourceAdapter; + String resourceAdapter = null; + try { + resourceAdapter = Adapters.collapsedStringAdapterAdapter.marshal(resourceAdapterRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSDestination, "resourceAdapter", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (resourceAdapter!= null) { + writer.writeStartElement(prefix, "resource-adapter-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(resourceAdapter); + writer.writeEndElement(); + } + + // ELEMENT: destinationName + String destinationNameRaw = JMSDestination.destinationName; + String destinationName = null; + try { + destinationName = Adapters.collapsedStringAdapterAdapter.marshal(destinationNameRaw); + } catch (Exception e) { + context.xmlAdapterError(JMSDestination, "destinationName", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (destinationName!= null) { + writer.writeStartElement(prefix, "destination-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(destinationName); + writer.writeEndElement(); + } + + // ELEMENT: property + List property = JMSDestination.property; + if (property!= null) { + for (Property propertyItem: property) { + writer.writeStartElement(prefix, "property", "http://java.sun.com/xml/ns/javaee"); + if (propertyItem!= null) { + writeProperty(writer, propertyItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + context.afterMarshal(JMSDestination, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaIdentifier$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaIdentifier$JAXB.java new file mode 100644 index 00000000000..7e4b0b3ddde --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaIdentifier$JAXB.java @@ -0,0 +1,170 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class JavaIdentifier$JAXB + extends JAXBObject +{ + + + public JavaIdentifier$JAXB() { + super(JavaIdentifier.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "java-identifierType".intern())); + } + + public static JavaIdentifier readJavaIdentifier(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeJavaIdentifier(XoXMLStreamWriter writer, JavaIdentifier javaIdentifier, RuntimeContext context) + throws Exception + { + _write(writer, javaIdentifier, context); + } + + public void write(XoXMLStreamWriter writer, JavaIdentifier javaIdentifier, RuntimeContext context) + throws Exception + { + _write(writer, javaIdentifier, context); + } + + public static final JavaIdentifier _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + JavaIdentifier javaIdentifier = new JavaIdentifier(); + context.beforeUnmarshal(javaIdentifier, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("java-identifierType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, JavaIdentifier.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, javaIdentifier); + javaIdentifier.id = id; + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "id")); + } + } + + // VALUE: value + String valueRaw = reader.getElementText(); + + String value = null; + boolean valueConverted; + try { + value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); + valueConverted = true; + } catch (Exception e) { + context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); + valueConverted = false; + } + + if (valueConverted) { + javaIdentifier.value = value; + } + + context.afterUnmarshal(javaIdentifier, LifecycleCallback.NONE); + + return javaIdentifier; + } + + public final JavaIdentifier read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, JavaIdentifier javaIdentifier, RuntimeContext context) + throws Exception + { + if (javaIdentifier == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (JavaIdentifier.class!= javaIdentifier.getClass()) { + context.unexpectedSubclass(writer, javaIdentifier, JavaIdentifier.class); + return ; + } + + context.beforeMarshal(javaIdentifier, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = javaIdentifier.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(javaIdentifier, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // VALUE: value + String valueRaw = javaIdentifier.value; + String value = null; + try { + value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); + } catch (Exception e) { + context.xmlAdapterError(javaIdentifier, "value", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeCharacters(value); + + context.afterMarshal(javaIdentifier, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaWsdlMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaWsdlMapping$JAXB.java index 249f1cf3f97..fa1571015ec 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaWsdlMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaWsdlMapping$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.ExceptionMapping$JAXB.readExceptionMapping; import static org.apache.openejb.jee.ExceptionMapping$JAXB.writeExceptionMapping; @@ -44,30 +45,35 @@ "StringEquality" }) public class JavaWsdlMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public JavaWsdlMapping$JAXB() { super(JavaWsdlMapping.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "java-wsdl-mapping".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "java-wsdl-mappingType".intern()), PackageMapping$JAXB.class, JavaXmlTypeMapping$JAXB.class, ExceptionMapping$JAXB.class, ServiceInterfaceMapping$JAXB.class, ServiceEndpointInterfaceMapping$JAXB.class); } - public static JavaWsdlMapping readJavaWsdlMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static JavaWsdlMapping readJavaWsdlMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeJavaWsdlMapping(final XoXMLStreamWriter writer, final JavaWsdlMapping javaWsdlMapping, final RuntimeContext context) - throws Exception { + public static void writeJavaWsdlMapping(XoXMLStreamWriter writer, JavaWsdlMapping javaWsdlMapping, RuntimeContext context) + throws Exception + { _write(writer, javaWsdlMapping, context); } - public void write(final XoXMLStreamWriter writer, final JavaWsdlMapping javaWsdlMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, JavaWsdlMapping javaWsdlMapping, RuntimeContext context) + throws Exception + { _write(writer, javaWsdlMapping, context); } - public final static JavaWsdlMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final JavaWsdlMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -78,7 +84,7 @@ public final static JavaWsdlMapping _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping(); + JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping(); context.beforeUnmarshal(javaWsdlMapping, LifecycleCallback.NONE); KeyedCollection packageMapping = null; @@ -88,87 +94,87 @@ public final static JavaWsdlMapping _read(final XoXMLStreamReader reader, Runtim KeyedCollection serviceEndpointInterfaceMapping = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("java-wsdl-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("java-wsdl-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, JavaWsdlMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, javaWsdlMapping); javaWsdlMapping.id = id; - } else if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("version" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: version javaWsdlMapping.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "version")); } } // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("package-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("package-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: packageMapping - final PackageMapping packageMappingItem = readPackageMapping(elementReader, context); + PackageMapping packageMappingItem = readPackageMapping(elementReader, context); if (packageMapping == null) { packageMapping = javaWsdlMapping.packageMapping; - if (packageMapping != null) { + if (packageMapping!= null) { packageMapping.clear(); } else { - packageMapping = new KeyedCollection(); + packageMapping = new KeyedCollection<>(); } } packageMapping.add(packageMappingItem); - } else if (("java-xml-type-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("java-xml-type-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: javaXmlTypeMapping - final JavaXmlTypeMapping javaXmlTypeMappingItem = readJavaXmlTypeMapping(elementReader, context); + JavaXmlTypeMapping javaXmlTypeMappingItem = readJavaXmlTypeMapping(elementReader, context); if (javaXmlTypeMapping == null) { javaXmlTypeMapping = javaWsdlMapping.javaXmlTypeMapping; - if (javaXmlTypeMapping != null) { + if (javaXmlTypeMapping!= null) { javaXmlTypeMapping.clear(); } else { - javaXmlTypeMapping = new ArrayList(); + javaXmlTypeMapping = new ArrayList<>(); } } javaXmlTypeMapping.add(javaXmlTypeMappingItem); - } else if (("exception-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("exception-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: exceptionMapping - final ExceptionMapping exceptionMappingItem = readExceptionMapping(elementReader, context); + ExceptionMapping exceptionMappingItem = readExceptionMapping(elementReader, context); if (exceptionMapping == null) { exceptionMapping = javaWsdlMapping.exceptionMapping; - if (exceptionMapping != null) { + if (exceptionMapping!= null) { exceptionMapping.clear(); } else { - exceptionMapping = new KeyedCollection(); + exceptionMapping = new KeyedCollection<>(); } } exceptionMapping.add(exceptionMappingItem); - } else if (("service-interface-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-interface-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceInterfaceMapping - final ServiceInterfaceMapping serviceInterfaceMappingItem = readServiceInterfaceMapping(elementReader, context); + ServiceInterfaceMapping serviceInterfaceMappingItem = readServiceInterfaceMapping(elementReader, context); if (serviceInterfaceMapping == null) { serviceInterfaceMapping = javaWsdlMapping.serviceInterfaceMapping; - if (serviceInterfaceMapping != null) { + if (serviceInterfaceMapping!= null) { serviceInterfaceMapping.clear(); } else { - serviceInterfaceMapping = new ArrayList(); + serviceInterfaceMapping = new ArrayList<>(); } } serviceInterfaceMapping.add(serviceInterfaceMappingItem); - } else if (("service-endpoint-interface-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-endpoint-interface-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceEndpointInterfaceMapping - final ServiceEndpointInterfaceMapping serviceEndpointInterfaceMappingItem = readServiceEndpointInterfaceMapping(elementReader, context); + ServiceEndpointInterfaceMapping serviceEndpointInterfaceMappingItem = readServiceEndpointInterfaceMapping(elementReader, context); if (serviceEndpointInterfaceMapping == null) { serviceEndpointInterfaceMapping = javaWsdlMapping.serviceEndpointInterfaceMapping; - if (serviceEndpointInterfaceMapping != null) { + if (serviceEndpointInterfaceMapping!= null) { serviceEndpointInterfaceMapping.clear(); } else { - serviceEndpointInterfaceMapping = new KeyedCollection(); + serviceEndpointInterfaceMapping = new KeyedCollection<>(); } } serviceEndpointInterfaceMapping.add(serviceEndpointInterfaceMappingItem); @@ -176,19 +182,19 @@ public final static JavaWsdlMapping _read(final XoXMLStreamReader reader, Runtim context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "package-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "java-xml-type-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "exception-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "service-interface-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint-interface-mapping")); } } - if (packageMapping != null) { + if (packageMapping!= null) { javaWsdlMapping.packageMapping = packageMapping; } - if (javaXmlTypeMapping != null) { + if (javaXmlTypeMapping!= null) { javaWsdlMapping.javaXmlTypeMapping = javaXmlTypeMapping; } - if (exceptionMapping != null) { + if (exceptionMapping!= null) { javaWsdlMapping.exceptionMapping = exceptionMapping; } - if (serviceInterfaceMapping != null) { + if (serviceInterfaceMapping!= null) { javaWsdlMapping.serviceInterfaceMapping = serviceInterfaceMapping; } - if (serviceEndpointInterfaceMapping != null) { + if (serviceEndpointInterfaceMapping!= null) { javaWsdlMapping.serviceEndpointInterfaceMapping = serviceEndpointInterfaceMapping; } @@ -197,60 +203,62 @@ public final static JavaWsdlMapping _read(final XoXMLStreamReader reader, Runtim return javaWsdlMapping; } - public final JavaWsdlMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final JavaWsdlMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final JavaWsdlMapping javaWsdlMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, JavaWsdlMapping javaWsdlMapping, RuntimeContext context) + throws Exception + { if (javaWsdlMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (JavaWsdlMapping.class != javaWsdlMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (JavaWsdlMapping.class!= javaWsdlMapping.getClass()) { context.unexpectedSubclass(writer, javaWsdlMapping, JavaWsdlMapping.class); - return; + return ; } context.beforeMarshal(javaWsdlMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = javaWsdlMapping.id; - if (idRaw != null) { + String idRaw = javaWsdlMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(javaWsdlMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: version - final String versionRaw = javaWsdlMapping.version; - if (versionRaw != null) { + String versionRaw = javaWsdlMapping.version; + if (versionRaw!= null) { String version = null; try { version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(javaWsdlMapping, "version", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "version", version); } // ELEMENT: packageMapping - final KeyedCollection packageMapping = javaWsdlMapping.packageMapping; - if (packageMapping != null) { - for (final PackageMapping packageMappingItem : packageMapping) { - if (packageMappingItem != null) { + KeyedCollection packageMapping = javaWsdlMapping.packageMapping; + if (packageMapping!= null) { + for (PackageMapping packageMappingItem: packageMapping) { + if (packageMappingItem!= null) { writer.writeStartElement(prefix, "package-mapping", "http://java.sun.com/xml/ns/javaee"); writePackageMapping(writer, packageMappingItem, context); writer.writeEndElement(); @@ -261,10 +269,10 @@ public final static void _write(final XoXMLStreamWriter writer, final JavaWsdlMa } // ELEMENT: javaXmlTypeMapping - final List javaXmlTypeMapping = javaWsdlMapping.javaXmlTypeMapping; - if (javaXmlTypeMapping != null) { - for (final JavaXmlTypeMapping javaXmlTypeMappingItem : javaXmlTypeMapping) { - if (javaXmlTypeMappingItem != null) { + List javaXmlTypeMapping = javaWsdlMapping.javaXmlTypeMapping; + if (javaXmlTypeMapping!= null) { + for (JavaXmlTypeMapping javaXmlTypeMappingItem: javaXmlTypeMapping) { + if (javaXmlTypeMappingItem!= null) { writer.writeStartElement(prefix, "java-xml-type-mapping", "http://java.sun.com/xml/ns/javaee"); writeJavaXmlTypeMapping(writer, javaXmlTypeMappingItem, context); writer.writeEndElement(); @@ -273,10 +281,10 @@ public final static void _write(final XoXMLStreamWriter writer, final JavaWsdlMa } // ELEMENT: exceptionMapping - final KeyedCollection exceptionMapping = javaWsdlMapping.exceptionMapping; - if (exceptionMapping != null) { - for (final ExceptionMapping exceptionMappingItem : exceptionMapping) { - if (exceptionMappingItem != null) { + KeyedCollection exceptionMapping = javaWsdlMapping.exceptionMapping; + if (exceptionMapping!= null) { + for (ExceptionMapping exceptionMappingItem: exceptionMapping) { + if (exceptionMappingItem!= null) { writer.writeStartElement(prefix, "exception-mapping", "http://java.sun.com/xml/ns/javaee"); writeExceptionMapping(writer, exceptionMappingItem, context); writer.writeEndElement(); @@ -285,10 +293,10 @@ public final static void _write(final XoXMLStreamWriter writer, final JavaWsdlMa } // ELEMENT: serviceInterfaceMapping - final List serviceInterfaceMapping = javaWsdlMapping.serviceInterfaceMapping; - if (serviceInterfaceMapping != null) { - for (final ServiceInterfaceMapping serviceInterfaceMappingItem : serviceInterfaceMapping) { - if (serviceInterfaceMappingItem != null) { + List serviceInterfaceMapping = javaWsdlMapping.serviceInterfaceMapping; + if (serviceInterfaceMapping!= null) { + for (ServiceInterfaceMapping serviceInterfaceMappingItem: serviceInterfaceMapping) { + if (serviceInterfaceMappingItem!= null) { writer.writeStartElement(prefix, "service-interface-mapping", "http://java.sun.com/xml/ns/javaee"); writeServiceInterfaceMapping(writer, serviceInterfaceMappingItem, context); writer.writeEndElement(); @@ -297,10 +305,10 @@ public final static void _write(final XoXMLStreamWriter writer, final JavaWsdlMa } // ELEMENT: serviceEndpointInterfaceMapping - final KeyedCollection serviceEndpointInterfaceMapping = javaWsdlMapping.serviceEndpointInterfaceMapping; - if (serviceEndpointInterfaceMapping != null) { - for (final ServiceEndpointInterfaceMapping serviceEndpointInterfaceMappingItem : serviceEndpointInterfaceMapping) { - if (serviceEndpointInterfaceMappingItem != null) { + KeyedCollection serviceEndpointInterfaceMapping = javaWsdlMapping.serviceEndpointInterfaceMapping; + if (serviceEndpointInterfaceMapping!= null) { + for (ServiceEndpointInterfaceMapping serviceEndpointInterfaceMappingItem: serviceEndpointInterfaceMapping) { + if (serviceEndpointInterfaceMappingItem!= null) { writer.writeStartElement(prefix, "service-endpoint-interface-mapping", "http://java.sun.com/xml/ns/javaee"); writeServiceEndpointInterfaceMapping(writer, serviceEndpointInterfaceMappingItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaXmlTypeMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaXmlTypeMapping$JAXB.java index 4eaca56acfb..eb37f7917f7 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaXmlTypeMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JavaXmlTypeMapping$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.VariableMapping$JAXB.readVariableMapping; import static org.apache.openejb.jee.VariableMapping$JAXB.writeVariableMapping; @@ -36,30 +37,35 @@ "StringEquality" }) public class JavaXmlTypeMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public JavaXmlTypeMapping$JAXB() { super(JavaXmlTypeMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "java-xml-type-mappingType".intern()), VariableMapping$JAXB.class); } - public static JavaXmlTypeMapping readJavaXmlTypeMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static JavaXmlTypeMapping readJavaXmlTypeMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeJavaXmlTypeMapping(final XoXMLStreamWriter writer, final JavaXmlTypeMapping javaXmlTypeMapping, final RuntimeContext context) - throws Exception { + public static void writeJavaXmlTypeMapping(XoXMLStreamWriter writer, JavaXmlTypeMapping javaXmlTypeMapping, RuntimeContext context) + throws Exception + { _write(writer, javaXmlTypeMapping, context); } - public void write(final XoXMLStreamWriter writer, final JavaXmlTypeMapping javaXmlTypeMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, JavaXmlTypeMapping javaXmlTypeMapping, RuntimeContext context) + throws Exception + { _write(writer, javaXmlTypeMapping, context); } - public final static JavaXmlTypeMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final JavaXmlTypeMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,85 +76,85 @@ public final static JavaXmlTypeMapping _read(final XoXMLStreamReader reader, Run context = new RuntimeContext(); } - final JavaXmlTypeMapping javaXmlTypeMapping = new JavaXmlTypeMapping(); + JavaXmlTypeMapping javaXmlTypeMapping = new JavaXmlTypeMapping(); context.beforeUnmarshal(javaXmlTypeMapping, LifecycleCallback.NONE); List variableMapping = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("java-xml-type-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("java-xml-type-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, JavaXmlTypeMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, javaXmlTypeMapping); javaXmlTypeMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("java-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: javaType - final String javaTypeRaw = elementReader.getElementAsString(); + String javaTypeRaw = elementReader.getElementText(); - final String javaType; + String javaType; try { javaType = Adapters.collapsedStringAdapterAdapter.unmarshal(javaTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } javaXmlTypeMapping.javaType = javaType; - } else if (("root-type-qname" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("root-type-qname" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: rootTypeQname - final QName rootTypeQname = elementReader.getElementAsQName(); + QName rootTypeQname = elementReader.getElementAsQName(); javaXmlTypeMapping.rootTypeQname = rootTypeQname; - } else if (("anonymous-type-qname" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("anonymous-type-qname" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: anonymousTypeQname - final String anonymousTypeQnameRaw = elementReader.getElementAsString(); + String anonymousTypeQnameRaw = elementReader.getElementText(); - final String anonymousTypeQname; + String anonymousTypeQname; try { anonymousTypeQname = Adapters.collapsedStringAdapterAdapter.unmarshal(anonymousTypeQnameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } javaXmlTypeMapping.anonymousTypeQname = anonymousTypeQname; - } else if (("qname-scope" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("qname-scope" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: qnameScope - final String qnameScopeRaw = elementReader.getElementAsString(); + String qnameScopeRaw = elementReader.getElementText(); - final String qnameScope; + String qnameScope; try { qnameScope = Adapters.collapsedStringAdapterAdapter.unmarshal(qnameScopeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } javaXmlTypeMapping.qnameScope = qnameScope; - } else if (("variable-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("variable-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: variableMapping - final VariableMapping variableMappingItem = readVariableMapping(elementReader, context); + VariableMapping variableMappingItem = readVariableMapping(elementReader, context); if (variableMapping == null) { variableMapping = javaXmlTypeMapping.variableMapping; - if (variableMapping != null) { + if (variableMapping!= null) { variableMapping.clear(); } else { - variableMapping = new ArrayList(); + variableMapping = new ArrayList<>(); } } variableMapping.add(variableMappingItem); @@ -156,7 +162,7 @@ public final static JavaXmlTypeMapping _read(final XoXMLStreamReader reader, Run context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "java-type"), new QName("http://java.sun.com/xml/ns/javaee", "root-type-qname"), new QName("http://java.sun.com/xml/ns/javaee", "anonymous-type-qname"), new QName("http://java.sun.com/xml/ns/javaee", "qname-scope"), new QName("http://java.sun.com/xml/ns/javaee", "variable-mapping")); } } - if (variableMapping != null) { + if (variableMapping!= null) { javaXmlTypeMapping.variableMapping = variableMapping; } @@ -165,52 +171,54 @@ public final static JavaXmlTypeMapping _read(final XoXMLStreamReader reader, Run return javaXmlTypeMapping; } - public final JavaXmlTypeMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final JavaXmlTypeMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final JavaXmlTypeMapping javaXmlTypeMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, JavaXmlTypeMapping javaXmlTypeMapping, RuntimeContext context) + throws Exception + { if (javaXmlTypeMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (JavaXmlTypeMapping.class != javaXmlTypeMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (JavaXmlTypeMapping.class!= javaXmlTypeMapping.getClass()) { context.unexpectedSubclass(writer, javaXmlTypeMapping, JavaXmlTypeMapping.class); - return; + return ; } context.beforeMarshal(javaXmlTypeMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = javaXmlTypeMapping.id; - if (idRaw != null) { + String idRaw = javaXmlTypeMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(javaXmlTypeMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: javaType - final String javaTypeRaw = javaXmlTypeMapping.javaType; + String javaTypeRaw = javaXmlTypeMapping.javaType; String javaType = null; try { javaType = Adapters.collapsedStringAdapterAdapter.marshal(javaTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(javaXmlTypeMapping, "javaType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (javaType != null) { + if (javaType!= null) { writer.writeStartElement(prefix, "java-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(javaType); writer.writeEndElement(); @@ -219,36 +227,36 @@ public final static void _write(final XoXMLStreamWriter writer, final JavaXmlTyp } // ELEMENT: rootTypeQname - final QName rootTypeQname = javaXmlTypeMapping.rootTypeQname; - if (rootTypeQname != null) { + QName rootTypeQname = javaXmlTypeMapping.rootTypeQname; + if (rootTypeQname!= null) { writer.writeStartElement(prefix, "root-type-qname", "http://java.sun.com/xml/ns/javaee"); writer.writeQName(rootTypeQname); writer.writeEndElement(); } // ELEMENT: anonymousTypeQname - final String anonymousTypeQnameRaw = javaXmlTypeMapping.anonymousTypeQname; + String anonymousTypeQnameRaw = javaXmlTypeMapping.anonymousTypeQname; String anonymousTypeQname = null; try { anonymousTypeQname = Adapters.collapsedStringAdapterAdapter.marshal(anonymousTypeQnameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(javaXmlTypeMapping, "anonymousTypeQname", CollapsedStringAdapter.class, String.class, String.class, e); } - if (anonymousTypeQname != null) { + if (anonymousTypeQname!= null) { writer.writeStartElement(prefix, "anonymous-type-qname", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(anonymousTypeQname); writer.writeEndElement(); } // ELEMENT: qnameScope - final String qnameScopeRaw = javaXmlTypeMapping.qnameScope; + String qnameScopeRaw = javaXmlTypeMapping.qnameScope; String qnameScope = null; try { qnameScope = Adapters.collapsedStringAdapterAdapter.marshal(qnameScopeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(javaXmlTypeMapping, "qnameScope", CollapsedStringAdapter.class, String.class, String.class, e); } - if (qnameScope != null) { + if (qnameScope!= null) { writer.writeStartElement(prefix, "qname-scope", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(qnameScope); writer.writeEndElement(); @@ -257,10 +265,10 @@ public final static void _write(final XoXMLStreamWriter writer, final JavaXmlTyp } // ELEMENT: variableMapping - final List variableMapping = javaXmlTypeMapping.variableMapping; - if (variableMapping != null) { - for (final VariableMapping variableMappingItem : variableMapping) { - if (variableMappingItem != null) { + List variableMapping = javaXmlTypeMapping.variableMapping; + if (variableMapping!= null) { + for (VariableMapping variableMappingItem: variableMapping) { + if (variableMappingItem!= null) { writer.writeStartElement(prefix, "variable-mapping", "http://java.sun.com/xml/ns/javaee"); writeVariableMapping(writer, variableMappingItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JspConfig$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JspConfig$JAXB.java index b73949f1edd..e6e1b107ee1 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JspConfig$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JspConfig$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.JspPropertyGroup$JAXB.readJspPropertyGroup; import static org.apache.openejb.jee.JspPropertyGroup$JAXB.writeJspPropertyGroup; @@ -38,30 +39,35 @@ "StringEquality" }) public class JspConfig$JAXB - extends JAXBObject { + extends JAXBObject +{ public JspConfig$JAXB() { super(JspConfig.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "jsp-configType".intern()), Taglib$JAXB.class, JspPropertyGroup$JAXB.class); } - public static JspConfig readJspConfig(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static JspConfig readJspConfig(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeJspConfig(final XoXMLStreamWriter writer, final JspConfig jspConfig, final RuntimeContext context) - throws Exception { + public static void writeJspConfig(XoXMLStreamWriter writer, JspConfig jspConfig, RuntimeContext context) + throws Exception + { _write(writer, jspConfig, context); } - public void write(final XoXMLStreamWriter writer, final JspConfig jspConfig, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, JspConfig jspConfig, RuntimeContext context) + throws Exception + { _write(writer, jspConfig, context); } - public final static JspConfig _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final JspConfig _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,55 +78,55 @@ public final static JspConfig _read(final XoXMLStreamReader reader, RuntimeConte context = new RuntimeContext(); } - final JspConfig jspConfig = new JspConfig(); + JspConfig jspConfig = new JspConfig(); context.beforeUnmarshal(jspConfig, LifecycleCallback.NONE); List taglib = null; List jspPropertyGroup = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("jsp-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("jsp-configType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, JspConfig.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, jspConfig); jspConfig.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("taglib" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("taglib" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: taglib - final Taglib taglibItem = readTaglib(elementReader, context); + Taglib taglibItem = readTaglib(elementReader, context); if (taglib == null) { taglib = jspConfig.taglib; - if (taglib != null) { + if (taglib!= null) { taglib.clear(); } else { - taglib = new ArrayList(); + taglib = new ArrayList<>(); } } taglib.add(taglibItem); - } else if (("jsp-property-group" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("jsp-property-group" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: jspPropertyGroup - final JspPropertyGroup jspPropertyGroupItem = readJspPropertyGroup(elementReader, context); + JspPropertyGroup jspPropertyGroupItem = readJspPropertyGroup(elementReader, context); if (jspPropertyGroup == null) { jspPropertyGroup = jspConfig.jspPropertyGroup; - if (jspPropertyGroup != null) { + if (jspPropertyGroup!= null) { jspPropertyGroup.clear(); } else { - jspPropertyGroup = new ArrayList(); + jspPropertyGroup = new ArrayList<>(); } } jspPropertyGroup.add(jspPropertyGroupItem); @@ -128,10 +134,10 @@ public final static JspConfig _read(final XoXMLStreamReader reader, RuntimeConte context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "taglib"), new QName("http://java.sun.com/xml/ns/javaee", "jsp-property-group")); } } - if (taglib != null) { + if (taglib!= null) { jspConfig.taglib = taglib; } - if (jspPropertyGroup != null) { + if (jspPropertyGroup!= null) { jspConfig.jspPropertyGroup = jspPropertyGroup; } @@ -140,49 +146,51 @@ public final static JspConfig _read(final XoXMLStreamReader reader, RuntimeConte return jspConfig; } - public final JspConfig read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final JspConfig read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final JspConfig jspConfig, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, JspConfig jspConfig, RuntimeContext context) + throws Exception + { if (jspConfig == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (JspConfig.class != jspConfig.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (JspConfig.class!= jspConfig.getClass()) { context.unexpectedSubclass(writer, jspConfig, JspConfig.class); - return; + return ; } context.beforeMarshal(jspConfig, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = jspConfig.id; - if (idRaw != null) { + String idRaw = jspConfig.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(jspConfig, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: taglib - final List taglib = jspConfig.taglib; - if (taglib != null) { - for (final Taglib taglibItem : taglib) { + List taglib = jspConfig.taglib; + if (taglib!= null) { + for (Taglib taglibItem: taglib) { writer.writeStartElement(prefix, "taglib", "http://java.sun.com/xml/ns/javaee"); - if (taglibItem != null) { + if (taglibItem!= null) { writeTaglib(writer, taglibItem, context); } else { writer.writeXsiNil(); @@ -192,10 +200,10 @@ public final static void _write(final XoXMLStreamWriter writer, final JspConfig } // ELEMENT: jspPropertyGroup - final List jspPropertyGroup = jspConfig.jspPropertyGroup; - if (jspPropertyGroup != null) { - for (final JspPropertyGroup jspPropertyGroupItem : jspPropertyGroup) { - if (jspPropertyGroupItem != null) { + List jspPropertyGroup = jspConfig.jspPropertyGroup; + if (jspPropertyGroup!= null) { + for (JspPropertyGroup jspPropertyGroupItem: jspPropertyGroup) { + if (jspPropertyGroupItem!= null) { writer.writeStartElement(prefix, "jsp-property-group", "http://java.sun.com/xml/ns/javaee"); writeJspPropertyGroup(writer, jspPropertyGroupItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JspPropertyGroup$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JspPropertyGroup$JAXB.java index 1ea6189fe85..fd313478e73 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JspPropertyGroup$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/JspPropertyGroup$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -38,30 +39,35 @@ "StringEquality" }) public class JspPropertyGroup$JAXB - extends JAXBObject { + extends JAXBObject +{ public JspPropertyGroup$JAXB() { super(JspPropertyGroup.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "jsp-property-groupType".intern()), Text$JAXB.class, Icon$JAXB.class); } - public static JspPropertyGroup readJspPropertyGroup(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static JspPropertyGroup readJspPropertyGroup(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeJspPropertyGroup(final XoXMLStreamWriter writer, final JspPropertyGroup jspPropertyGroup, final RuntimeContext context) - throws Exception { + public static void writeJspPropertyGroup(XoXMLStreamWriter writer, JspPropertyGroup jspPropertyGroup, RuntimeContext context) + throws Exception + { _write(writer, jspPropertyGroup, context); } - public void write(final XoXMLStreamWriter writer, final JspPropertyGroup jspPropertyGroup, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, JspPropertyGroup jspPropertyGroup, RuntimeContext context) + throws Exception + { _write(writer, jspPropertyGroup, context); } - public final static JspPropertyGroup _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final JspPropertyGroup _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,7 +78,7 @@ public final static JspPropertyGroup _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final JspPropertyGroup jspPropertyGroup = new JspPropertyGroup(); + JspPropertyGroup jspPropertyGroup = new JspPropertyGroup(); context.beforeUnmarshal(jspPropertyGroup, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -83,207 +89,207 @@ public final static JspPropertyGroup _read(final XoXMLStreamReader reader, Runti List includeCoda = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("jsp-property-groupType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("jsp-property-groupType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, JspPropertyGroup.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, jspPropertyGroup); jspPropertyGroup.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = jspPropertyGroup.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("url-pattern" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("url-pattern" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: urlPattern - final String urlPatternItemRaw = elementReader.getElementAsString(); + String urlPatternItemRaw = elementReader.getElementText(); - final String urlPatternItem; + String urlPatternItem; try { urlPatternItem = Adapters.trimStringAdapterAdapter.unmarshal(urlPatternItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, TrimStringAdapter.class, String.class, String.class, e); continue; } if (urlPattern == null) { urlPattern = jspPropertyGroup.urlPattern; - if (urlPattern != null) { + if (urlPattern!= null) { urlPattern.clear(); } else { - urlPattern = new ArrayList(); + urlPattern = new ArrayList<>(); } } urlPattern.add(urlPatternItem); - } else if (("el-ignored" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("el-ignored" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: elIgnored - final Boolean elIgnored = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean elIgnored = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); jspPropertyGroup.elIgnored = elIgnored; - } else if (("page-encoding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("page-encoding" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: pageEncoding - final String pageEncodingRaw = elementReader.getElementAsString(); + String pageEncodingRaw = elementReader.getElementText(); - final String pageEncoding; + String pageEncoding; try { pageEncoding = Adapters.collapsedStringAdapterAdapter.unmarshal(pageEncodingRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } jspPropertyGroup.pageEncoding = pageEncoding; - } else if (("scripting-invalid" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("scripting-invalid" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: scriptingInvalid - final Boolean scriptingInvalid = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean scriptingInvalid = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); jspPropertyGroup.scriptingInvalid = scriptingInvalid; - } else if (("is-xml" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("is-xml" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: isXml - final Boolean isXml = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean isXml = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); jspPropertyGroup.isXml = isXml; - } else if (("include-prelude" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("include-prelude" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: includePrelude - final String includePreludeItemRaw = elementReader.getElementAsString(); + String includePreludeItemRaw = elementReader.getElementText(); - final String includePreludeItem; + String includePreludeItem; try { includePreludeItem = Adapters.collapsedStringAdapterAdapter.unmarshal(includePreludeItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (includePrelude == null) { includePrelude = jspPropertyGroup.includePrelude; - if (includePrelude != null) { + if (includePrelude!= null) { includePrelude.clear(); } else { - includePrelude = new ArrayList(); + includePrelude = new ArrayList<>(); } } includePrelude.add(includePreludeItem); - } else if (("include-coda" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("include-coda" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: includeCoda - final String includeCodaItemRaw = elementReader.getElementAsString(); + String includeCodaItemRaw = elementReader.getElementText(); - final String includeCodaItem; + String includeCodaItem; try { includeCodaItem = Adapters.collapsedStringAdapterAdapter.unmarshal(includeCodaItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (includeCoda == null) { includeCoda = jspPropertyGroup.includeCoda; - if (includeCoda != null) { + if (includeCoda!= null) { includeCoda.clear(); } else { - includeCoda = new ArrayList(); + includeCoda = new ArrayList<>(); } } includeCoda.add(includeCodaItem); - } else if (("deferred-syntax-allowed-as-literal" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("deferred-syntax-allowed-as-literal" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: deferredSyntaxAllowedAsLiteral - final Boolean deferredSyntaxAllowedAsLiteral = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean deferredSyntaxAllowedAsLiteral = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); jspPropertyGroup.deferredSyntaxAllowedAsLiteral = deferredSyntaxAllowedAsLiteral; - } else if (("trim-directive-whitespaces" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("trim-directive-whitespaces" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: trimDirectiveWhitespaces - final Boolean trimDirectiveWhitespaces = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean trimDirectiveWhitespaces = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); jspPropertyGroup.trimDirectiveWhitespaces = trimDirectiveWhitespaces; - } else if (("default-content-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("default-content-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: defaultContentType - final String defaultContentTypeRaw = elementReader.getElementAsString(); + String defaultContentTypeRaw = elementReader.getElementText(); - final String defaultContentType; + String defaultContentType; try { defaultContentType = Adapters.collapsedStringAdapterAdapter.unmarshal(defaultContentTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } jspPropertyGroup.defaultContentType = defaultContentType; - } else if (("buffer" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("buffer" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: buffer - final String bufferRaw = elementReader.getElementAsString(); + String bufferRaw = elementReader.getElementText(); - final String buffer; + String buffer; try { buffer = Adapters.collapsedStringAdapterAdapter.unmarshal(bufferRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } jspPropertyGroup.buffer = buffer; - } else if (("error-on-undeclared-namespace" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("error-on-undeclared-namespace" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: errorOnUndeclaredNamespace - final Boolean errorOnUndeclaredNamespace = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean errorOnUndeclaredNamespace = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); jspPropertyGroup.errorOnUndeclaredNamespace = errorOnUndeclaredNamespace; } 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", "url-pattern"), new QName("http://java.sun.com/xml/ns/javaee", "el-ignored"), new QName("http://java.sun.com/xml/ns/javaee", "page-encoding"), new QName("http://java.sun.com/xml/ns/javaee", "scripting-invalid"), new QName("http://java.sun.com/xml/ns/javaee", "is-xml"), new QName("http://java.sun.com/xml/ns/javaee", "include-prelude"), new QName("http://java.sun.com/xml/ns/javaee", "include-coda"), new QName("http://java.sun.com/xml/ns/javaee", "deferred-syntax-allowed-as-literal"), new QName("http://java.sun.com/xml/ns/javaee", "trim-directive-whitespaces"), new QName("http://java.sun.com/xml/ns/javaee", "default-content-type"), new QName("http://java.sun.com/xml/ns/javaee", "buffer"), new QName("http://java.sun.com/xml/ns/javaee", "error-on-undeclared-namespace")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - jspPropertyGroup.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + jspPropertyGroup.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, JspPropertyGroup.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - jspPropertyGroup.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + jspPropertyGroup.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, JspPropertyGroup.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { jspPropertyGroup.icon = icon; } - if (urlPattern != null) { + if (urlPattern!= null) { jspPropertyGroup.urlPattern = urlPattern; } - if (includePrelude != null) { + if (includePrelude!= null) { jspPropertyGroup.includePrelude = includePrelude; } - if (includeCoda != null) { + if (includeCoda!= null) { jspPropertyGroup.includeCoda = includeCoda; } @@ -292,38 +298,40 @@ public final static JspPropertyGroup _read(final XoXMLStreamReader reader, Runti return jspPropertyGroup; } - public final JspPropertyGroup read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final JspPropertyGroup read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final JspPropertyGroup jspPropertyGroup, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, JspPropertyGroup jspPropertyGroup, RuntimeContext context) + throws Exception + { if (jspPropertyGroup == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (JspPropertyGroup.class != jspPropertyGroup.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (JspPropertyGroup.class!= jspPropertyGroup.getClass()) { context.unexpectedSubclass(writer, jspPropertyGroup, JspPropertyGroup.class); - return; + return ; } context.beforeMarshal(jspPropertyGroup, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = jspPropertyGroup.id; - if (idRaw != null) { + String idRaw = jspPropertyGroup.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(jspPropertyGroup, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -333,12 +341,12 @@ public final static void _write(final XoXMLStreamWriter writer, final JspPropert Text[] descriptions = null; try { descriptions = jspPropertyGroup.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(jspPropertyGroup, "descriptions", JspPropertyGroup.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -352,12 +360,12 @@ public final static void _write(final XoXMLStreamWriter writer, final JspPropert Text[] displayNames = null; try { displayNames = jspPropertyGroup.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(jspPropertyGroup, "displayNames", JspPropertyGroup.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -368,10 +376,10 @@ public final static void _write(final XoXMLStreamWriter writer, final JspPropert } // ELEMENT: icon - final LocalCollection icon = jspPropertyGroup.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = jspPropertyGroup.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -382,16 +390,16 @@ public final static void _write(final XoXMLStreamWriter writer, final JspPropert } // ELEMENT: urlPattern - final List urlPatternRaw = jspPropertyGroup.urlPattern; - if (urlPatternRaw != null) { - for (final String urlPatternItem : urlPatternRaw) { + List urlPatternRaw = jspPropertyGroup.urlPattern; + if (urlPatternRaw!= null) { + for (String urlPatternItem: urlPatternRaw) { String urlPattern = null; try { urlPattern = Adapters.trimStringAdapterAdapter.marshal(urlPatternItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(jspPropertyGroup, "urlPattern", TrimStringAdapter.class, List.class, List.class, e); } - if (urlPattern != null) { + if (urlPattern!= null) { writer.writeStartElement(prefix, "url-pattern", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(urlPattern); writer.writeEndElement(); @@ -402,54 +410,54 @@ public final static void _write(final XoXMLStreamWriter writer, final JspPropert } // ELEMENT: elIgnored - final Boolean elIgnored = jspPropertyGroup.elIgnored; - if (elIgnored != null) { + Boolean elIgnored = jspPropertyGroup.elIgnored; + if (elIgnored!= null) { writer.writeStartElement(prefix, "el-ignored", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(elIgnored)); writer.writeEndElement(); } // ELEMENT: pageEncoding - final String pageEncodingRaw = jspPropertyGroup.pageEncoding; + String pageEncodingRaw = jspPropertyGroup.pageEncoding; String pageEncoding = null; try { pageEncoding = Adapters.collapsedStringAdapterAdapter.marshal(pageEncodingRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(jspPropertyGroup, "pageEncoding", CollapsedStringAdapter.class, String.class, String.class, e); } - if (pageEncoding != null) { + if (pageEncoding!= null) { writer.writeStartElement(prefix, "page-encoding", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(pageEncoding); writer.writeEndElement(); } // ELEMENT: scriptingInvalid - final Boolean scriptingInvalid = jspPropertyGroup.scriptingInvalid; - if (scriptingInvalid != null) { + Boolean scriptingInvalid = jspPropertyGroup.scriptingInvalid; + if (scriptingInvalid!= null) { writer.writeStartElement(prefix, "scripting-invalid", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(scriptingInvalid)); writer.writeEndElement(); } // ELEMENT: isXml - final Boolean isXml = jspPropertyGroup.isXml; - if (isXml != null) { + Boolean isXml = jspPropertyGroup.isXml; + if (isXml!= null) { writer.writeStartElement(prefix, "is-xml", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(isXml)); writer.writeEndElement(); } // ELEMENT: includePrelude - final List includePreludeRaw = jspPropertyGroup.includePrelude; - if (includePreludeRaw != null) { - for (final String includePreludeItem : includePreludeRaw) { + List includePreludeRaw = jspPropertyGroup.includePrelude; + if (includePreludeRaw!= null) { + for (String includePreludeItem: includePreludeRaw) { String includePrelude = null; try { includePrelude = Adapters.collapsedStringAdapterAdapter.marshal(includePreludeItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(jspPropertyGroup, "includePrelude", CollapsedStringAdapter.class, List.class, List.class, e); } - if (includePrelude != null) { + if (includePrelude!= null) { writer.writeStartElement(prefix, "include-prelude", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(includePrelude); writer.writeEndElement(); @@ -458,16 +466,16 @@ public final static void _write(final XoXMLStreamWriter writer, final JspPropert } // ELEMENT: includeCoda - final List includeCodaRaw = jspPropertyGroup.includeCoda; - if (includeCodaRaw != null) { - for (final String includeCodaItem : includeCodaRaw) { + List includeCodaRaw = jspPropertyGroup.includeCoda; + if (includeCodaRaw!= null) { + for (String includeCodaItem: includeCodaRaw) { String includeCoda = null; try { includeCoda = Adapters.collapsedStringAdapterAdapter.marshal(includeCodaItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(jspPropertyGroup, "includeCoda", CollapsedStringAdapter.class, List.class, List.class, e); } - if (includeCoda != null) { + if (includeCoda!= null) { writer.writeStartElement(prefix, "include-coda", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(includeCoda); writer.writeEndElement(); @@ -476,52 +484,52 @@ public final static void _write(final XoXMLStreamWriter writer, final JspPropert } // ELEMENT: deferredSyntaxAllowedAsLiteral - final Boolean deferredSyntaxAllowedAsLiteral = jspPropertyGroup.deferredSyntaxAllowedAsLiteral; - if (deferredSyntaxAllowedAsLiteral != null) { + Boolean deferredSyntaxAllowedAsLiteral = jspPropertyGroup.deferredSyntaxAllowedAsLiteral; + if (deferredSyntaxAllowedAsLiteral!= null) { writer.writeStartElement(prefix, "deferred-syntax-allowed-as-literal", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(deferredSyntaxAllowedAsLiteral)); writer.writeEndElement(); } // ELEMENT: trimDirectiveWhitespaces - final Boolean trimDirectiveWhitespaces = jspPropertyGroup.trimDirectiveWhitespaces; - if (trimDirectiveWhitespaces != null) { + Boolean trimDirectiveWhitespaces = jspPropertyGroup.trimDirectiveWhitespaces; + if (trimDirectiveWhitespaces!= null) { writer.writeStartElement(prefix, "trim-directive-whitespaces", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(trimDirectiveWhitespaces)); writer.writeEndElement(); } // ELEMENT: defaultContentType - final String defaultContentTypeRaw = jspPropertyGroup.defaultContentType; + String defaultContentTypeRaw = jspPropertyGroup.defaultContentType; String defaultContentType = null; try { defaultContentType = Adapters.collapsedStringAdapterAdapter.marshal(defaultContentTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(jspPropertyGroup, "defaultContentType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (defaultContentType != null) { + if (defaultContentType!= null) { writer.writeStartElement(prefix, "default-content-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(defaultContentType); writer.writeEndElement(); } // ELEMENT: buffer - final String bufferRaw = jspPropertyGroup.buffer; + String bufferRaw = jspPropertyGroup.buffer; String buffer = null; try { buffer = Adapters.collapsedStringAdapterAdapter.marshal(bufferRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(jspPropertyGroup, "buffer", CollapsedStringAdapter.class, String.class, String.class, e); } - if (buffer != null) { + if (buffer!= null) { writer.writeStartElement(prefix, "buffer", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(buffer); writer.writeEndElement(); } // ELEMENT: errorOnUndeclaredNamespace - final Boolean errorOnUndeclaredNamespace = jspPropertyGroup.errorOnUndeclaredNamespace; - if (errorOnUndeclaredNamespace != null) { + Boolean errorOnUndeclaredNamespace = jspPropertyGroup.errorOnUndeclaredNamespace; + if (errorOnUndeclaredNamespace!= null) { writer.writeStartElement(prefix, "error-on-undeclared-namespace", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(errorOnUndeclaredNamespace)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/License$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/License$JAXB.java index ddd3fd6171e..801c6751e2a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/License$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/License$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class License$JAXB - extends JAXBObject { + extends JAXBObject +{ public License$JAXB() { super(License.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "licenseType".intern()), Text$JAXB.class); } - public static License readLicense(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static License readLicense(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeLicense(final XoXMLStreamWriter writer, final License license, final RuntimeContext context) - throws Exception { + public static void writeLicense(XoXMLStreamWriter writer, License license, RuntimeContext context) + throws Exception + { _write(writer, license, context); } - public void write(final XoXMLStreamWriter writer, final License license, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, License license, RuntimeContext context) + throws Exception + { _write(writer, license, context); } - public final static License _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final License _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,52 +75,52 @@ public final static License _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final License license = new License(); + License license = new License(); context.beforeUnmarshal(license, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("licenseType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("licenseType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, License.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, license); license.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("license-required" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("license-required" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: licenseRequired - final Boolean licenseRequired = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean licenseRequired = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); license.licenseRequired = licenseRequired; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "license-required")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - license.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + license.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, License.class, "setDescriptions", Text[].class, e); } } @@ -124,38 +130,40 @@ public final static License _read(final XoXMLStreamReader reader, RuntimeContext return license; } - public final License read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final License read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final License license, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, License license, RuntimeContext context) + throws Exception + { if (license == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (License.class != license.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (License.class!= license.getClass()) { context.unexpectedSubclass(writer, license, License.class); - return; + return ; } context.beforeMarshal(license, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = license.id; - if (idRaw != null) { + String idRaw = license.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(license, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -165,12 +173,12 @@ public final static void _write(final XoXMLStreamWriter writer, final License li Text[] descriptions = null; try { descriptions = license.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(license, "descriptions", License.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -181,7 +189,7 @@ public final static void _write(final XoXMLStreamWriter writer, final License li } // ELEMENT: licenseRequired - final Boolean licenseRequired = license.licenseRequired; + Boolean licenseRequired = license.licenseRequired; writer.writeStartElement(prefix, "license-required", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(licenseRequired)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LifecycleCallback$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LifecycleCallback$JAXB.java index 6d53db5f48c..7db623b7f52 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LifecycleCallback$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LifecycleCallback$JAXB.java @@ -1,59 +1,64 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class LifecycleCallback$JAXB - extends JAXBObject { + extends JAXBObject +{ public LifecycleCallback$JAXB() { super(org.apache.openejb.jee.LifecycleCallback.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "lifecycle-callbackType".intern())); } - public static org.apache.openejb.jee.LifecycleCallback readLifecycleCallback(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static org.apache.openejb.jee.LifecycleCallback readLifecycleCallback(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeLifecycleCallback(final XoXMLStreamWriter writer, final org.apache.openejb.jee.LifecycleCallback lifecycleCallback, final RuntimeContext context) - throws Exception { + public static void writeLifecycleCallback(XoXMLStreamWriter writer, org.apache.openejb.jee.LifecycleCallback lifecycleCallback, RuntimeContext context) + throws Exception + { _write(writer, lifecycleCallback, context); } - public void write(final XoXMLStreamWriter writer, final org.apache.openejb.jee.LifecycleCallback lifecycleCallback, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, org.apache.openejb.jee.LifecycleCallback lifecycleCallback, RuntimeContext context) + throws Exception + { _write(writer, lifecycleCallback, context); } - public final static org.apache.openejb.jee.LifecycleCallback _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final org.apache.openejb.jee.LifecycleCallback _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -64,48 +69,48 @@ public final static org.apache.openejb.jee.LifecycleCallback _read(final XoXMLSt context = new RuntimeContext(); } - final org.apache.openejb.jee.LifecycleCallback lifecycleCallback = new org.apache.openejb.jee.LifecycleCallback(); + 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())) { + 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()) { + for (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())) { + for (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(); + String lifecycleCallbackClassRaw = elementReader.getElementText(); - final String lifecycleCallbackClass; + String lifecycleCallbackClass; try { lifecycleCallbackClass = Adapters.collapsedStringAdapterAdapter.unmarshal(lifecycleCallbackClassRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("lifecycle-callback-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lifecycleCallbackMethod - final String lifecycleCallbackMethodRaw = elementReader.getElementAsString(); + String lifecycleCallbackMethodRaw = elementReader.getElementText(); - final String lifecycleCallbackMethod; + String lifecycleCallbackMethod; try { lifecycleCallbackMethod = Adapters.collapsedStringAdapterAdapter.unmarshal(lifecycleCallbackMethodRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -121,54 +126,56 @@ public final static org.apache.openejb.jee.LifecycleCallback _read(final XoXMLSt return lifecycleCallback; } - public final org.apache.openejb.jee.LifecycleCallback read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final org.apache.openejb.jee.LifecycleCallback read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final org.apache.openejb.jee.LifecycleCallback lifecycleCallback, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, org.apache.openejb.jee.LifecycleCallback lifecycleCallback, RuntimeContext context) + throws Exception + { if (lifecycleCallback == null) { writer.writeXsiNil(); - return; + 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()) { + 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; + return ; } context.beforeMarshal(lifecycleCallback, org.metatype.sxc.jaxb.LifecycleCallback.NONE); // ELEMENT: lifecycleCallbackClass - final String lifecycleCallbackClassRaw = lifecycleCallback.lifecycleCallbackClass; + String lifecycleCallbackClassRaw = lifecycleCallback.lifecycleCallbackClass; String lifecycleCallbackClass = null; try { lifecycleCallbackClass = Adapters.collapsedStringAdapterAdapter.marshal(lifecycleCallbackClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(lifecycleCallback, "lifecycleCallbackClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lifecycleCallbackClass != null) { + 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 lifecycleCallbackMethodRaw = lifecycleCallback.lifecycleCallbackMethod; String lifecycleCallbackMethod = null; try { lifecycleCallbackMethod = Adapters.collapsedStringAdapterAdapter.marshal(lifecycleCallbackMethodRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(lifecycleCallback, "lifecycleCallbackMethod", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lifecycleCallbackMethod != null) { + if (lifecycleCallbackMethod!= null) { writer.writeStartElement(prefix, "lifecycle-callback-method", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lifecycleCallbackMethod); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Listener$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Listener$JAXB.java index ce81c0d224f..b85e346f4af 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Listener$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Listener$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -37,30 +38,35 @@ "StringEquality" }) public class Listener$JAXB - extends JAXBObject { + extends JAXBObject +{ public Listener$JAXB() { super(Listener.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "listenerType".intern()), Text$JAXB.class, Icon$JAXB.class); } - public static Listener readListener(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Listener readListener(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeListener(final XoXMLStreamWriter writer, final Listener listener, final RuntimeContext context) - throws Exception { + public static void writeListener(XoXMLStreamWriter writer, Listener listener, RuntimeContext context) + throws Exception + { _write(writer, listener, context); } - public void write(final XoXMLStreamWriter writer, final Listener listener, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Listener listener, RuntimeContext context) + throws Exception + { _write(writer, listener, context); } - public final static Listener _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Listener _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -71,7 +77,7 @@ public final static Listener _read(final XoXMLStreamReader reader, RuntimeContex context = new RuntimeContext(); } - final Listener listener = new Listener(); + Listener listener = new Listener(); context.beforeUnmarshal(listener, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -79,61 +85,61 @@ public final static Listener _read(final XoXMLStreamReader reader, RuntimeContex LocalCollection 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())) { + 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))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = listener.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("listener-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("listener-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: listenerClass - final String listenerClassRaw = elementReader.getElementAsString(); + String listenerClassRaw = elementReader.getElementText(); - final String listenerClass; + String listenerClass; try { listenerClass = Adapters.collapsedStringAdapterAdapter.unmarshal(listenerClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -143,21 +149,21 @@ public final static Listener _read(final XoXMLStreamReader reader, RuntimeContex 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) { + if (descriptions!= null) { try { - listener.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + listener.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Listener.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - listener.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + listener.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, Listener.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { listener.icon = icon; } @@ -166,38 +172,40 @@ public final static Listener _read(final XoXMLStreamReader reader, RuntimeContex return listener; } - public final Listener read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Listener read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Listener listener, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Listener listener, RuntimeContext context) + throws Exception + { if (listener == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Listener.class != listener.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Listener.class!= listener.getClass()) { context.unexpectedSubclass(writer, listener, Listener.class); - return; + return ; } context.beforeMarshal(listener, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = listener.id; - if (idRaw != null) { + String idRaw = listener.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(listener, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -207,12 +215,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Listener l Text[] descriptions = null; try { descriptions = listener.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(listener, "descriptions", Listener.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -226,12 +234,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Listener l Text[] displayNames = null; try { displayNames = listener.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(listener, "displayNames", Listener.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -242,10 +250,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Listener l } // ELEMENT: icon - final LocalCollection icon = listener.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = listener.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -256,14 +264,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Listener l } // ELEMENT: listenerClass - final String listenerClassRaw = listener.listenerClass; + String listenerClassRaw = listener.listenerClass; String listenerClass = null; try { listenerClass = Adapters.collapsedStringAdapterAdapter.marshal(listenerClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(listener, "listenerClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (listenerClass != null) { + if (listenerClass!= null) { writer.writeStartElement(prefix, "listener-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(listenerClass); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LocaleEncodingMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LocaleEncodingMapping$JAXB.java index 4f62098d84c..111b11c7201 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LocaleEncodingMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LocaleEncodingMapping$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class LocaleEncodingMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public LocaleEncodingMapping$JAXB() { super(LocaleEncodingMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "locale-encoding-mappingType".intern())); } - public static LocaleEncodingMapping readLocaleEncodingMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static LocaleEncodingMapping readLocaleEncodingMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeLocaleEncodingMapping(final XoXMLStreamWriter writer, final LocaleEncodingMapping localeEncodingMapping, final RuntimeContext context) - throws Exception { + public static void writeLocaleEncodingMapping(XoXMLStreamWriter writer, LocaleEncodingMapping localeEncodingMapping, RuntimeContext context) + throws Exception + { _write(writer, localeEncodingMapping, context); } - public void write(final XoXMLStreamWriter writer, final LocaleEncodingMapping localeEncodingMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, LocaleEncodingMapping localeEncodingMapping, RuntimeContext context) + throws Exception + { _write(writer, localeEncodingMapping, context); } - public final static LocaleEncodingMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final LocaleEncodingMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,53 +70,53 @@ public final static LocaleEncodingMapping _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final LocaleEncodingMapping localeEncodingMapping = new LocaleEncodingMapping(); + LocaleEncodingMapping localeEncodingMapping = new LocaleEncodingMapping(); context.beforeUnmarshal(localeEncodingMapping, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("locale-encoding-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("locale-encoding-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, LocaleEncodingMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, localeEncodingMapping); localeEncodingMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("locale" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("locale" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: locale - final String localeRaw = elementReader.getElementAsString(); + String localeRaw = elementReader.getElementText(); - final String locale; + String locale; try { locale = Adapters.collapsedStringAdapterAdapter.unmarshal(localeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } localeEncodingMapping.locale = locale; - } else if (("encoding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("encoding" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: encoding - final String encodingRaw = elementReader.getElementAsString(); + String encodingRaw = elementReader.getElementText(); - final String encoding; + String encoding; try { encoding = Adapters.collapsedStringAdapterAdapter.unmarshal(encodingRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -127,52 +132,54 @@ public final static LocaleEncodingMapping _read(final XoXMLStreamReader reader, return localeEncodingMapping; } - public final LocaleEncodingMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final LocaleEncodingMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final LocaleEncodingMapping localeEncodingMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, LocaleEncodingMapping localeEncodingMapping, RuntimeContext context) + throws Exception + { if (localeEncodingMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (LocaleEncodingMapping.class != localeEncodingMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (LocaleEncodingMapping.class!= localeEncodingMapping.getClass()) { context.unexpectedSubclass(writer, localeEncodingMapping, LocaleEncodingMapping.class); - return; + return ; } context.beforeMarshal(localeEncodingMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = localeEncodingMapping.id; - if (idRaw != null) { + String idRaw = localeEncodingMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(localeEncodingMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: locale - final String localeRaw = localeEncodingMapping.locale; + String localeRaw = localeEncodingMapping.locale; String locale = null; try { locale = Adapters.collapsedStringAdapterAdapter.marshal(localeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(localeEncodingMapping, "locale", CollapsedStringAdapter.class, String.class, String.class, e); } - if (locale != null) { + if (locale!= null) { writer.writeStartElement(prefix, "locale", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(locale); writer.writeEndElement(); @@ -181,14 +188,14 @@ public final static void _write(final XoXMLStreamWriter writer, final LocaleEnco } // ELEMENT: encoding - final String encodingRaw = localeEncodingMapping.encoding; + String encodingRaw = localeEncodingMapping.encoding; String encoding = null; try { encoding = Adapters.collapsedStringAdapterAdapter.marshal(encodingRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(localeEncodingMapping, "encoding", CollapsedStringAdapter.class, String.class, String.class, e); } - if (encoding != null) { + if (encoding!= null) { writer.writeStartElement(prefix, "encoding", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(encoding); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LocaleEncodingMappingList$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LocaleEncodingMappingList$JAXB.java index 3f2b3a64f4f..34f13ad9411 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LocaleEncodingMappingList$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LocaleEncodingMappingList$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.LocaleEncodingMapping$JAXB.readLocaleEncodingMapping; import static org.apache.openejb.jee.LocaleEncodingMapping$JAXB.writeLocaleEncodingMapping; @@ -36,30 +37,35 @@ "StringEquality" }) public class LocaleEncodingMappingList$JAXB - extends JAXBObject { + extends JAXBObject +{ public LocaleEncodingMappingList$JAXB() { super(LocaleEncodingMappingList.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "locale-encoding-mapping-listType".intern()), LocaleEncodingMapping$JAXB.class); } - public static LocaleEncodingMappingList readLocaleEncodingMappingList(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static LocaleEncodingMappingList readLocaleEncodingMappingList(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeLocaleEncodingMappingList(final XoXMLStreamWriter writer, final LocaleEncodingMappingList localeEncodingMappingList, final RuntimeContext context) - throws Exception { + public static void writeLocaleEncodingMappingList(XoXMLStreamWriter writer, LocaleEncodingMappingList localeEncodingMappingList, RuntimeContext context) + throws Exception + { _write(writer, localeEncodingMappingList, context); } - public void write(final XoXMLStreamWriter writer, final LocaleEncodingMappingList localeEncodingMappingList, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, LocaleEncodingMappingList localeEncodingMappingList, RuntimeContext context) + throws Exception + { _write(writer, localeEncodingMappingList, context); } - public final static LocaleEncodingMappingList _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final LocaleEncodingMappingList _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,42 +76,42 @@ public final static LocaleEncodingMappingList _read(final XoXMLStreamReader read context = new RuntimeContext(); } - final LocaleEncodingMappingList localeEncodingMappingList = new LocaleEncodingMappingList(); + LocaleEncodingMappingList localeEncodingMappingList = new LocaleEncodingMappingList(); context.beforeUnmarshal(localeEncodingMappingList, LifecycleCallback.NONE); List localeEncodingMapping = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("locale-encoding-mapping-listType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("locale-encoding-mapping-listType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, LocaleEncodingMappingList.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, localeEncodingMappingList); localeEncodingMappingList.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("locale-encoding-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("locale-encoding-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: localeEncodingMapping - final LocaleEncodingMapping localeEncodingMappingItem = readLocaleEncodingMapping(elementReader, context); + LocaleEncodingMapping localeEncodingMappingItem = readLocaleEncodingMapping(elementReader, context); if (localeEncodingMapping == null) { localeEncodingMapping = localeEncodingMappingList.localeEncodingMapping; - if (localeEncodingMapping != null) { + if (localeEncodingMapping!= null) { localeEncodingMapping.clear(); } else { - localeEncodingMapping = new ArrayList(); + localeEncodingMapping = new ArrayList<>(); } } localeEncodingMapping.add(localeEncodingMappingItem); @@ -113,7 +119,7 @@ public final static LocaleEncodingMappingList _read(final XoXMLStreamReader read context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "locale-encoding-mapping")); } } - if (localeEncodingMapping != null) { + if (localeEncodingMapping!= null) { localeEncodingMappingList.localeEncodingMapping = localeEncodingMapping; } @@ -122,47 +128,49 @@ public final static LocaleEncodingMappingList _read(final XoXMLStreamReader read return localeEncodingMappingList; } - public final LocaleEncodingMappingList read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final LocaleEncodingMappingList read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final LocaleEncodingMappingList localeEncodingMappingList, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, LocaleEncodingMappingList localeEncodingMappingList, RuntimeContext context) + throws Exception + { if (localeEncodingMappingList == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (LocaleEncodingMappingList.class != localeEncodingMappingList.getClass()) { + if (LocaleEncodingMappingList.class!= localeEncodingMappingList.getClass()) { context.unexpectedSubclass(writer, localeEncodingMappingList, LocaleEncodingMappingList.class); - return; + return ; } context.beforeMarshal(localeEncodingMappingList, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = localeEncodingMappingList.id; - if (idRaw != null) { + String idRaw = localeEncodingMappingList.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(localeEncodingMappingList, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: localeEncodingMapping - final List localeEncodingMapping = localeEncodingMappingList.localeEncodingMapping; - if (localeEncodingMapping != null) { - for (final LocaleEncodingMapping localeEncodingMappingItem : localeEncodingMapping) { - if (localeEncodingMappingItem != null) { + List localeEncodingMapping = localeEncodingMappingList.localeEncodingMapping; + if (localeEncodingMapping!= null) { + for (LocaleEncodingMapping localeEncodingMappingItem: localeEncodingMapping) { + if (localeEncodingMappingItem!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "locale-encoding-mapping"); writeLocaleEncodingMapping(writer, localeEncodingMappingItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LoginConfig$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LoginConfig$JAXB.java index 909e1109320..4e650f2ea3e 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LoginConfig$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/LoginConfig$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.FormLoginConfig$JAXB.readFormLoginConfig; import static org.apache.openejb.jee.FormLoginConfig$JAXB.writeFormLoginConfig; @@ -34,30 +35,35 @@ "StringEquality" }) public class LoginConfig$JAXB - extends JAXBObject { + extends JAXBObject +{ public LoginConfig$JAXB() { super(LoginConfig.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "login-configType".intern()), FormLoginConfig$JAXB.class); } - public static LoginConfig readLoginConfig(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static LoginConfig readLoginConfig(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeLoginConfig(final XoXMLStreamWriter writer, final LoginConfig loginConfig, final RuntimeContext context) - throws Exception { + public static void writeLoginConfig(XoXMLStreamWriter writer, LoginConfig loginConfig, RuntimeContext context) + throws Exception + { _write(writer, loginConfig, context); } - public void write(final XoXMLStreamWriter writer, final LoginConfig loginConfig, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, LoginConfig loginConfig, RuntimeContext context) + throws Exception + { _write(writer, loginConfig, context); } - public final static LoginConfig _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final LoginConfig _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -68,61 +74,61 @@ public final static LoginConfig _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final LoginConfig loginConfig = new LoginConfig(); + LoginConfig loginConfig = new LoginConfig(); context.beforeUnmarshal(loginConfig, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("login-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("login-configType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, LoginConfig.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, loginConfig); loginConfig.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("auth-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("auth-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: authMethod - final String authMethodRaw = elementReader.getElementAsString(); + String authMethodRaw = elementReader.getElementText(); - final String authMethod; + String authMethod; try { authMethod = Adapters.collapsedStringAdapterAdapter.unmarshal(authMethodRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } loginConfig.authMethod = authMethod; - } else if (("realm-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("realm-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: realmName - final String realmNameRaw = elementReader.getElementAsString(); + String realmNameRaw = elementReader.getElementText(); - final String realmName; + String realmName; try { realmName = Adapters.collapsedStringAdapterAdapter.unmarshal(realmNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } loginConfig.realmName = realmName; - } else if (("form-login-config" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("form-login-config" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: formLoginConfig - final FormLoginConfig formLoginConfig = readFormLoginConfig(elementReader, context); + FormLoginConfig formLoginConfig = readFormLoginConfig(elementReader, context); loginConfig.formLoginConfig = formLoginConfig; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "auth-method"), new QName("http://java.sun.com/xml/ns/javaee", "realm-name"), new QName("http://java.sun.com/xml/ns/javaee", "form-login-config")); @@ -134,74 +140,76 @@ public final static LoginConfig _read(final XoXMLStreamReader reader, RuntimeCon return loginConfig; } - public final LoginConfig read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final LoginConfig read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final LoginConfig loginConfig, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, LoginConfig loginConfig, RuntimeContext context) + throws Exception + { if (loginConfig == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (LoginConfig.class != loginConfig.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (LoginConfig.class!= loginConfig.getClass()) { context.unexpectedSubclass(writer, loginConfig, LoginConfig.class); - return; + return ; } context.beforeMarshal(loginConfig, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = loginConfig.id; - if (idRaw != null) { + String idRaw = loginConfig.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(loginConfig, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: authMethod - final String authMethodRaw = loginConfig.authMethod; + String authMethodRaw = loginConfig.authMethod; String authMethod = null; try { authMethod = Adapters.collapsedStringAdapterAdapter.marshal(authMethodRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(loginConfig, "authMethod", CollapsedStringAdapter.class, String.class, String.class, e); } - if (authMethod != null) { + if (authMethod!= null) { writer.writeStartElement(prefix, "auth-method", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(authMethod); writer.writeEndElement(); } // ELEMENT: realmName - final String realmNameRaw = loginConfig.realmName; + String realmNameRaw = loginConfig.realmName; String realmName = null; try { realmName = Adapters.collapsedStringAdapterAdapter.marshal(realmNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(loginConfig, "realmName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (realmName != null) { + if (realmName!= null) { writer.writeStartElement(prefix, "realm-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(realmName); writer.writeEndElement(); } // ELEMENT: formLoginConfig - final FormLoginConfig formLoginConfig = loginConfig.formLoginConfig; - if (formLoginConfig != null) { + FormLoginConfig formLoginConfig = loginConfig.formLoginConfig; + if (formLoginConfig!= null) { writer.writeStartElement(prefix, "form-login-config", "http://java.sun.com/xml/ns/javaee"); writeFormLoginConfig(writer, formLoginConfig, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageAdapter$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageAdapter$JAXB.java index 7b92065d4bd..753c5caa2e4 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageAdapter$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageAdapter$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.MessageListener$JAXB.readMessageListener; import static org.apache.openejb.jee.MessageListener$JAXB.writeMessageListener; @@ -36,30 +37,35 @@ "StringEquality" }) public class MessageAdapter$JAXB - extends JAXBObject { + extends JAXBObject +{ public MessageAdapter$JAXB() { super(MessageAdapter.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "messageadapterType".intern()), MessageListener$JAXB.class); } - public static MessageAdapter readMessageAdapter(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static MessageAdapter readMessageAdapter(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMessageAdapter(final XoXMLStreamWriter writer, final MessageAdapter messageAdapter, final RuntimeContext context) - throws Exception { + public static void writeMessageAdapter(XoXMLStreamWriter writer, MessageAdapter messageAdapter, RuntimeContext context) + throws Exception + { _write(writer, messageAdapter, context); } - public void write(final XoXMLStreamWriter writer, final MessageAdapter messageAdapter, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, MessageAdapter messageAdapter, RuntimeContext context) + throws Exception + { _write(writer, messageAdapter, context); } - public final static MessageAdapter _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final MessageAdapter _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,42 +76,42 @@ public final static MessageAdapter _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final MessageAdapter messageAdapter = new MessageAdapter(); + MessageAdapter messageAdapter = new MessageAdapter(); context.beforeUnmarshal(messageAdapter, LifecycleCallback.NONE); List messageListener = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("messageadapterType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("messageadapterType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, MessageAdapter.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, messageAdapter); messageAdapter.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("messagelistener" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("messagelistener" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageListener - final MessageListener messageListenerItem = readMessageListener(elementReader, context); + MessageListener messageListenerItem = readMessageListener(elementReader, context); if (messageListener == null) { messageListener = messageAdapter.messageListener; - if (messageListener != null) { + if (messageListener!= null) { messageListener.clear(); } else { - messageListener = new ArrayList(); + messageListener = new ArrayList<>(); } } messageListener.add(messageListenerItem); @@ -113,7 +119,7 @@ public final static MessageAdapter _read(final XoXMLStreamReader reader, Runtime context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "messagelistener")); } } - if (messageListener != null) { + if (messageListener!= null) { messageAdapter.messageListener = messageListener; } @@ -122,47 +128,49 @@ public final static MessageAdapter _read(final XoXMLStreamReader reader, Runtime return messageAdapter; } - public final MessageAdapter read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final MessageAdapter read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final MessageAdapter messageAdapter, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, MessageAdapter messageAdapter, RuntimeContext context) + throws Exception + { if (messageAdapter == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (MessageAdapter.class != messageAdapter.getClass()) { + if (MessageAdapter.class!= messageAdapter.getClass()) { context.unexpectedSubclass(writer, messageAdapter, MessageAdapter.class); - return; + return ; } context.beforeMarshal(messageAdapter, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = messageAdapter.id; - if (idRaw != null) { + String idRaw = messageAdapter.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageAdapter, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: messageListener - final List messageListener = messageAdapter.messageListener; - if (messageListener != null) { - for (final MessageListener messageListenerItem : messageListener) { - if (messageListenerItem != null) { + List messageListener = messageAdapter.messageListener; + if (messageListener!= null) { + for (MessageListener messageListenerItem: messageListener) { + if (messageListenerItem!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "messagelistener"); writeMessageListener(writer, messageListenerItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestination$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestination$JAXB.java index c4c3ad473e6..d0b9055ae41 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestination$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestination$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -37,30 +38,35 @@ "StringEquality" }) public class MessageDestination$JAXB - extends JAXBObject { + extends JAXBObject +{ public MessageDestination$JAXB() { super(MessageDestination.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "message-destinationType".intern()), Text$JAXB.class, Icon$JAXB.class); } - public static MessageDestination readMessageDestination(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static MessageDestination readMessageDestination(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMessageDestination(final XoXMLStreamWriter writer, final MessageDestination messageDestination, final RuntimeContext context) - throws Exception { + public static void writeMessageDestination(XoXMLStreamWriter writer, MessageDestination messageDestination, RuntimeContext context) + throws Exception + { _write(writer, messageDestination, context); } - public void write(final XoXMLStreamWriter writer, final MessageDestination messageDestination, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, MessageDestination messageDestination, RuntimeContext context) + throws Exception + { _write(writer, messageDestination, context); } - public final static MessageDestination _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final MessageDestination _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -71,7 +77,7 @@ public final static MessageDestination _read(final XoXMLStreamReader reader, Run context = new RuntimeContext(); } - final MessageDestination messageDestination = new MessageDestination(); + MessageDestination messageDestination = new MessageDestination(); context.beforeUnmarshal(messageDestination, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -79,87 +85,87 @@ public final static MessageDestination _read(final XoXMLStreamReader reader, Run LocalCollection icon = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("message-destinationType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("message-destinationType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, MessageDestination.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, messageDestination); messageDestination.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = messageDestination.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("message-destination-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationName - final String messageDestinationNameRaw = elementReader.getElementAsString(); + String messageDestinationNameRaw = elementReader.getElementText(); - final String messageDestinationName; + String messageDestinationName; try { messageDestinationName = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDestination.messageDestinationName = messageDestinationName; - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDestination.mappedName = mappedName; - } else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lookup-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lookupName - final String lookupNameRaw = elementReader.getElementAsString(); + String lookupNameRaw = elementReader.getElementText(); - final String lookupName; + String lookupName; try { lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -169,21 +175,21 @@ public final static MessageDestination _read(final XoXMLStreamReader reader, Run 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", "message-destination-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "lookup-name")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - messageDestination.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + messageDestination.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, MessageDestination.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - messageDestination.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + messageDestination.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, MessageDestination.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { messageDestination.icon = icon; } @@ -192,38 +198,40 @@ public final static MessageDestination _read(final XoXMLStreamReader reader, Run return messageDestination; } - public final MessageDestination read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final MessageDestination read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final MessageDestination messageDestination, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, MessageDestination messageDestination, RuntimeContext context) + throws Exception + { if (messageDestination == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (MessageDestination.class != messageDestination.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (MessageDestination.class!= messageDestination.getClass()) { context.unexpectedSubclass(writer, messageDestination, MessageDestination.class); - return; + return ; } context.beforeMarshal(messageDestination, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = messageDestination.id; - if (idRaw != null) { + String idRaw = messageDestination.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDestination, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -233,12 +241,12 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDes Text[] descriptions = null; try { descriptions = messageDestination.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(messageDestination, "descriptions", MessageDestination.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -252,12 +260,12 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDes Text[] displayNames = null; try { displayNames = messageDestination.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(messageDestination, "displayNames", MessageDestination.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -268,10 +276,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDes } // ELEMENT: icon - final LocalCollection icon = messageDestination.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = messageDestination.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -282,14 +290,14 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDes } // ELEMENT: messageDestinationName - final String messageDestinationNameRaw = messageDestination.messageDestinationName; + String messageDestinationNameRaw = messageDestination.messageDestinationName; String messageDestinationName = null; try { messageDestinationName = Adapters.collapsedStringAdapterAdapter.marshal(messageDestinationNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDestination, "messageDestinationName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (messageDestinationName != null) { + if (messageDestinationName!= null) { writer.writeStartElement(prefix, "message-destination-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(messageDestinationName); writer.writeEndElement(); @@ -298,28 +306,28 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDes } // ELEMENT: mappedName - final String mappedNameRaw = messageDestination.mappedName; + String mappedNameRaw = messageDestination.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDestination, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + if (mappedName!= null) { writer.writeStartElement(prefix, "mapped-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(mappedName); writer.writeEndElement(); } // ELEMENT: lookupName - final String lookupNameRaw = messageDestination.lookupName; + String lookupNameRaw = messageDestination.lookupName; String lookupName = null; try { lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDestination, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lookupName != null) { + if (lookupName!= null) { writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lookupName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestinationRef$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestinationRef$JAXB.java index 8d8e315a4a3..90c54eec2f3 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestinationRef$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestinationRef$JAXB.java @@ -1,21 +1,28 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,12 +30,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; import static org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget; import static org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget; @@ -41,30 +42,35 @@ "StringEquality" }) public class MessageDestinationRef$JAXB - extends JAXBObject { + extends JAXBObject +{ public MessageDestinationRef$JAXB() { super(MessageDestinationRef.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "message-destination-refType".intern()), Text$JAXB.class, MessageDestinationUsage$JAXB.class, InjectionTarget$JAXB.class); } - public static MessageDestinationRef readMessageDestinationRef(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static MessageDestinationRef readMessageDestinationRef(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMessageDestinationRef(final XoXMLStreamWriter writer, final MessageDestinationRef messageDestinationRef, final RuntimeContext context) - throws Exception { + public static void writeMessageDestinationRef(XoXMLStreamWriter writer, MessageDestinationRef messageDestinationRef, RuntimeContext context) + throws Exception + { _write(writer, messageDestinationRef, context); } - public void write(final XoXMLStreamWriter writer, final MessageDestinationRef messageDestinationRef, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, MessageDestinationRef messageDestinationRef, RuntimeContext context) + throws Exception + { _write(writer, messageDestinationRef, context); } - public final static MessageDestinationRef _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final MessageDestinationRef _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -75,119 +81,119 @@ public final static MessageDestinationRef _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final MessageDestinationRef messageDestinationRef = new MessageDestinationRef(); + MessageDestinationRef messageDestinationRef = new MessageDestinationRef(); context.beforeUnmarshal(messageDestinationRef, LifecycleCallback.NONE); ArrayList descriptions = null; Set injectionTarget = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("message-destination-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("message-destination-refType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, MessageDestinationRef.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, messageDestinationRef); messageDestinationRef.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("message-destination-ref-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-ref-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationRefName - final String messageDestinationRefNameRaw = elementReader.getElementAsString(); + String messageDestinationRefNameRaw = elementReader.getElementText(); - final String messageDestinationRefName; + String messageDestinationRefName; try { messageDestinationRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDestinationRef.messageDestinationRefName = messageDestinationRefName; - } else if (("message-destination-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationType - final String messageDestinationTypeRaw = elementReader.getElementAsString(); + String messageDestinationTypeRaw = elementReader.getElementText(); - final String messageDestinationType; + String messageDestinationType; try { messageDestinationType = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDestinationRef.messageDestinationType = messageDestinationType; - } else if (("message-destination-usage" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-usage" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationUsage - final MessageDestinationUsage messageDestinationUsage = parseMessageDestinationUsage(elementReader, context, elementReader.getElementAsString()); - if (messageDestinationUsage != null) { + MessageDestinationUsage messageDestinationUsage = parseMessageDestinationUsage(elementReader, context, elementReader.getElementText()); + if (messageDestinationUsage!= null) { messageDestinationRef.messageDestinationUsage = messageDestinationUsage; } - } else if (("message-destination-link" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-link" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationLink - final String messageDestinationLinkRaw = elementReader.getElementAsString(); + String messageDestinationLinkRaw = elementReader.getElementText(); - final String messageDestinationLink; + String messageDestinationLink; try { messageDestinationLink = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDestinationRef.messageDestinationLink = messageDestinationLink; - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDestinationRef.mappedName = mappedName; - } else if (("injection-target" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("injection-target" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: injectionTarget - final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); + InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); if (injectionTarget == null) { injectionTarget = messageDestinationRef.injectionTarget; - if (injectionTarget != null) { + if (injectionTarget!= null) { injectionTarget.clear(); } else { - injectionTarget = new LinkedHashSet(); + injectionTarget = new LinkedHashSet<>(); } } injectionTarget.add(injectionTargetItem); - } else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lookup-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lookupName - final String lookupNameRaw = elementReader.getElementAsString(); + String lookupNameRaw = elementReader.getElementText(); - final String lookupName; + String lookupName; try { lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -197,14 +203,14 @@ public final static MessageDestinationRef _read(final XoXMLStreamReader reader, context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-ref-name"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-type"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-usage"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-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) { + if (descriptions!= null) { try { - messageDestinationRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + messageDestinationRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, MessageDestinationRef.class, "setDescriptions", Text[].class, e); } } - if (injectionTarget != null) { + if (injectionTarget!= null) { messageDestinationRef.injectionTarget = injectionTarget; } @@ -213,38 +219,40 @@ public final static MessageDestinationRef _read(final XoXMLStreamReader reader, return messageDestinationRef; } - public final MessageDestinationRef read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final MessageDestinationRef read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final MessageDestinationRef messageDestinationRef, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, MessageDestinationRef messageDestinationRef, RuntimeContext context) + throws Exception + { if (messageDestinationRef == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (MessageDestinationRef.class != messageDestinationRef.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (MessageDestinationRef.class!= messageDestinationRef.getClass()) { context.unexpectedSubclass(writer, messageDestinationRef, MessageDestinationRef.class); - return; + return ; } context.beforeMarshal(messageDestinationRef, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = messageDestinationRef.id; - if (idRaw != null) { + String idRaw = messageDestinationRef.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDestinationRef, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -254,12 +262,12 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDes Text[] descriptions = null; try { descriptions = messageDestinationRef.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(messageDestinationRef, "descriptions", MessageDestinationRef.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -270,14 +278,14 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDes } // ELEMENT: messageDestinationRefName - final String messageDestinationRefNameRaw = messageDestinationRef.messageDestinationRefName; + String messageDestinationRefNameRaw = messageDestinationRef.messageDestinationRefName; String messageDestinationRefName = null; try { messageDestinationRefName = Adapters.collapsedStringAdapterAdapter.marshal(messageDestinationRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDestinationRef, "messageDestinationRefName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (messageDestinationRefName != null) { + if (messageDestinationRefName!= null) { writer.writeStartElement(prefix, "message-destination-ref-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(messageDestinationRefName); writer.writeEndElement(); @@ -286,60 +294,60 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDes } // ELEMENT: messageDestinationType - final String messageDestinationTypeRaw = messageDestinationRef.messageDestinationType; + String messageDestinationTypeRaw = messageDestinationRef.messageDestinationType; String messageDestinationType = null; try { messageDestinationType = Adapters.collapsedStringAdapterAdapter.marshal(messageDestinationTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDestinationRef, "messageDestinationType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (messageDestinationType != null) { + if (messageDestinationType!= null) { writer.writeStartElement(prefix, "message-destination-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(messageDestinationType); writer.writeEndElement(); } // ELEMENT: messageDestinationUsage - final MessageDestinationUsage messageDestinationUsage = messageDestinationRef.messageDestinationUsage; - if (messageDestinationUsage != null) { + MessageDestinationUsage messageDestinationUsage = messageDestinationRef.messageDestinationUsage; + if (messageDestinationUsage!= null) { writer.writeStartElement(prefix, "message-destination-usage", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringMessageDestinationUsage(messageDestinationRef, null, context, messageDestinationUsage)); writer.writeEndElement(); } // ELEMENT: messageDestinationLink - final String messageDestinationLinkRaw = messageDestinationRef.messageDestinationLink; + String messageDestinationLinkRaw = messageDestinationRef.messageDestinationLink; String messageDestinationLink = null; try { messageDestinationLink = Adapters.collapsedStringAdapterAdapter.marshal(messageDestinationLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDestinationRef, "messageDestinationLink", CollapsedStringAdapter.class, String.class, String.class, e); } - if (messageDestinationLink != null) { + if (messageDestinationLink!= null) { writer.writeStartElement(prefix, "message-destination-link", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(messageDestinationLink); writer.writeEndElement(); } // ELEMENT: mappedName - final String mappedNameRaw = messageDestinationRef.mappedName; + String mappedNameRaw = messageDestinationRef.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDestinationRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + 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 = messageDestinationRef.injectionTarget; - if (injectionTarget != null) { - for (final InjectionTarget injectionTargetItem : injectionTarget) { - if (injectionTargetItem != null) { + Set injectionTarget = messageDestinationRef.injectionTarget; + if (injectionTarget!= null) { + for (InjectionTarget injectionTargetItem: injectionTarget) { + if (injectionTargetItem!= null) { writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee"); writeInjectionTarget(writer, injectionTargetItem, context); writer.writeEndElement(); @@ -350,14 +358,14 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDes } // ELEMENT: lookupName - final String lookupNameRaw = messageDestinationRef.lookupName; + String lookupNameRaw = messageDestinationRef.lookupName; String lookupName = null; try { lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDestinationRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lookupName != null) { + if (lookupName!= null) { writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lookupName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestinationUsage$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestinationUsage$JAXB.java index 42a38f698f6..1bfa580c42b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestinationUsage$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDestinationUsage$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class MessageDestinationUsage$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public MessageDestinationUsage$JAXB() { super(MessageDestinationUsage.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "messageDestinationUsage".intern())); } - public MessageDestinationUsage parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public MessageDestinationUsage parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseMessageDestinationUsage(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final MessageDestinationUsage messageDestinationUsage) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, MessageDestinationUsage messageDestinationUsage) + throws Exception + { return toStringMessageDestinationUsage(bean, parameterName, context, messageDestinationUsage); } - public static MessageDestinationUsage parseMessageDestinationUsage(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static MessageDestinationUsage parseMessageDestinationUsage(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Consumes".equals(value)) { return MessageDestinationUsage.CONSUMES; } else if ("Produces".equals(value)) { @@ -54,8 +58,9 @@ public static MessageDestinationUsage parseMessageDestinationUsage(final XoXMLSt } } - public static String toStringMessageDestinationUsage(final Object bean, final String parameterName, final RuntimeContext context, final MessageDestinationUsage messageDestinationUsage) - throws Exception { + public static String toStringMessageDestinationUsage(Object bean, String parameterName, RuntimeContext context, MessageDestinationUsage messageDestinationUsage) + throws Exception + { if (MessageDestinationUsage.CONSUMES == messageDestinationUsage) { return "Consumes"; } else if (MessageDestinationUsage.PRODUCES == messageDestinationUsage) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java index b39efe31c61..79bd1238ccf 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java @@ -1,32 +1,34 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.ActivationConfig$JAXB.readActivationConfig; import static org.apache.openejb.jee.ActivationConfig$JAXB.writeActivationConfig; @@ -34,6 +36,8 @@ import static org.apache.openejb.jee.AroundInvoke$JAXB.writeAroundInvoke; import static org.apache.openejb.jee.AroundTimeout$JAXB.readAroundTimeout; import static org.apache.openejb.jee.AroundTimeout$JAXB.writeAroundTimeout; +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; @@ -44,6 +48,10 @@ import static org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback; import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef; @@ -77,30 +85,36 @@ "StringEquality" }) public class MessageDrivenBean$JAXB - extends JAXBObject { + extends JAXBObject +{ + private static final FieldAccessor> messageDrivenBeanContextService = new FieldAccessor<>(MessageDrivenBean.class, "contextService"); public MessageDrivenBean$JAXB() { - super(MessageDrivenBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "message-driven-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, TransactionType$JAXB.class, MessageDrivenDestination$JAXB.class, ActivationConfig$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class); + super(MessageDrivenBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "message-driven-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, TransactionType$JAXB.class, MessageDrivenDestination$JAXB.class, ActivationConfig$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, ContextService$JAXB.class); } - public static MessageDrivenBean readMessageDrivenBean(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static MessageDrivenBean readMessageDrivenBean(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMessageDrivenBean(final XoXMLStreamWriter writer, final MessageDrivenBean messageDrivenBean, final RuntimeContext context) - throws Exception { + public static void writeMessageDrivenBean(XoXMLStreamWriter writer, MessageDrivenBean messageDrivenBean, RuntimeContext context) + throws Exception + { _write(writer, messageDrivenBean, context); } - public void write(final XoXMLStreamWriter writer, final MessageDrivenBean messageDrivenBean, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, MessageDrivenBean messageDrivenBean, RuntimeContext context) + throws Exception + { _write(writer, messageDrivenBean, context); } - public final static MessageDrivenBean _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final MessageDrivenBean _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -111,7 +125,7 @@ public final static MessageDrivenBean _read(final XoXMLStreamReader reader, Runt context = new RuntimeContext(); } - final MessageDrivenBean messageDrivenBean = new MessageDrivenBean(); + MessageDrivenBean messageDrivenBean = new MessageDrivenBean(); context.beforeUnmarshal(messageDrivenBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); ArrayList descriptions = null; @@ -132,493 +146,543 @@ public final static MessageDrivenBean _read(final XoXMLStreamReader reader, Runt List postConstruct = null; List preDestroy = null; KeyedCollection dataSource = null; + KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; List securityRoleRef = null; + KeyedCollection contextService = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("message-driven-beanType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("message-driven-beanType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, MessageDrivenBean.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, messageDrivenBean); messageDrivenBean.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = messageDrivenBean.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbName - final String ejbNameRaw = elementReader.getElementAsString(); + String ejbNameRaw = elementReader.getElementText(); - final String ejbName; + String ejbName; try { ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDrivenBean.ejbName = ejbName; - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDrivenBean.mappedName = mappedName; - } else if (("ejb-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbClass - final String ejbClassRaw = elementReader.getElementAsString(); + String ejbClassRaw = elementReader.getElementText(); - final String ejbClass; + String ejbClass; try { ejbClass = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDrivenBean.ejbClass = ejbClass; - } else if (("messaging-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("messaging-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messagingType - final String messagingTypeRaw = elementReader.getElementAsString(); + String messagingTypeRaw = elementReader.getElementText(); - final String messagingType; + String messagingType; try { messagingType = Adapters.collapsedStringAdapterAdapter.unmarshal(messagingTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDrivenBean.messagingType = messagingType; - } else if (("timeout-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("timeout-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: timeoutMethod - final NamedMethod timeoutMethod = readNamedMethod(elementReader, context); + NamedMethod timeoutMethod = readNamedMethod(elementReader, context); messageDrivenBean.timeoutMethod = timeoutMethod; - } else if (("timer" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("timer" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: timer - final Timer timerItem = readTimer(elementReader, context); + Timer timerItem = readTimer(elementReader, context); if (timer == null) { timer = messageDrivenBean.timer; - if (timer != null) { + if (timer!= null) { timer.clear(); } else { - timer = new ArrayList(); + timer = new ArrayList<>(); } } timer.add(timerItem); - } else if (("transaction-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("transaction-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: transactionType - final TransactionType transactionType = parseTransactionType(elementReader, context, elementReader.getElementAsString()); - if (transactionType != null) { + TransactionType transactionType = parseTransactionType(elementReader, context, elementReader.getElementText()); + if (transactionType!= null) { messageDrivenBean.transactionType = transactionType; } - } else if (("message-selector" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-selector" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageSelector - final String messageSelectorRaw = elementReader.getElementAsString(); + String messageSelectorRaw = elementReader.getElementText(); - final String messageSelector; + String messageSelector; try { messageSelector = Adapters.collapsedStringAdapterAdapter.unmarshal(messageSelectorRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } try { messageDrivenBean.setMessageSelector(messageSelector); - } catch (final Exception e) { + } catch (Exception e) { context.setterError(reader, MessageDrivenBean.class, "setMessageSelector", String.class, e); } - } else if (("acknowledge-mode" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("acknowledge-mode" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: acknowledgeMode - final String acknowledgeModeRaw = elementReader.getElementAsString(); + String acknowledgeModeRaw = elementReader.getElementText(); - final String acknowledgeMode; + String acknowledgeMode; try { acknowledgeMode = Adapters.collapsedStringAdapterAdapter.unmarshal(acknowledgeModeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } try { messageDrivenBean.setAcknowledgeMode(acknowledgeMode); - } catch (final Exception e) { + } catch (Exception e) { context.setterError(reader, MessageDrivenBean.class, "setAcknowledgeMode", String.class, e); } - } else if (("message-driven-destination" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-driven-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDrivenDestination - final MessageDrivenDestination messageDrivenDestination = readMessageDrivenDestination(elementReader, context); + MessageDrivenDestination messageDrivenDestination = readMessageDrivenDestination(elementReader, context); try { messageDrivenBean.setMessageDrivenDestination(messageDrivenDestination); - } catch (final Exception e) { + } catch (Exception e) { context.setterError(reader, MessageDrivenBean.class, "setMessageDrivenDestination", MessageDrivenDestination.class, e); } - } else if (("message-destination-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationType - final String messageDestinationTypeRaw = elementReader.getElementAsString(); + String messageDestinationTypeRaw = elementReader.getElementText(); - final String messageDestinationType; + String messageDestinationType; try { messageDestinationType = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDrivenBean.messageDestinationType = messageDestinationType; - } else if (("message-destination-link" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-link" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationLink - final String messageDestinationLinkRaw = elementReader.getElementAsString(); + String messageDestinationLinkRaw = elementReader.getElementText(); - final String messageDestinationLink; + String messageDestinationLink; try { messageDestinationLink = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageDrivenBean.messageDestinationLink = messageDestinationLink; - } else if (("activation-config" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("activation-config" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: activationConfig - final ActivationConfig activationConfig = readActivationConfig(elementReader, context); + ActivationConfig activationConfig = readActivationConfig(elementReader, context); messageDrivenBean.activationConfig = activationConfig; - } else if (("around-invoke" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("around-invoke" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: aroundInvoke - final AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context); + AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context); if (aroundInvoke == null) { aroundInvoke = messageDrivenBean.aroundInvoke; - if (aroundInvoke != null) { + if (aroundInvoke!= null) { aroundInvoke.clear(); } else { - aroundInvoke = new ArrayList(); + aroundInvoke = new ArrayList<>(); } } aroundInvoke.add(aroundInvokeItem); - } else if (("around-timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("around-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: aroundTimeout - final AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context); + AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context); if (aroundTimeout == null) { aroundTimeout = messageDrivenBean.aroundTimeout; - if (aroundTimeout != null) { + if (aroundTimeout!= null) { aroundTimeout.clear(); } else { - aroundTimeout = new ArrayList(); + aroundTimeout = new ArrayList<>(); } } aroundTimeout.add(aroundTimeoutItem); - } else if (("env-entry" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: envEntry - final EnvEntry envEntryItem = readEnvEntry(elementReader, context); + EnvEntry envEntryItem = readEnvEntry(elementReader, context); if (envEntry == null) { envEntry = messageDrivenBean.envEntry; - if (envEntry != null) { + if (envEntry!= null) { envEntry.clear(); } else { - envEntry = new KeyedCollection(); + envEntry = new KeyedCollection<>(); } } envEntry.add(envEntryItem); - } else if (("ejb-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRef - final EjbRef ejbRefItem = readEjbRef(elementReader, context); + EjbRef ejbRefItem = readEjbRef(elementReader, context); if (ejbRef == null) { ejbRef = messageDrivenBean.ejbRef; - if (ejbRef != null) { + if (ejbRef!= null) { ejbRef.clear(); } else { - ejbRef = new KeyedCollection(); + ejbRef = new KeyedCollection<>(); } } ejbRef.add(ejbRefItem); - } else if (("ejb-local-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbLocalRef - final EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); if (ejbLocalRef == null) { ejbLocalRef = messageDrivenBean.ejbLocalRef; - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { ejbLocalRef.clear(); } else { - ejbLocalRef = new KeyedCollection(); + ejbLocalRef = new KeyedCollection<>(); } } ejbLocalRef.add(ejbLocalRefItem); - } else if (("service-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceRef - final ServiceRef serviceRefItem = readServiceRef(elementReader, context); + ServiceRef serviceRefItem = readServiceRef(elementReader, context); if (serviceRef == null) { serviceRef = messageDrivenBean.serviceRef; - if (serviceRef != null) { + if (serviceRef!= null) { serviceRef.clear(); } else { - serviceRef = new KeyedCollection(); + serviceRef = new KeyedCollection<>(); } } serviceRef.add(serviceRefItem); - } else if (("resource-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceRef - final ResourceRef resourceRefItem = readResourceRef(elementReader, context); + ResourceRef resourceRefItem = readResourceRef(elementReader, context); if (resourceRef == null) { resourceRef = messageDrivenBean.resourceRef; - if (resourceRef != null) { + if (resourceRef!= null) { resourceRef.clear(); } else { - resourceRef = new KeyedCollection(); + resourceRef = new KeyedCollection<>(); } } resourceRef.add(resourceRefItem); - } else if (("resource-env-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceEnvRef - final ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); if (resourceEnvRef == null) { resourceEnvRef = messageDrivenBean.resourceEnvRef; - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { resourceEnvRef.clear(); } else { - resourceEnvRef = new KeyedCollection(); + resourceEnvRef = new KeyedCollection<>(); } } resourceEnvRef.add(resourceEnvRefItem); - } else if (("message-destination-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationRef - final MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); if (messageDestinationRef == null) { messageDestinationRef = messageDrivenBean.messageDestinationRef; - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { messageDestinationRef.clear(); } else { - messageDestinationRef = new KeyedCollection(); + messageDestinationRef = new KeyedCollection<>(); } } messageDestinationRef.add(messageDestinationRefItem); - } else if (("persistence-context-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceContextRef - final PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); if (persistenceContextRef == null) { persistenceContextRef = messageDrivenBean.persistenceContextRef; - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { persistenceContextRef.clear(); } else { - persistenceContextRef = new KeyedCollection(); + persistenceContextRef = new KeyedCollection<>(); } } persistenceContextRef.add(persistenceContextRefItem); - } else if (("persistence-unit-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceUnitRef - final PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); if (persistenceUnitRef == null) { persistenceUnitRef = messageDrivenBean.persistenceUnitRef; - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { persistenceUnitRef.clear(); } else { - persistenceUnitRef = new KeyedCollection(); + persistenceUnitRef = new KeyedCollection<>(); } } persistenceUnitRef.add(persistenceUnitRefItem); - } else if (("post-construct" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("post-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: postConstruct - final org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); if (postConstruct == null) { postConstruct = messageDrivenBean.postConstruct; - if (postConstruct != null) { + if (postConstruct!= null) { postConstruct.clear(); } else { - postConstruct = new ArrayList(); + postConstruct = new ArrayList<>(); } } postConstruct.add(postConstructItem); - } else if (("pre-destroy" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("pre-destroy" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: preDestroy - final org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); if (preDestroy == null) { preDestroy = messageDrivenBean.preDestroy; - if (preDestroy != null) { + if (preDestroy!= null) { preDestroy.clear(); } else { - preDestroy = new ArrayList(); + preDestroy = new ArrayList<>(); } } preDestroy.add(preDestroyItem); - } else if (("data-source" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dataSource - final DataSource dataSourceItem = readDataSource(elementReader, context); + DataSource dataSourceItem = readDataSource(elementReader, context); if (dataSource == null) { dataSource = messageDrivenBean.dataSource; - if (dataSource != null) { + if (dataSource!= null) { dataSource.clear(); } else { - dataSource = new KeyedCollection(); + dataSource = new KeyedCollection<>(); } } dataSource.add(dataSourceItem); - } else if (("security-role-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); + if (jmsConnectionFactories == null) { + jmsConnectionFactories = messageDrivenBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + jmsConnectionFactories.clear(); + } else { + jmsConnectionFactories = new KeyedCollection<>(); + } + } + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = messageDrivenBean.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("security-role-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityRoleRef - final SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); + SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); if (securityRoleRef == null) { securityRoleRef = messageDrivenBean.securityRoleRef; - if (securityRoleRef != null) { + if (securityRoleRef!= null) { securityRoleRef.clear(); } else { - securityRoleRef = new ArrayList(); + securityRoleRef = new ArrayList<>(); } } securityRoleRef.add(securityRoleRefItem); - } else if (("security-identity" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("security-identity" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityIdentity - final SecurityIdentity securityIdentity = readSecurityIdentity(elementReader, context); + SecurityIdentity securityIdentity = readSecurityIdentity(elementReader, context); messageDrivenBean.securityIdentity = securityIdentity; + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = messageDrivenBeanContextService.getObject(reader, context, messageDrivenBean); + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } + } + contextService.add(contextServiceItem); } 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", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-class"), new QName("http://java.sun.com/xml/ns/javaee", "messaging-type"), new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"), new QName("http://java.sun.com/xml/ns/javaee", "timer"), new QName("http://java.sun.com/xml/ns/javaee", "transaction-type"), new QName("http://java.sun.com/xml/ns/javaee", "message-selector"), new QName("http://java.sun.com/xml/ns/javaee", "acknowledge-mode"), new QName("http://java.sun.com/xml/ns/javaee", "message-driven-destination"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-type"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-link"), new QName("http://java.sun.com/xml/ns/javaee", "activation-config"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "security-identity")); + 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", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-class"), new QName("http://java.sun.com/xml/ns/javaee", "messaging-type"), new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"), new QName("http://java.sun.com/xml/ns/javaee", "timer"), new QName("http://java.sun.com/xml/ns/javaee", "transaction-type"), new QName("http://java.sun.com/xml/ns/javaee", "message-selector"), new QName("http://java.sun.com/xml/ns/javaee", "acknowledge-mode"), new QName("http://java.sun.com/xml/ns/javaee", "message-driven-destination"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-type"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-link"), new QName("http://java.sun.com/xml/ns/javaee", "activation-config"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "security-identity"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - messageDrivenBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + messageDrivenBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, MessageDrivenBean.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - messageDrivenBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + messageDrivenBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, MessageDrivenBean.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { messageDrivenBean.icon = icon; } - if (timer != null) { + if (timer!= null) { messageDrivenBean.timer = timer; } - if (aroundInvoke != null) { + if (aroundInvoke!= null) { messageDrivenBean.aroundInvoke = aroundInvoke; } - if (aroundTimeout != null) { + if (aroundTimeout!= null) { messageDrivenBean.aroundTimeout = aroundTimeout; } - if (envEntry != null) { + if (envEntry!= null) { messageDrivenBean.envEntry = envEntry; } - if (ejbRef != null) { + if (ejbRef!= null) { messageDrivenBean.ejbRef = ejbRef; } - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { messageDrivenBean.ejbLocalRef = ejbLocalRef; } - if (serviceRef != null) { + if (serviceRef!= null) { messageDrivenBean.serviceRef = serviceRef; } - if (resourceRef != null) { + if (resourceRef!= null) { messageDrivenBean.resourceRef = resourceRef; } - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { messageDrivenBean.resourceEnvRef = resourceEnvRef; } - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { messageDrivenBean.messageDestinationRef = messageDestinationRef; } - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { messageDrivenBean.persistenceContextRef = persistenceContextRef; } - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { messageDrivenBean.persistenceUnitRef = persistenceUnitRef; } - if (postConstruct != null) { + if (postConstruct!= null) { messageDrivenBean.postConstruct = postConstruct; } - if (preDestroy != null) { + if (preDestroy!= null) { messageDrivenBean.preDestroy = preDestroy; } - if (dataSource != null) { + if (dataSource!= null) { messageDrivenBean.dataSource = dataSource; } - if (securityRoleRef != null) { + if (jmsConnectionFactories!= null) { + messageDrivenBean.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + messageDrivenBean.jmsDestinations = jmsDestinations; + } + if (securityRoleRef!= null) { messageDrivenBean.securityRoleRef = securityRoleRef; } + if (contextService!= null) { + messageDrivenBeanContextService.setObject(reader, context, messageDrivenBean, contextService); + } context.afterUnmarshal(messageDrivenBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); return messageDrivenBean; } - public final MessageDrivenBean read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final MessageDrivenBean read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final MessageDrivenBean messageDrivenBean, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, MessageDrivenBean messageDrivenBean, RuntimeContext context) + throws Exception + { if (messageDrivenBean == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (MessageDrivenBean.class != messageDrivenBean.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (MessageDrivenBean.class!= messageDrivenBean.getClass()) { context.unexpectedSubclass(writer, messageDrivenBean, MessageDrivenBean.class); - return; + return ; } context.beforeMarshal(messageDrivenBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = messageDrivenBean.id; - if (idRaw != null) { + String idRaw = messageDrivenBean.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDrivenBean, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -628,12 +692,12 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri Text[] descriptions = null; try { descriptions = messageDrivenBean.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(messageDrivenBean, "descriptions", MessageDrivenBean.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -647,12 +711,12 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri Text[] displayNames = null; try { displayNames = messageDrivenBean.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(messageDrivenBean, "displayNames", MessageDrivenBean.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -663,10 +727,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: icon - final LocalCollection icon = messageDrivenBean.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = messageDrivenBean.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -677,14 +741,14 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: ejbName - final String ejbNameRaw = messageDrivenBean.ejbName; + String ejbNameRaw = messageDrivenBean.ejbName; String ejbName = null; try { ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDrivenBean, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbName != null) { + if (ejbName!= null) { writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbName); writer.writeEndElement(); @@ -693,61 +757,61 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: mappedName - final String mappedNameRaw = messageDrivenBean.mappedName; + String mappedNameRaw = messageDrivenBean.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDrivenBean, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + if (mappedName!= null) { writer.writeStartElement(prefix, "mapped-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(mappedName); writer.writeEndElement(); } // ELEMENT: ejbClass - final String ejbClassRaw = messageDrivenBean.ejbClass; + String ejbClassRaw = messageDrivenBean.ejbClass; String ejbClass = null; try { ejbClass = Adapters.collapsedStringAdapterAdapter.marshal(ejbClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDrivenBean, "ejbClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbClass != null) { + if (ejbClass!= null) { writer.writeStartElement(prefix, "ejb-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbClass); writer.writeEndElement(); } // ELEMENT: messagingType - final String messagingTypeRaw = messageDrivenBean.messagingType; + String messagingTypeRaw = messageDrivenBean.messagingType; String messagingType = null; try { messagingType = Adapters.collapsedStringAdapterAdapter.marshal(messagingTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDrivenBean, "messagingType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (messagingType != null) { + if (messagingType!= null) { writer.writeStartElement(prefix, "messaging-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(messagingType); writer.writeEndElement(); } // ELEMENT: timeoutMethod - final NamedMethod timeoutMethod = messageDrivenBean.timeoutMethod; - if (timeoutMethod != null) { + NamedMethod timeoutMethod = messageDrivenBean.timeoutMethod; + if (timeoutMethod!= null) { writer.writeStartElement(prefix, "timeout-method", "http://java.sun.com/xml/ns/javaee"); writeNamedMethod(writer, timeoutMethod, context); writer.writeEndElement(); } // ELEMENT: timer - final List timer = messageDrivenBean.timer; - if (timer != null) { - for (final Timer timerItem : timer) { + List timer = messageDrivenBean.timer; + if (timer!= null) { + for (Timer timerItem: timer) { writer.writeStartElement(prefix, "timer", "http://java.sun.com/xml/ns/javaee"); - if (timerItem != null) { + if (timerItem!= null) { writeTimer(writer, timerItem, context); } else { writer.writeXsiNil(); @@ -757,8 +821,8 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: transactionType - final TransactionType transactionType = messageDrivenBean.transactionType; - if (transactionType != null) { + TransactionType transactionType = messageDrivenBean.transactionType; + if (transactionType!= null) { writer.writeStartElement(prefix, "transaction-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringTransactionType(messageDrivenBean, null, context, transactionType)); writer.writeEndElement(); @@ -768,16 +832,16 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri String messageSelectorRaw = null; try { messageSelectorRaw = messageDrivenBean.getMessageSelector(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(messageDrivenBean, "messageSelector", MessageDrivenBean.class, "getMessageSelector", e); } String messageSelector = null; try { messageSelector = Adapters.collapsedStringAdapterAdapter.marshal(messageSelectorRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDrivenBean, "messageSelector", CollapsedStringAdapter.class, String.class, String.class, e); } - if (messageSelector != null) { + if (messageSelector!= null) { writer.writeStartElement(prefix, "message-selector", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(messageSelector); writer.writeEndElement(); @@ -787,16 +851,16 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri String acknowledgeModeRaw = null; try { acknowledgeModeRaw = messageDrivenBean.getAcknowledgeMode(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(messageDrivenBean, "acknowledgeMode", MessageDrivenBean.class, "getAcknowledgeMode", e); } String acknowledgeMode = null; try { acknowledgeMode = Adapters.collapsedStringAdapterAdapter.marshal(acknowledgeModeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDrivenBean, "acknowledgeMode", CollapsedStringAdapter.class, String.class, String.class, e); } - if (acknowledgeMode != null) { + if (acknowledgeMode!= null) { writer.writeStartElement(prefix, "acknowledge-mode", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(acknowledgeMode); writer.writeEndElement(); @@ -806,56 +870,56 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri MessageDrivenDestination messageDrivenDestination = null; try { messageDrivenDestination = messageDrivenBean.getMessageDrivenDestination(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(messageDrivenBean, "messageDrivenDestination", MessageDrivenBean.class, "getMessageDrivenDestination", e); } - if (messageDrivenDestination != null) { + if (messageDrivenDestination!= null) { writer.writeStartElement(prefix, "message-driven-destination", "http://java.sun.com/xml/ns/javaee"); writeMessageDrivenDestination(writer, messageDrivenDestination, context); writer.writeEndElement(); } // ELEMENT: messageDestinationType - final String messageDestinationTypeRaw = messageDrivenBean.messageDestinationType; + String messageDestinationTypeRaw = messageDrivenBean.messageDestinationType; String messageDestinationType = null; try { messageDestinationType = Adapters.collapsedStringAdapterAdapter.marshal(messageDestinationTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDrivenBean, "messageDestinationType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (messageDestinationType != null) { + if (messageDestinationType!= null) { writer.writeStartElement(prefix, "message-destination-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(messageDestinationType); writer.writeEndElement(); } // ELEMENT: messageDestinationLink - final String messageDestinationLinkRaw = messageDrivenBean.messageDestinationLink; + String messageDestinationLinkRaw = messageDrivenBean.messageDestinationLink; String messageDestinationLink = null; try { messageDestinationLink = Adapters.collapsedStringAdapterAdapter.marshal(messageDestinationLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDrivenBean, "messageDestinationLink", CollapsedStringAdapter.class, String.class, String.class, e); } - if (messageDestinationLink != null) { + if (messageDestinationLink!= null) { writer.writeStartElement(prefix, "message-destination-link", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(messageDestinationLink); writer.writeEndElement(); } // ELEMENT: activationConfig - final ActivationConfig activationConfig = messageDrivenBean.activationConfig; - if (activationConfig != null) { + ActivationConfig activationConfig = messageDrivenBean.activationConfig; + if (activationConfig!= null) { writer.writeStartElement(prefix, "activation-config", "http://java.sun.com/xml/ns/javaee"); writeActivationConfig(writer, activationConfig, context); writer.writeEndElement(); } // ELEMENT: aroundInvoke - final List aroundInvoke = messageDrivenBean.aroundInvoke; - if (aroundInvoke != null) { - for (final AroundInvoke aroundInvokeItem : aroundInvoke) { - if (aroundInvokeItem != null) { + List aroundInvoke = messageDrivenBean.aroundInvoke; + if (aroundInvoke!= null) { + for (AroundInvoke aroundInvokeItem: aroundInvoke) { + if (aroundInvokeItem!= null) { writer.writeStartElement(prefix, "around-invoke", "http://java.sun.com/xml/ns/javaee"); writeAroundInvoke(writer, aroundInvokeItem, context); writer.writeEndElement(); @@ -866,10 +930,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: aroundTimeout - final List aroundTimeout = messageDrivenBean.aroundTimeout; - if (aroundTimeout != null) { - for (final AroundTimeout aroundTimeoutItem : aroundTimeout) { - if (aroundTimeoutItem != null) { + List aroundTimeout = messageDrivenBean.aroundTimeout; + if (aroundTimeout!= null) { + for (AroundTimeout aroundTimeoutItem: aroundTimeout) { + if (aroundTimeoutItem!= null) { writer.writeStartElement(prefix, "around-timeout", "http://java.sun.com/xml/ns/javaee"); writeAroundTimeout(writer, aroundTimeoutItem, context); writer.writeEndElement(); @@ -878,10 +942,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: envEntry - final KeyedCollection envEntry = messageDrivenBean.envEntry; - if (envEntry != null) { - for (final EnvEntry envEntryItem : envEntry) { - if (envEntryItem != null) { + KeyedCollection envEntry = messageDrivenBean.envEntry; + if (envEntry!= null) { + for (EnvEntry envEntryItem: envEntry) { + if (envEntryItem!= null) { writer.writeStartElement(prefix, "env-entry", "http://java.sun.com/xml/ns/javaee"); writeEnvEntry(writer, envEntryItem, context); writer.writeEndElement(); @@ -892,10 +956,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: ejbRef - final KeyedCollection ejbRef = messageDrivenBean.ejbRef; - if (ejbRef != null) { - for (final EjbRef ejbRefItem : ejbRef) { - if (ejbRefItem != null) { + KeyedCollection ejbRef = messageDrivenBean.ejbRef; + if (ejbRef!= null) { + for (EjbRef ejbRefItem: ejbRef) { + if (ejbRefItem!= null) { writer.writeStartElement(prefix, "ejb-ref", "http://java.sun.com/xml/ns/javaee"); writeEjbRef(writer, ejbRefItem, context); writer.writeEndElement(); @@ -906,10 +970,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: ejbLocalRef - final KeyedCollection ejbLocalRef = messageDrivenBean.ejbLocalRef; - if (ejbLocalRef != null) { - for (final EjbLocalRef ejbLocalRefItem : ejbLocalRef) { - if (ejbLocalRefItem != null) { + KeyedCollection ejbLocalRef = messageDrivenBean.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(); @@ -920,10 +984,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: serviceRef - final KeyedCollection serviceRef = messageDrivenBean.serviceRef; - if (serviceRef != null) { - for (final ServiceRef serviceRefItem : serviceRef) { - if (serviceRefItem != null) { + KeyedCollection serviceRef = messageDrivenBean.serviceRef; + if (serviceRef!= null) { + for (ServiceRef serviceRefItem: serviceRef) { + if (serviceRefItem!= null) { writer.writeStartElement(prefix, "service-ref", "http://java.sun.com/xml/ns/javaee"); writeServiceRef(writer, serviceRefItem, context); writer.writeEndElement(); @@ -934,10 +998,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: resourceRef - final KeyedCollection resourceRef = messageDrivenBean.resourceRef; - if (resourceRef != null) { - for (final ResourceRef resourceRefItem : resourceRef) { - if (resourceRefItem != null) { + KeyedCollection resourceRef = messageDrivenBean.resourceRef; + if (resourceRef!= null) { + for (ResourceRef resourceRefItem: resourceRef) { + if (resourceRefItem!= null) { writer.writeStartElement(prefix, "resource-ref", "http://java.sun.com/xml/ns/javaee"); writeResourceRef(writer, resourceRefItem, context); writer.writeEndElement(); @@ -948,10 +1012,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: resourceEnvRef - final KeyedCollection resourceEnvRef = messageDrivenBean.resourceEnvRef; - if (resourceEnvRef != null) { - for (final ResourceEnvRef resourceEnvRefItem : resourceEnvRef) { - if (resourceEnvRefItem != null) { + KeyedCollection resourceEnvRef = messageDrivenBean.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(); @@ -962,10 +1026,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: messageDestinationRef - final KeyedCollection messageDestinationRef = messageDrivenBean.messageDestinationRef; - if (messageDestinationRef != null) { - for (final MessageDestinationRef messageDestinationRefItem : messageDestinationRef) { - if (messageDestinationRefItem != null) { + KeyedCollection messageDestinationRef = messageDrivenBean.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(); @@ -976,10 +1040,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: persistenceContextRef - final KeyedCollection persistenceContextRef = messageDrivenBean.persistenceContextRef; - if (persistenceContextRef != null) { - for (final PersistenceContextRef persistenceContextRefItem : persistenceContextRef) { - if (persistenceContextRefItem != null) { + KeyedCollection persistenceContextRef = messageDrivenBean.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(); @@ -990,10 +1054,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: persistenceUnitRef - final KeyedCollection persistenceUnitRef = messageDrivenBean.persistenceUnitRef; - if (persistenceUnitRef != null) { - for (final PersistenceUnitRef persistenceUnitRefItem : persistenceUnitRef) { - if (persistenceUnitRefItem != null) { + KeyedCollection persistenceUnitRef = messageDrivenBean.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(); @@ -1004,10 +1068,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: postConstruct - final List postConstruct = messageDrivenBean.postConstruct; - if (postConstruct != null) { - for (final org.apache.openejb.jee.LifecycleCallback postConstructItem : postConstruct) { - if (postConstructItem != null) { + List postConstruct = messageDrivenBean.postConstruct; + if (postConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback postConstructItem: postConstruct) { + if (postConstructItem!= null) { writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, postConstructItem, context); writer.writeEndElement(); @@ -1018,10 +1082,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: preDestroy - final List preDestroy = messageDrivenBean.preDestroy; - if (preDestroy != null) { - for (final org.apache.openejb.jee.LifecycleCallback preDestroyItem : preDestroy) { - if (preDestroyItem != null) { + List preDestroy = messageDrivenBean.preDestroy; + if (preDestroy!= null) { + for (org.apache.openejb.jee.LifecycleCallback preDestroyItem: preDestroy) { + if (preDestroyItem!= null) { writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, preDestroyItem, context); writer.writeEndElement(); @@ -1032,10 +1096,10 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: dataSource - final KeyedCollection dataSource = messageDrivenBean.dataSource; - if (dataSource != null) { - for (final DataSource dataSourceItem : dataSource) { - if (dataSourceItem != null) { + KeyedCollection dataSource = messageDrivenBean.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); writeDataSource(writer, dataSourceItem, context); writer.writeEndElement(); @@ -1045,11 +1109,37 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } } + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = messageDrivenBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(messageDrivenBean, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = messageDrivenBean.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + // ELEMENT: securityRoleRef - final List securityRoleRef = messageDrivenBean.securityRoleRef; - if (securityRoleRef != null) { - for (final SecurityRoleRef securityRoleRefItem : securityRoleRef) { - if (securityRoleRefItem != null) { + List securityRoleRef = messageDrivenBean.securityRoleRef; + if (securityRoleRef!= null) { + for (SecurityRoleRef securityRoleRefItem: securityRoleRef) { + if (securityRoleRefItem!= null) { writer.writeStartElement(prefix, "security-role-ref", "http://java.sun.com/xml/ns/javaee"); writeSecurityRoleRef(writer, securityRoleRefItem, context); writer.writeEndElement(); @@ -1060,13 +1150,25 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: securityIdentity - final SecurityIdentity securityIdentity = messageDrivenBean.securityIdentity; - if (securityIdentity != null) { + SecurityIdentity securityIdentity = messageDrivenBean.securityIdentity; + if (securityIdentity!= null) { writer.writeStartElement(prefix, "security-identity", "http://java.sun.com/xml/ns/javaee"); writeSecurityIdentity(writer, securityIdentity, context); writer.writeEndElement(); } + // ELEMENT: contextService + KeyedCollection contextService = messageDrivenBeanContextService.getObject(messageDrivenBean, context, messageDrivenBean); + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + context.afterMarshal(messageDrivenBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenDestination$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenDestination$JAXB.java index 112d4315693..5a92dc17866 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenDestination$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenDestination$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.DestinationType$JAXB.readDestinationType; import static org.apache.openejb.jee.DestinationType$JAXB.writeDestinationType; @@ -36,30 +37,35 @@ "StringEquality" }) public class MessageDrivenDestination$JAXB - extends JAXBObject { + extends JAXBObject +{ public MessageDrivenDestination$JAXB() { super(MessageDrivenDestination.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "message-driven-destination".intern()), null, DestinationType$JAXB.class, SubscriptionDurability$JAXB.class); } - public static MessageDrivenDestination readMessageDrivenDestination(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static MessageDrivenDestination readMessageDrivenDestination(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMessageDrivenDestination(final XoXMLStreamWriter writer, final MessageDrivenDestination messageDrivenDestination, final RuntimeContext context) - throws Exception { + public static void writeMessageDrivenDestination(XoXMLStreamWriter writer, MessageDrivenDestination messageDrivenDestination, RuntimeContext context) + throws Exception + { _write(writer, messageDrivenDestination, context); } - public void write(final XoXMLStreamWriter writer, final MessageDrivenDestination messageDrivenDestination, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, MessageDrivenDestination messageDrivenDestination, RuntimeContext context) + throws Exception + { _write(writer, messageDrivenDestination, context); } - public final static MessageDrivenDestination _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final MessageDrivenDestination _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,37 +76,37 @@ public final static MessageDrivenDestination _read(final XoXMLStreamReader reade context = new RuntimeContext(); } - final MessageDrivenDestination messageDrivenDestination = new MessageDrivenDestination(); + MessageDrivenDestination messageDrivenDestination = new MessageDrivenDestination(); context.beforeUnmarshal(messageDrivenDestination, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { return context.unexpectedXsiType(reader, MessageDrivenDestination.class); } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, messageDrivenDestination); messageDrivenDestination.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("destination-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("destination-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: destinationType - final DestinationType destinationType = readDestinationType(elementReader, context); + DestinationType destinationType = readDestinationType(elementReader, context); messageDrivenDestination.destinationType = destinationType; - } else if (("subscription-durability" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("subscription-durability" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: subscriptionDurability - final SubscriptionDurability subscriptionDurability = readSubscriptionDurability(elementReader, context); + SubscriptionDurability subscriptionDurability = readSubscriptionDurability(elementReader, context); messageDrivenDestination.subscriptionDurability = subscriptionDurability; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "destination-type"), new QName("http://java.sun.com/xml/ns/javaee", "subscription-durability")); @@ -112,46 +118,48 @@ public final static MessageDrivenDestination _read(final XoXMLStreamReader reade return messageDrivenDestination; } - public final MessageDrivenDestination read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final MessageDrivenDestination read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final MessageDrivenDestination messageDrivenDestination, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, MessageDrivenDestination messageDrivenDestination, RuntimeContext context) + throws Exception + { if (messageDrivenDestination == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (MessageDrivenDestination.class != messageDrivenDestination.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (MessageDrivenDestination.class!= messageDrivenDestination.getClass()) { context.unexpectedSubclass(writer, messageDrivenDestination, MessageDrivenDestination.class); - return; + return ; } context.beforeMarshal(messageDrivenDestination, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = messageDrivenDestination.id; - if (idRaw != null) { + String idRaw = messageDrivenDestination.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageDrivenDestination, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: destinationType - final DestinationType destinationType = messageDrivenDestination.destinationType; - if (destinationType != null) { + DestinationType destinationType = messageDrivenDestination.destinationType; + if (destinationType!= null) { writer.writeStartElement(prefix, "destination-type", "http://java.sun.com/xml/ns/javaee"); writeDestinationType(writer, destinationType, context); writer.writeEndElement(); @@ -160,8 +168,8 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageDri } // ELEMENT: subscriptionDurability - final SubscriptionDurability subscriptionDurability = messageDrivenDestination.subscriptionDurability; - if (subscriptionDurability != null) { + SubscriptionDurability subscriptionDurability = messageDrivenDestination.subscriptionDurability; + if (subscriptionDurability!= null) { writer.writeStartElement(prefix, "subscription-durability", "http://java.sun.com/xml/ns/javaee"); writeSubscriptionDurability(writer, subscriptionDurability, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageListener$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageListener$JAXB.java index ae7d8f0b098..cbffba3b237 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageListener$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageListener$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.ActivationSpec$JAXB.readActivationSpec; import static org.apache.openejb.jee.ActivationSpec$JAXB.writeActivationSpec; @@ -34,30 +35,35 @@ "StringEquality" }) public class MessageListener$JAXB - extends JAXBObject { + extends JAXBObject +{ public MessageListener$JAXB() { super(MessageListener.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "messagelistenerType".intern()), ActivationSpec$JAXB.class); } - public static MessageListener readMessageListener(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static MessageListener readMessageListener(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMessageListener(final XoXMLStreamWriter writer, final MessageListener messageListener, final RuntimeContext context) - throws Exception { + public static void writeMessageListener(XoXMLStreamWriter writer, MessageListener messageListener, RuntimeContext context) + throws Exception + { _write(writer, messageListener, context); } - public void write(final XoXMLStreamWriter writer, final MessageListener messageListener, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, MessageListener messageListener, RuntimeContext context) + throws Exception + { _write(writer, messageListener, context); } - public final static MessageListener _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final MessageListener _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -68,48 +74,48 @@ public final static MessageListener _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final MessageListener messageListener = new MessageListener(); + MessageListener messageListener = new MessageListener(); context.beforeUnmarshal(messageListener, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("messagelistenerType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("messagelistenerType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, MessageListener.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, messageListener); messageListener.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("messagelistener-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("messagelistener-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageListenerType - final String messageListenerTypeRaw = elementReader.getElementAsString(); + String messageListenerTypeRaw = elementReader.getElementText(); - final String messageListenerType; + String messageListenerType; try { messageListenerType = Adapters.collapsedStringAdapterAdapter.unmarshal(messageListenerTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } messageListener.messageListenerType = messageListenerType; - } else if (("activationspec" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("activationspec" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: activationSpec - final ActivationSpec activationSpec = readActivationSpec(elementReader, context); + ActivationSpec activationSpec = readActivationSpec(elementReader, context); messageListener.activationSpec = activationSpec; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "messagelistener-type"), new QName("http://java.sun.com/xml/ns/javaee", "activationspec")); @@ -121,52 +127,54 @@ public final static MessageListener _read(final XoXMLStreamReader reader, Runtim return messageListener; } - public final MessageListener read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final MessageListener read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final MessageListener messageListener, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, MessageListener messageListener, RuntimeContext context) + throws Exception + { if (messageListener == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (MessageListener.class != messageListener.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (MessageListener.class!= messageListener.getClass()) { context.unexpectedSubclass(writer, messageListener, MessageListener.class); - return; + return ; } context.beforeMarshal(messageListener, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = messageListener.id; - if (idRaw != null) { + String idRaw = messageListener.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageListener, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: messageListenerType - final String messageListenerTypeRaw = messageListener.messageListenerType; + String messageListenerTypeRaw = messageListener.messageListenerType; String messageListenerType = null; try { messageListenerType = Adapters.collapsedStringAdapterAdapter.marshal(messageListenerTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(messageListener, "messageListenerType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (messageListenerType != null) { + if (messageListenerType!= null) { writer.writeStartElement(prefix, "messagelistener-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(messageListenerType); writer.writeEndElement(); @@ -175,8 +183,8 @@ public final static void _write(final XoXMLStreamWriter writer, final MessageLis } // ELEMENT: activationSpec - final ActivationSpec activationSpec = messageListener.activationSpec; - if (activationSpec != null) { + ActivationSpec activationSpec = messageListener.activationSpec; + if (activationSpec!= null) { writer.writeStartElement(prefix, "activationspec", "http://java.sun.com/xml/ns/javaee"); writeActivationSpec(writer, activationSpec, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Method$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Method$JAXB.java index 7a75e389fe3..b5b57ac52e8 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Method$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Method$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.MethodIntf$JAXB.parseMethodIntf; import static org.apache.openejb.jee.MethodIntf$JAXB.toStringMethodIntf; @@ -39,30 +40,35 @@ "StringEquality" }) public class Method$JAXB - extends JAXBObject { + extends JAXBObject +{ public Method$JAXB() { super(Method.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "methodType".intern()), Text$JAXB.class, MethodIntf$JAXB.class, MethodParams$JAXB.class); } - public static Method readMethod(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Method readMethod(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMethod(final XoXMLStreamWriter writer, final Method method, final RuntimeContext context) - throws Exception { + public static void writeMethod(XoXMLStreamWriter writer, Method method, RuntimeContext context) + throws Exception + { _write(writer, method, context); } - public void write(final XoXMLStreamWriter writer, final Method method, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Method method, RuntimeContext context) + throws Exception + { _write(writer, method, context); } - public final static Method _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Method _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -73,84 +79,84 @@ public final static Method _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final Method method = new Method(); + Method method = new Method(); context.beforeUnmarshal(method, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("methodType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Method.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, method); method.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbName - final String ejbNameRaw = elementReader.getElementAsString(); + String ejbNameRaw = elementReader.getElementText(); - final String ejbName; + String ejbName; try { ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } method.ejbName = ejbName; - } else if (("method-intf" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method-intf" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodIntf - final MethodIntf methodIntf = parseMethodIntf(elementReader, context, elementReader.getElementAsString()); - if (methodIntf != null) { + MethodIntf methodIntf = parseMethodIntf(elementReader, context, elementReader.getElementText()); + if (methodIntf!= null) { method.methodIntf = methodIntf; } - } else if (("method-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodName - final String methodNameRaw = elementReader.getElementAsString(); + String methodNameRaw = elementReader.getElementText(); - final String methodName; + String methodName; try { methodName = Adapters.collapsedStringAdapterAdapter.unmarshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } method.methodName = methodName; - } else if (("method-params" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method-params" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodParams - final MethodParams methodParams = readMethodParams(elementReader, context); + MethodParams methodParams = readMethodParams(elementReader, context); method.methodParams = methodParams; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "method-intf"), new QName("http://java.sun.com/xml/ns/javaee", "method-name"), new QName("http://java.sun.com/xml/ns/javaee", "method-params")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - method.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + method.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Method.class, "setDescriptions", Text[].class, e); } } @@ -160,38 +166,40 @@ public final static Method _read(final XoXMLStreamReader reader, RuntimeContext return method; } - public final Method read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Method read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Method method, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Method method, RuntimeContext context) + throws Exception + { if (method == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Method.class != method.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Method.class!= method.getClass()) { context.unexpectedSubclass(writer, method, Method.class); - return; + return ; } context.beforeMarshal(method, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = method.id; - if (idRaw != null) { + String idRaw = method.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(method, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -201,12 +209,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Method met Text[] descriptions = null; try { descriptions = method.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(method, "descriptions", Method.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -217,14 +225,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Method met } // ELEMENT: ejbName - final String ejbNameRaw = method.ejbName; + String ejbNameRaw = method.ejbName; String ejbName = null; try { ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(method, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbName != null) { + if (ejbName!= null) { writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbName); writer.writeEndElement(); @@ -233,22 +241,22 @@ public final static void _write(final XoXMLStreamWriter writer, final Method met } // ELEMENT: methodIntf - final MethodIntf methodIntf = method.methodIntf; - if (methodIntf != null) { + MethodIntf methodIntf = method.methodIntf; + if (methodIntf!= null) { writer.writeStartElement(prefix, "method-intf", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringMethodIntf(method, null, context, methodIntf)); writer.writeEndElement(); } // ELEMENT: methodName - final String methodNameRaw = method.methodName; + String methodNameRaw = method.methodName; String methodName = null; try { methodName = Adapters.collapsedStringAdapterAdapter.marshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(method, "methodName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (methodName != null) { + if (methodName!= null) { writer.writeStartElement(prefix, "method-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(methodName); writer.writeEndElement(); @@ -257,8 +265,8 @@ public final static void _write(final XoXMLStreamWriter writer, final Method met } // ELEMENT: methodParams - final MethodParams methodParams = method.methodParams; - if (methodParams != null) { + MethodParams methodParams = method.methodParams; + if (methodParams!= null) { writer.writeStartElement(prefix, "method-params", "http://java.sun.com/xml/ns/javaee"); writeMethodParams(writer, methodParams, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodIntf$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodIntf$JAXB.java index e12afdaa09a..7d8148450da 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodIntf$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodIntf$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class MethodIntf$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public MethodIntf$JAXB() { super(MethodIntf.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "methodIntf".intern())); } - public MethodIntf parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public MethodIntf parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseMethodIntf(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final MethodIntf methodIntf) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, MethodIntf methodIntf) + throws Exception + { return toStringMethodIntf(bean, parameterName, context, methodIntf); } - public static MethodIntf parseMethodIntf(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static MethodIntf parseMethodIntf(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Home".equals(value)) { return MethodIntf.HOME; } else if ("Remote".equals(value)) { @@ -62,8 +66,9 @@ public static MethodIntf parseMethodIntf(final XoXMLStreamReader reader, final R } } - public static String toStringMethodIntf(final Object bean, final String parameterName, final RuntimeContext context, final MethodIntf methodIntf) - throws Exception { + public static String toStringMethodIntf(Object bean, String parameterName, RuntimeContext context, MethodIntf methodIntf) + throws Exception + { if (MethodIntf.HOME == methodIntf) { return "Home"; } else if (MethodIntf.REMOTE == methodIntf) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodParamPartsMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodParamPartsMapping$JAXB.java index 0b80b370271..ad8fa94dece 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodParamPartsMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodParamPartsMapping$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.math.BigInteger; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.math.BigInteger; import static org.apache.openejb.jee.WsdlMessageMapping$JAXB.readWsdlMessageMapping; import static org.apache.openejb.jee.WsdlMessageMapping$JAXB.writeWsdlMessageMapping; @@ -35,30 +36,35 @@ "StringEquality" }) public class MethodParamPartsMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public MethodParamPartsMapping$JAXB() { super(MethodParamPartsMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "method-param-parts-mappingType".intern()), WsdlMessageMapping$JAXB.class); } - public static MethodParamPartsMapping readMethodParamPartsMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static MethodParamPartsMapping readMethodParamPartsMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMethodParamPartsMapping(final XoXMLStreamWriter writer, final MethodParamPartsMapping methodParamPartsMapping, final RuntimeContext context) - throws Exception { + public static void writeMethodParamPartsMapping(XoXMLStreamWriter writer, MethodParamPartsMapping methodParamPartsMapping, RuntimeContext context) + throws Exception + { _write(writer, methodParamPartsMapping, context); } - public void write(final XoXMLStreamWriter writer, final MethodParamPartsMapping methodParamPartsMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, MethodParamPartsMapping methodParamPartsMapping, RuntimeContext context) + throws Exception + { _write(writer, methodParamPartsMapping, context); } - public final static MethodParamPartsMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final MethodParamPartsMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,52 +75,52 @@ public final static MethodParamPartsMapping _read(final XoXMLStreamReader reader context = new RuntimeContext(); } - final MethodParamPartsMapping methodParamPartsMapping = new MethodParamPartsMapping(); + MethodParamPartsMapping methodParamPartsMapping = new MethodParamPartsMapping(); context.beforeUnmarshal(methodParamPartsMapping, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("method-param-parts-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("method-param-parts-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, MethodParamPartsMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, methodParamPartsMapping); methodParamPartsMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("param-position" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("param-position" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: paramPosition - final BigInteger paramPosition = new BigInteger(elementReader.getElementAsString()); + BigInteger paramPosition = new BigInteger(elementReader.getElementText()); methodParamPartsMapping.paramPosition = paramPosition; - } else if (("param-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("param-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: paramType - final String paramTypeRaw = elementReader.getElementAsString(); + String paramTypeRaw = elementReader.getElementText(); - final String paramType; + String paramType; try { paramType = Adapters.collapsedStringAdapterAdapter.unmarshal(paramTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } methodParamPartsMapping.paramType = paramType; - } else if (("wsdl-message-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-message-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlMessageMapping - final WsdlMessageMapping wsdlMessageMapping = readWsdlMessageMapping(elementReader, context); + WsdlMessageMapping wsdlMessageMapping = readWsdlMessageMapping(elementReader, context); methodParamPartsMapping.wsdlMessageMapping = wsdlMessageMapping; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "param-position"), new QName("http://java.sun.com/xml/ns/javaee", "param-type"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-message-mapping")); @@ -126,46 +132,48 @@ public final static MethodParamPartsMapping _read(final XoXMLStreamReader reader return methodParamPartsMapping; } - public final MethodParamPartsMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final MethodParamPartsMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final MethodParamPartsMapping methodParamPartsMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, MethodParamPartsMapping methodParamPartsMapping, RuntimeContext context) + throws Exception + { if (methodParamPartsMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (MethodParamPartsMapping.class != methodParamPartsMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (MethodParamPartsMapping.class!= methodParamPartsMapping.getClass()) { context.unexpectedSubclass(writer, methodParamPartsMapping, MethodParamPartsMapping.class); - return; + return ; } context.beforeMarshal(methodParamPartsMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = methodParamPartsMapping.id; - if (idRaw != null) { + String idRaw = methodParamPartsMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(methodParamPartsMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: paramPosition - final BigInteger paramPosition = methodParamPartsMapping.paramPosition; - if (paramPosition != null) { + BigInteger paramPosition = methodParamPartsMapping.paramPosition; + if (paramPosition!= null) { writer.writeStartElement(prefix, "param-position", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(paramPosition.toString()); writer.writeEndElement(); @@ -174,14 +182,14 @@ public final static void _write(final XoXMLStreamWriter writer, final MethodPara } // ELEMENT: paramType - final String paramTypeRaw = methodParamPartsMapping.paramType; + String paramTypeRaw = methodParamPartsMapping.paramType; String paramType = null; try { paramType = Adapters.collapsedStringAdapterAdapter.marshal(paramTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(methodParamPartsMapping, "paramType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (paramType != null) { + if (paramType!= null) { writer.writeStartElement(prefix, "param-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(paramType); writer.writeEndElement(); @@ -190,8 +198,8 @@ public final static void _write(final XoXMLStreamWriter writer, final MethodPara } // ELEMENT: wsdlMessageMapping - final WsdlMessageMapping wsdlMessageMapping = methodParamPartsMapping.wsdlMessageMapping; - if (wsdlMessageMapping != null) { + WsdlMessageMapping wsdlMessageMapping = methodParamPartsMapping.wsdlMessageMapping; + if (wsdlMessageMapping!= null) { writer.writeStartElement(prefix, "wsdl-message-mapping", "http://java.sun.com/xml/ns/javaee"); writeWsdlMessageMapping(writer, wsdlMessageMapping, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodParams$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodParams$JAXB.java index 8a1634e3b4e..eed5de63dbb 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodParams$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodParams$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class MethodParams$JAXB - extends JAXBObject { + extends JAXBObject +{ public MethodParams$JAXB() { super(MethodParams.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "method-paramsType".intern())); } - public static MethodParams readMethodParams(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static MethodParams readMethodParams(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMethodParams(final XoXMLStreamWriter writer, final MethodParams methodParams, final RuntimeContext context) - throws Exception { + public static void writeMethodParams(XoXMLStreamWriter writer, MethodParams methodParams, RuntimeContext context) + throws Exception + { _write(writer, methodParams, context); } - public void write(final XoXMLStreamWriter writer, final MethodParams methodParams, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, MethodParams methodParams, RuntimeContext context) + throws Exception + { _write(writer, methodParams, context); } - public final static MethodParams _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final MethodParams _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,51 +72,51 @@ public final static MethodParams _read(final XoXMLStreamReader reader, RuntimeCo context = new RuntimeContext(); } - final MethodParams methodParams = new MethodParams(); + MethodParams methodParams = new MethodParams(); context.beforeUnmarshal(methodParams, LifecycleCallback.NONE); List methodParam = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("method-paramsType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + 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 (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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 (("method-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("method-param" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodParam - final String methodParamItemRaw = elementReader.getElementAsString(); + String methodParamItemRaw = elementReader.getElementText(); - final String methodParamItem; + String methodParamItem; try { methodParamItem = Adapters.collapsedStringAdapterAdapter.unmarshal(methodParamItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (methodParam == null) { methodParam = methodParams.methodParam; - if (methodParam != null) { + if (methodParam!= null) { methodParam.clear(); } else { - methodParam = new ArrayList(); + methodParam = new ArrayList<>(); } } methodParam.add(methodParamItem); @@ -119,7 +124,7 @@ public final static MethodParams _read(final XoXMLStreamReader reader, RuntimeCo context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "method-param")); } } - if (methodParam != null) { + if (methodParam!= null) { methodParams.methodParam = methodParam; } @@ -128,53 +133,55 @@ public final static MethodParams _read(final XoXMLStreamReader reader, RuntimeCo return methodParams; } - public final MethodParams read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final MethodParams read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final MethodParams methodParams, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, MethodParams methodParams, RuntimeContext context) + throws Exception + { if (methodParams == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (MethodParams.class != methodParams.getClass()) { + if (MethodParams.class!= methodParams.getClass()) { context.unexpectedSubclass(writer, methodParams, MethodParams.class); - return; + return ; } context.beforeMarshal(methodParams, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = methodParams.id; - if (idRaw != null) { + String idRaw = methodParams.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(methodParams, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: methodParam - final List methodParamRaw = methodParams.methodParam; - if (methodParamRaw != null) { - for (final String methodParamItem : methodParamRaw) { + List methodParamRaw = methodParams.methodParam; + if (methodParamRaw!= null) { + for (String methodParamItem: methodParamRaw) { String methodParam = null; try { methodParam = Adapters.collapsedStringAdapterAdapter.marshal(methodParamItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(methodParams, "methodParam", CollapsedStringAdapter.class, List.class, List.class, e); } - if (methodParam != null) { + if (methodParam!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "method-param"); writer.writeCharacters(methodParam); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodPermission$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodPermission$JAXB.java index fdd099b0990..177b57d88d4 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodPermission$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MethodPermission$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Empty$JAXB.readEmpty; import static org.apache.openejb.jee.Empty$JAXB.writeEmpty; @@ -40,30 +41,35 @@ "StringEquality" }) public class MethodPermission$JAXB - extends JAXBObject { + extends JAXBObject +{ public MethodPermission$JAXB() { super(MethodPermission.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "method-permissionType".intern()), Text$JAXB.class, Empty$JAXB.class, Method$JAXB.class); } - public static MethodPermission readMethodPermission(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static MethodPermission readMethodPermission(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMethodPermission(final XoXMLStreamWriter writer, final MethodPermission methodPermission, final RuntimeContext context) - throws Exception { + public static void writeMethodPermission(XoXMLStreamWriter writer, MethodPermission methodPermission, RuntimeContext context) + throws Exception + { _write(writer, methodPermission, context); } - public void write(final XoXMLStreamWriter writer, final MethodPermission methodPermission, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, MethodPermission methodPermission, RuntimeContext context) + throws Exception + { _write(writer, methodPermission, context); } - public final static MethodPermission _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final MethodPermission _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,7 +80,7 @@ public final static MethodPermission _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final MethodPermission methodPermission = new MethodPermission(); + MethodPermission methodPermission = new MethodPermission(); context.beforeUnmarshal(methodPermission, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -82,68 +88,68 @@ public final static MethodPermission _read(final XoXMLStreamReader reader, Runti List 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())) { + 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))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("role-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("role-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: roleName - final String roleNameItemRaw = elementReader.getElementAsString(); + String roleNameItemRaw = elementReader.getElementText(); - final String roleNameItem; + String roleNameItem; try { roleNameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(roleNameItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (roleName == null) { roleName = methodPermission.roleName; - if (roleName != null) { + if (roleName!= null) { roleName.clear(); } else { - roleName = new ArrayList(); + roleName = new ArrayList<>(); } } roleName.add(roleNameItem); - } else if (("unchecked" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("unchecked" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: unchecked - final Empty unchecked = readEmpty(elementReader, context); + Empty unchecked = readEmpty(elementReader, context); methodPermission.unchecked = unchecked; - } else if (("method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: method - final Method methodItem = readMethod(elementReader, context); + Method methodItem = readMethod(elementReader, context); if (method == null) { method = methodPermission.method; - if (method != null) { + if (method!= null) { method.clear(); } else { - method = new ArrayList(); + method = new ArrayList<>(); } } method.add(methodItem); @@ -151,17 +157,17 @@ public final static MethodPermission _read(final XoXMLStreamReader reader, Runti 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) { + if (descriptions!= null) { try { - methodPermission.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + methodPermission.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, MethodPermission.class, "setDescriptions", Text[].class, e); } } - if (roleName != null) { + if (roleName!= null) { methodPermission.roleName = roleName; } - if (method != null) { + if (method!= null) { methodPermission.method = method; } @@ -170,38 +176,40 @@ public final static MethodPermission _read(final XoXMLStreamReader reader, Runti return methodPermission; } - public final MethodPermission read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final MethodPermission read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final MethodPermission methodPermission, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, MethodPermission methodPermission, RuntimeContext context) + throws Exception + { if (methodPermission == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (MethodPermission.class != methodPermission.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (MethodPermission.class!= methodPermission.getClass()) { context.unexpectedSubclass(writer, methodPermission, MethodPermission.class); - return; + return ; } context.beforeMarshal(methodPermission, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = methodPermission.id; - if (idRaw != null) { + String idRaw = methodPermission.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(methodPermission, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -211,12 +219,12 @@ public final static void _write(final XoXMLStreamWriter writer, final MethodPerm Text[] descriptions = null; try { descriptions = methodPermission.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(methodPermission, "descriptions", MethodPermission.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -227,16 +235,16 @@ public final static void _write(final XoXMLStreamWriter writer, final MethodPerm } // ELEMENT: roleName - final List roleNameRaw = methodPermission.roleName; - if (roleNameRaw != null) { - for (final String roleNameItem : roleNameRaw) { + List roleNameRaw = methodPermission.roleName; + if (roleNameRaw!= null) { + for (String roleNameItem: roleNameRaw) { String roleName = null; try { roleName = Adapters.collapsedStringAdapterAdapter.marshal(roleNameItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(methodPermission, "roleName", CollapsedStringAdapter.class, List.class, List.class, e); } - if (roleName != null) { + if (roleName!= null) { writer.writeStartElement(prefix, "role-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(roleName); writer.writeEndElement(); @@ -247,18 +255,18 @@ public final static void _write(final XoXMLStreamWriter writer, final MethodPerm } // ELEMENT: unchecked - final Empty unchecked = methodPermission.unchecked; - if (unchecked != null) { + 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 = methodPermission.method; - if (method != null) { - for (final Method methodItem : method) { - if (methodItem != null) { + List method = methodPermission.method; + if (method!= null) { + for (Method methodItem: method) { + if (methodItem!= null) { writer.writeStartElement(prefix, "method", "http://java.sun.com/xml/ns/javaee"); writeMethod(writer, methodItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MimeMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MimeMapping$JAXB.java index 15df574a003..ce87957c5c6 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MimeMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MimeMapping$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class MimeMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public MimeMapping$JAXB() { super(MimeMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "mime-mappingType".intern())); } - public static MimeMapping readMimeMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static MimeMapping readMimeMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMimeMapping(final XoXMLStreamWriter writer, final MimeMapping mimeMapping, final RuntimeContext context) - throws Exception { + public static void writeMimeMapping(XoXMLStreamWriter writer, MimeMapping mimeMapping, RuntimeContext context) + throws Exception + { _write(writer, mimeMapping, context); } - public void write(final XoXMLStreamWriter writer, final MimeMapping mimeMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, MimeMapping mimeMapping, RuntimeContext context) + throws Exception + { _write(writer, mimeMapping, context); } - public final static MimeMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final MimeMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,53 +70,53 @@ public final static MimeMapping _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final MimeMapping mimeMapping = new MimeMapping(); + MimeMapping mimeMapping = new MimeMapping(); context.beforeUnmarshal(mimeMapping, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("mime-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("mime-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, MimeMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, mimeMapping); mimeMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: extension - final String extensionRaw = elementReader.getElementAsString(); + String extensionRaw = elementReader.getElementText(); - final String extension; + String extension; try { extension = Adapters.collapsedStringAdapterAdapter.unmarshal(extensionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } mimeMapping.extension = extension; - } else if (("mime-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mime-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mimeType - final String mimeTypeRaw = elementReader.getElementAsString(); + String mimeTypeRaw = elementReader.getElementText(); - final String mimeType; + String mimeType; try { mimeType = Adapters.collapsedStringAdapterAdapter.unmarshal(mimeTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -127,52 +132,54 @@ public final static MimeMapping _read(final XoXMLStreamReader reader, RuntimeCon return mimeMapping; } - public final MimeMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final MimeMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final MimeMapping mimeMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, MimeMapping mimeMapping, RuntimeContext context) + throws Exception + { if (mimeMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (MimeMapping.class != mimeMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (MimeMapping.class!= mimeMapping.getClass()) { context.unexpectedSubclass(writer, mimeMapping, MimeMapping.class); - return; + return ; } context.beforeMarshal(mimeMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = mimeMapping.id; - if (idRaw != null) { + String idRaw = mimeMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(mimeMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: extension - final String extensionRaw = mimeMapping.extension; + String extensionRaw = mimeMapping.extension; String extension = null; try { extension = Adapters.collapsedStringAdapterAdapter.marshal(extensionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(mimeMapping, "extension", CollapsedStringAdapter.class, String.class, String.class, e); } - if (extension != null) { + if (extension!= null) { writer.writeStartElement(prefix, "extension", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(extension); writer.writeEndElement(); @@ -181,14 +188,14 @@ public final static void _write(final XoXMLStreamWriter writer, final MimeMappin } // ELEMENT: mimeType - final String mimeTypeRaw = mimeMapping.mimeType; + String mimeTypeRaw = mimeMapping.mimeType; String mimeType = null; try { mimeType = Adapters.collapsedStringAdapterAdapter.marshal(mimeTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(mimeMapping, "mimeType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mimeType != null) { + if (mimeType!= null) { writer.writeStartElement(prefix, "mime-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(mimeType); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Module$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Module$JAXB.java index 1a4e6478a4b..86b92b1a716 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Module$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Module$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.Web$JAXB.readWeb; import static org.apache.openejb.jee.Web$JAXB.writeWeb; @@ -34,30 +35,35 @@ "StringEquality" }) public class Module$JAXB - extends JAXBObject { + extends JAXBObject +{ public Module$JAXB() { super(Module.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "moduleType".intern()), Web$JAXB.class); } - public static Module readModule(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Module readModule(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeModule(final XoXMLStreamWriter writer, final Module module, final RuntimeContext context) - throws Exception { + public static void writeModule(XoXMLStreamWriter writer, Module module, RuntimeContext context) + throws Exception + { _write(writer, module, context); } - public void write(final XoXMLStreamWriter writer, final Module module, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Module module, RuntimeContext context) + throws Exception + { _write(writer, module, context); } - public final static Module _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Module _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -68,83 +74,83 @@ public final static Module _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final Module module = new Module(); + Module module = new Module(); context.beforeUnmarshal(module, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("moduleType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + 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 (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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 (("connector" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("connector" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: connector - final String connectorRaw = elementReader.getElementAsString(); + String connectorRaw = elementReader.getElementText(); - final String connector; + String connector; try { connector = Adapters.collapsedStringAdapterAdapter.unmarshal(connectorRaw); - } catch (final Exception e) { + } 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())) { + } else if (("ejb" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejb - final String ejbRaw = elementReader.getElementAsString(); + String ejbRaw = elementReader.getElementText(); - final String ejb; + String ejb; try { ejb = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbRaw); - } catch (final Exception e) { + } 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())) { + } else if (("java" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: java - final String javaRaw = elementReader.getElementAsString(); + String javaRaw = elementReader.getElementText(); - final String java; + String java; try { java = Adapters.collapsedStringAdapterAdapter.unmarshal(javaRaw); - } catch (final Exception e) { + } 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())) { + } else if (("web" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: web - final Web web = readWeb(elementReader, context); + Web web = readWeb(elementReader, context); module.web = web; - } else if (("alt-dd" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("alt-dd" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: altDd - final String altDdRaw = elementReader.getElementAsString(); + String altDdRaw = elementReader.getElementText(); - final String altDd; + String altDd; try { altDd = Adapters.collapsedStringAdapterAdapter.unmarshal(altDdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -160,102 +166,104 @@ public final static Module _read(final XoXMLStreamReader reader, RuntimeContext return module; } - public final Module read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Module read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Module module, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Module module, RuntimeContext context) + throws Exception + { if (module == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Module.class != module.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Module.class!= module.getClass()) { context.unexpectedSubclass(writer, module, Module.class); - return; + return ; } context.beforeMarshal(module, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = module.id; - if (idRaw != null) { + String idRaw = module.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(module, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: connector - final String connectorRaw = module.connector; + String connectorRaw = module.connector; String connector = null; try { connector = Adapters.collapsedStringAdapterAdapter.marshal(connectorRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(module, "connector", CollapsedStringAdapter.class, String.class, String.class, e); } - if (connector != null) { + if (connector!= null) { writer.writeStartElement(prefix, "connector", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(connector); writer.writeEndElement(); } // ELEMENT: ejb - final String ejbRaw = module.ejb; + String ejbRaw = module.ejb; String ejb = null; try { ejb = Adapters.collapsedStringAdapterAdapter.marshal(ejbRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(module, "ejb", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejb != null) { + if (ejb!= null) { writer.writeStartElement(prefix, "ejb", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejb); writer.writeEndElement(); } // ELEMENT: java - final String javaRaw = module.java; + String javaRaw = module.java; String java = null; try { java = Adapters.collapsedStringAdapterAdapter.marshal(javaRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(module, "java", CollapsedStringAdapter.class, String.class, String.class, e); } - if (java != null) { + if (java!= null) { writer.writeStartElement(prefix, "java", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(java); writer.writeEndElement(); } // ELEMENT: web - final Web web = module.web; - if (web != null) { + 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 - final String altDdRaw = module.altDd; + String altDdRaw = module.altDd; String altDd = null; try { altDd = Adapters.collapsedStringAdapterAdapter.marshal(altDdRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(module, "altDd", CollapsedStringAdapter.class, String.class, String.class, e); } - if (altDd != null) { + if (altDd!= null) { writer.writeStartElement(prefix, "alt-dd", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(altDd); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MultipartConfig$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MultipartConfig$JAXB.java index 6741a13d88c..4c5184d4b45 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MultipartConfig$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MultipartConfig$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class MultipartConfig$JAXB - extends JAXBObject { + extends JAXBObject +{ public MultipartConfig$JAXB() { super(MultipartConfig.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "multipart-configType".intern())); } - public static MultipartConfig readMultipartConfig(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static MultipartConfig readMultipartConfig(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeMultipartConfig(final XoXMLStreamWriter writer, final MultipartConfig multipartConfig, final RuntimeContext context) - throws Exception { + public static void writeMultipartConfig(XoXMLStreamWriter writer, MultipartConfig multipartConfig, RuntimeContext context) + throws Exception + { _write(writer, multipartConfig, context); } - public void write(final XoXMLStreamWriter writer, final MultipartConfig multipartConfig, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, MultipartConfig multipartConfig, RuntimeContext context) + throws Exception + { _write(writer, multipartConfig, context); } - public final static MultipartConfig _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final MultipartConfig _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,51 +70,51 @@ public final static MultipartConfig _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final MultipartConfig multipartConfig = new MultipartConfig(); + MultipartConfig multipartConfig = new MultipartConfig(); context.beforeUnmarshal(multipartConfig, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("multipart-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("multipart-configType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, MultipartConfig.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("location" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("location" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: location - final String locationRaw = elementReader.getElementAsString(); + String locationRaw = elementReader.getElementText(); - final String location; + String location; try { location = Adapters.collapsedStringAdapterAdapter.unmarshal(locationRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } multipartConfig.location = location; - } else if (("max-file-size" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("max-file-size" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: maxFileSize - final Long maxFileSize = Long.valueOf(elementReader.getElementAsString()); + Long maxFileSize = Long.valueOf(elementReader.getElementText()); multipartConfig.maxFileSize = maxFileSize; - } else if (("max-request-size" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("max-request-size" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: maxRequestSize - final Long maxRequestSize = Long.valueOf(elementReader.getElementAsString()); + Long maxRequestSize = Long.valueOf(elementReader.getElementText()); multipartConfig.maxRequestSize = maxRequestSize; - } else if (("file-size-threshold" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("file-size-threshold" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: fileSizeThreshold - final Integer fileSizeThreshold = Integer.valueOf(elementReader.getElementAsString()); + Integer fileSizeThreshold = Integer.valueOf(elementReader.getElementText()); multipartConfig.fileSizeThreshold = fileSizeThreshold; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "location"), new QName("http://java.sun.com/xml/ns/javaee", "max-file-size"), new QName("http://java.sun.com/xml/ns/javaee", "max-request-size"), new QName("http://java.sun.com/xml/ns/javaee", "file-size-threshold")); @@ -121,59 +126,61 @@ public final static MultipartConfig _read(final XoXMLStreamReader reader, Runtim return multipartConfig; } - public final MultipartConfig read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final MultipartConfig read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final MultipartConfig multipartConfig, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, MultipartConfig multipartConfig, RuntimeContext context) + throws Exception + { if (multipartConfig == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (MultipartConfig.class != multipartConfig.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (MultipartConfig.class!= multipartConfig.getClass()) { context.unexpectedSubclass(writer, multipartConfig, MultipartConfig.class); - return; + return ; } context.beforeMarshal(multipartConfig, LifecycleCallback.NONE); // ELEMENT: location - final String locationRaw = multipartConfig.location; + String locationRaw = multipartConfig.location; String location = null; try { location = Adapters.collapsedStringAdapterAdapter.marshal(locationRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(multipartConfig, "location", CollapsedStringAdapter.class, String.class, String.class, e); } - if (location != null) { + if (location!= null) { writer.writeStartElement(prefix, "location", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(location); writer.writeEndElement(); } // ELEMENT: maxFileSize - final Long maxFileSize = multipartConfig.maxFileSize; + Long maxFileSize = multipartConfig.maxFileSize; writer.writeStartElement(prefix, "max-file-size", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Long.toString(maxFileSize)); writer.writeEndElement(); // ELEMENT: maxRequestSize - final Long maxRequestSize = multipartConfig.maxRequestSize; + Long maxRequestSize = multipartConfig.maxRequestSize; writer.writeStartElement(prefix, "max-request-size", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Long.toString(maxRequestSize)); writer.writeEndElement(); // ELEMENT: fileSizeThreshold - final Integer fileSizeThreshold = multipartConfig.fileSizeThreshold; + Integer fileSizeThreshold = multipartConfig.fileSizeThreshold; writer.writeStartElement(prefix, "file-size-threshold", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(fileSizeThreshold)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Multiplicity$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Multiplicity$JAXB.java index 3e030b5966d..8fd6cc33c0c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Multiplicity$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Multiplicity$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class Multiplicity$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public Multiplicity$JAXB() { super(Multiplicity.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "multiplicity".intern())); } - public Multiplicity parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public Multiplicity parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseMultiplicity(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final Multiplicity multiplicity) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, Multiplicity multiplicity) + throws Exception + { return toStringMultiplicity(bean, parameterName, context, multiplicity); } - public static Multiplicity parseMultiplicity(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static Multiplicity parseMultiplicity(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("One".equals(value)) { return Multiplicity.ONE; } else if ("Many".equals(value)) { @@ -52,8 +56,9 @@ public static Multiplicity parseMultiplicity(final XoXMLStreamReader reader, fin } } - public static String toStringMultiplicity(final Object bean, final String parameterName, final RuntimeContext context, final Multiplicity multiplicity) - throws Exception { + public static String toStringMultiplicity(Object bean, String parameterName, RuntimeContext context, Multiplicity multiplicity) + throws Exception + { if (Multiplicity.ONE == multiplicity) { return "One"; } else if (Multiplicity.MANY == multiplicity) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/NamedMethod$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/NamedMethod$JAXB.java index f5c520dbfe1..2c95c25537c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/NamedMethod$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/NamedMethod$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.MethodParams$JAXB.readMethodParams; import static org.apache.openejb.jee.MethodParams$JAXB.writeMethodParams; @@ -34,30 +35,35 @@ "StringEquality" }) public class NamedMethod$JAXB - extends JAXBObject { + extends JAXBObject +{ public NamedMethod$JAXB() { super(NamedMethod.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "named-methodType".intern()), MethodParams$JAXB.class); } - public static NamedMethod readNamedMethod(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static NamedMethod readNamedMethod(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeNamedMethod(final XoXMLStreamWriter writer, final NamedMethod namedMethod, final RuntimeContext context) - throws Exception { + public static void writeNamedMethod(XoXMLStreamWriter writer, NamedMethod namedMethod, RuntimeContext context) + throws Exception + { _write(writer, namedMethod, context); } - public void write(final XoXMLStreamWriter writer, final NamedMethod namedMethod, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, NamedMethod namedMethod, RuntimeContext context) + throws Exception + { _write(writer, namedMethod, context); } - public final static NamedMethod _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final NamedMethod _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -68,48 +74,48 @@ public final static NamedMethod _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final NamedMethod namedMethod = new NamedMethod(); + NamedMethod namedMethod = new NamedMethod(); context.beforeUnmarshal(namedMethod, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("named-methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("named-methodType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, NamedMethod.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, namedMethod); namedMethod.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("method-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("method-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodName - final String methodNameRaw = elementReader.getElementAsString(); + String methodNameRaw = elementReader.getElementText(); - final String methodName; + String methodName; try { methodName = Adapters.collapsedStringAdapterAdapter.unmarshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } namedMethod.methodName = methodName; - } else if (("method-params" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method-params" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodParams - final MethodParams methodParams = readMethodParams(elementReader, context); + MethodParams methodParams = readMethodParams(elementReader, context); namedMethod.methodParams = methodParams; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "method-name"), new QName("http://java.sun.com/xml/ns/javaee", "method-params")); @@ -121,52 +127,54 @@ public final static NamedMethod _read(final XoXMLStreamReader reader, RuntimeCon return namedMethod; } - public final NamedMethod read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final NamedMethod read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final NamedMethod namedMethod, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, NamedMethod namedMethod, RuntimeContext context) + throws Exception + { if (namedMethod == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (NamedMethod.class != namedMethod.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (NamedMethod.class!= namedMethod.getClass()) { context.unexpectedSubclass(writer, namedMethod, NamedMethod.class); - return; + return ; } context.beforeMarshal(namedMethod, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = namedMethod.id; - if (idRaw != null) { + String idRaw = namedMethod.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(namedMethod, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: methodName - final String methodNameRaw = namedMethod.methodName; + String methodNameRaw = namedMethod.methodName; String methodName = null; try { methodName = Adapters.collapsedStringAdapterAdapter.marshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(namedMethod, "methodName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (methodName != null) { + if (methodName!= null) { writer.writeStartElement(prefix, "method-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(methodName); writer.writeEndElement(); @@ -175,8 +183,8 @@ public final static void _write(final XoXMLStreamWriter writer, final NamedMetho } // ELEMENT: methodParams - final MethodParams methodParams = namedMethod.methodParams; - if (methodParams != null) { + MethodParams methodParams = namedMethod.methodParams; + if (methodParams!= null) { writer.writeStartElement(prefix, "method-params", "http://java.sun.com/xml/ns/javaee"); writeMethodParams(writer, methodParams, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ObjectFactory$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ObjectFactory$JAXB.java index 3a83c94fe32..d1f3d7cef8c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ObjectFactory$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ObjectFactory$JAXB.java @@ -1,36 +1,37 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.openejb.jee; -import org.metatype.sxc.jaxb.JAXBObject; -import org.metatype.sxc.jaxb.JAXBObjectFactory; +package org.apache.openejb.jee; -import javax.xml.namespace.QName; import java.util.HashMap; import java.util.Map; +import javax.xml.namespace.QName; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.JAXBObjectFactory; public class ObjectFactory$JAXB - extends JAXBObjectFactory { + extends JAXBObjectFactory +{ - public final static ObjectFactory$JAXB INSTANCE = new ObjectFactory$JAXB(); - private final Map> rootElements = new HashMap>(); + public static final ObjectFactory$JAXB INSTANCE = new ObjectFactory$JAXB(); + private final Map> rootElements = new HashMap<>(); public ObjectFactory$JAXB() { - super(ObjectFactory.class, Application$JAXB.class, ApplicationClient$JAXB.class, EjbJar$JAXB.class, EjbRelationshipRole$JAXB.class, Text$JAXB.class, WebApp$JAXB.class, TldTaglib$JAXB.class, JavaWsdlMapping$JAXB.class, Connector$JAXB.class, Webservices$JAXB.class, FacesConfig$JAXB.class); + super(ObjectFactory.class, Application$JAXB.class, ApplicationClient$JAXB.class, EjbJar$JAXB.class, EjbRelationshipRole$JAXB.class, Text$JAXB.class, WebApp$JAXB.class, TldTaglib$JAXB.class, Connector$JAXB.class, Webservices$JAXB.class, JavaWsdlMapping$JAXB.class, FacesConfig$JAXB.class, WebFragment$JAXB.class); rootElements.put(new QName("http://java.sun.com/xml/ns/javaee".intern(), "application".intern()), Application$JAXB.class); rootElements.put(new QName("http://java.sun.com/xml/ns/javaee".intern(), "application-client".intern()), ApplicationClient$JAXB.class); rootElements.put(new QName("http://java.sun.com/xml/ns/javaee".intern(), "ejb-jar".intern()), EjbJar$JAXB.class); @@ -40,10 +41,11 @@ public class ObjectFactory$JAXB rootElements.put(new QName("http://java.sun.com/xml/ns/javaee".intern(), "http-method".intern()), org.metatype.sxc.jaxb.StandardJAXBObjects.StringJAXB.class); rootElements.put(new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-app".intern()), WebApp$JAXB.class); rootElements.put(new QName("http://java.sun.com/xml/ns/javaee".intern(), "taglib".intern()), TldTaglib$JAXB.class); - rootElements.put(new QName("http://java.sun.com/xml/ns/j2ee".intern(), "java-wsdl-mapping".intern()), JavaWsdlMapping$JAXB.class); rootElements.put(new QName("http://java.sun.com/xml/ns/j2ee".intern(), "connector".intern()), Connector$JAXB.class); rootElements.put(new QName("http://java.sun.com/xml/ns/javaee".intern(), "webservices".intern()), Webservices$JAXB.class); + rootElements.put(new QName("http://java.sun.com/xml/ns/j2ee".intern(), "java-wsdl-mapping".intern()), JavaWsdlMapping$JAXB.class); rootElements.put(new QName("http://java.sun.com/xml/ns/javaee".intern(), "faces-config".intern()), FacesConfig$JAXB.class); + rootElements.put(new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-fragment".intern()), WebFragment$JAXB.class); } public Map> getRootElements() { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Ordering$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Ordering$JAXB.java new file mode 100644 index 00000000000..2cddce74d13 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Ordering$JAXB.java @@ -0,0 +1,161 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.OrderingOrdering$JAXB.readOrderingOrdering; +import static org.apache.openejb.jee.OrderingOrdering$JAXB.writeOrderingOrdering; + +@SuppressWarnings({ + "StringEquality" +}) +public class Ordering$JAXB + extends JAXBObject +{ + + + public Ordering$JAXB() { + super(Ordering.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "orderingType".intern()), OrderingOrdering$JAXB.class); + } + + public static Ordering readOrdering(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeOrdering(XoXMLStreamWriter writer, Ordering ordering, RuntimeContext context) + throws Exception + { + _write(writer, ordering, context); + } + + public void write(XoXMLStreamWriter writer, Ordering ordering, RuntimeContext context) + throws Exception + { + _write(writer, ordering, context); + } + + public static final Ordering _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + Ordering ordering = new Ordering(); + context.beforeUnmarshal(ordering, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("orderingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, Ordering.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("after" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: after + OrderingOrdering after = readOrderingOrdering(elementReader, context); + ordering.after = after; + } else if (("before" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: before + OrderingOrdering before = readOrderingOrdering(elementReader, context); + ordering.before = before; + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "after"), new QName("http://java.sun.com/xml/ns/javaee", "before")); + } + } + + context.afterUnmarshal(ordering, LifecycleCallback.NONE); + + return ordering; + } + + public final Ordering read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, Ordering ordering, RuntimeContext context) + throws Exception + { + if (ordering == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Ordering.class!= ordering.getClass()) { + context.unexpectedSubclass(writer, ordering, Ordering.class); + return ; + } + + context.beforeMarshal(ordering, LifecycleCallback.NONE); + + + // ELEMENT: after + OrderingOrdering after = ordering.after; + if (after!= null) { + writer.writeStartElement(prefix, "after", "http://java.sun.com/xml/ns/javaee"); + writeOrderingOrdering(writer, after, context); + writer.writeEndElement(); + } + + // ELEMENT: before + OrderingOrdering before = ordering.before; + if (before!= null) { + writer.writeStartElement(prefix, "before", "http://java.sun.com/xml/ns/javaee"); + writeOrderingOrdering(writer, before, context); + writer.writeEndElement(); + } + + context.afterMarshal(ordering, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OrderingOrdering$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OrderingOrdering$JAXB.java new file mode 100644 index 00000000000..4afa99d25a6 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OrderingOrdering$JAXB.java @@ -0,0 +1,200 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.OrderingOthers$JAXB.readOrderingOthers; +import static org.apache.openejb.jee.OrderingOthers$JAXB.writeOrderingOthers; + +@SuppressWarnings({ + "StringEquality" +}) +public class OrderingOrdering$JAXB + extends JAXBObject +{ + + + public OrderingOrdering$JAXB() { + super(OrderingOrdering.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "ordering-orderingType".intern()), OrderingOthers$JAXB.class); + } + + public static OrderingOrdering readOrderingOrdering(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeOrderingOrdering(XoXMLStreamWriter writer, OrderingOrdering orderingOrdering, RuntimeContext context) + throws Exception + { + _write(writer, orderingOrdering, context); + } + + public void write(XoXMLStreamWriter writer, OrderingOrdering orderingOrdering, RuntimeContext context) + throws Exception + { + _write(writer, orderingOrdering, context); + } + + public static final OrderingOrdering _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + OrderingOrdering orderingOrdering = new OrderingOrdering(); + context.beforeUnmarshal(orderingOrdering, LifecycleCallback.NONE); + + List name = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("ordering-orderingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, OrderingOrdering.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: name + String nameItemRaw = null; + if (!elementReader.isXsiNil()) { + nameItemRaw = elementReader.getElementText(); + } + + String nameItem; + try { + nameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(nameItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (name == null) { + name = orderingOrdering.name; + if (name!= null) { + name.clear(); + } else { + name = new ArrayList<>(); + } + } + name.add(nameItem); + } else if (("others" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: others + OrderingOthers others = readOrderingOthers(elementReader, context); + orderingOrdering.others = others; + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "others")); + } + } + if (name!= null) { + orderingOrdering.name = name; + } + + context.afterUnmarshal(orderingOrdering, LifecycleCallback.NONE); + + return orderingOrdering; + } + + public final OrderingOrdering read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, OrderingOrdering orderingOrdering, RuntimeContext context) + throws Exception + { + if (orderingOrdering == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (OrderingOrdering.class!= orderingOrdering.getClass()) { + context.unexpectedSubclass(writer, orderingOrdering, OrderingOrdering.class); + return ; + } + + context.beforeMarshal(orderingOrdering, LifecycleCallback.NONE); + + + // ELEMENT: name + List nameRaw = orderingOrdering.name; + if (nameRaw!= null) { + for (String nameItem: nameRaw) { + String name = null; + try { + name = Adapters.collapsedStringAdapterAdapter.marshal(nameItem); + } catch (Exception e) { + context.xmlAdapterError(orderingOrdering, "name", CollapsedStringAdapter.class, List.class, List.class, e); + } + writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); + if (name!= null) { + writer.writeCharacters(name); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + // ELEMENT: others + OrderingOthers others = orderingOrdering.others; + if (others!= null) { + writer.writeStartElement(prefix, "others", "http://java.sun.com/xml/ns/javaee"); + writeOrderingOthers(writer, others, context); + writer.writeEndElement(); + } + + context.afterMarshal(orderingOrdering, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OrderingOthers$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OrderingOthers$JAXB.java index adc5043cd96..24a9d1ef66d 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OrderingOthers$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OrderingOthers$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class OrderingOthers$JAXB - extends JAXBObject { + extends JAXBObject +{ public OrderingOthers$JAXB() { super(OrderingOthers.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "ordering-othersType".intern())); } - public static OrderingOthers readOrderingOthers(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static OrderingOthers readOrderingOthers(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeOrderingOthers(final XoXMLStreamWriter writer, final OrderingOthers orderingOthers, final RuntimeContext context) - throws Exception { + public static void writeOrderingOthers(XoXMLStreamWriter writer, OrderingOthers orderingOthers, RuntimeContext context) + throws Exception + { _write(writer, orderingOthers, context); } - public void write(final XoXMLStreamWriter writer, final OrderingOthers orderingOthers, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, OrderingOthers orderingOthers, RuntimeContext context) + throws Exception + { _write(writer, orderingOthers, context); } - public final static OrderingOthers _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final OrderingOthers _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,32 +70,32 @@ public final static OrderingOthers _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final OrderingOthers orderingOthers = new OrderingOthers(); + OrderingOthers orderingOthers = new OrderingOthers(); context.beforeUnmarshal(orderingOthers, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("ordering-othersType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("ordering-othersType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, OrderingOthers.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, orderingOthers); orderingOthers.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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()) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { context.unexpectedElement(elementReader); } @@ -99,37 +104,39 @@ public final static OrderingOthers _read(final XoXMLStreamReader reader, Runtime return orderingOthers; } - public final OrderingOthers read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final OrderingOthers read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final OrderingOthers orderingOthers, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, OrderingOthers orderingOthers, RuntimeContext context) + throws Exception + { if (orderingOthers == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (OrderingOthers.class != orderingOthers.getClass()) { + if (OrderingOthers.class!= orderingOthers.getClass()) { context.unexpectedSubclass(writer, orderingOthers, OrderingOthers.class); - return; + return ; } context.beforeMarshal(orderingOthers, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = orderingOthers.id; - if (idRaw != null) { + String idRaw = orderingOthers.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(orderingOthers, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OutboundResourceAdapter$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OutboundResourceAdapter$JAXB.java index 8d79ec47266..3bc03870f5a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OutboundResourceAdapter$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/OutboundResourceAdapter$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.AuthenticationMechanism$JAXB.readAuthenticationMechanism; import static org.apache.openejb.jee.AuthenticationMechanism$JAXB.writeAuthenticationMechanism; @@ -40,30 +41,35 @@ "StringEquality" }) public class OutboundResourceAdapter$JAXB - extends JAXBObject { + extends JAXBObject +{ public OutboundResourceAdapter$JAXB() { super(OutboundResourceAdapter.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "outbound-resourceadapterType".intern()), ConnectionDefinition$JAXB.class, TransactionSupportType$JAXB.class, AuthenticationMechanism$JAXB.class); } - public static OutboundResourceAdapter readOutboundResourceAdapter(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static OutboundResourceAdapter readOutboundResourceAdapter(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeOutboundResourceAdapter(final XoXMLStreamWriter writer, final OutboundResourceAdapter outboundResourceAdapter, final RuntimeContext context) - throws Exception { + public static void writeOutboundResourceAdapter(XoXMLStreamWriter writer, OutboundResourceAdapter outboundResourceAdapter, RuntimeContext context) + throws Exception + { _write(writer, outboundResourceAdapter, context); } - public void write(final XoXMLStreamWriter writer, final OutboundResourceAdapter outboundResourceAdapter, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, OutboundResourceAdapter outboundResourceAdapter, RuntimeContext context) + throws Exception + { _write(writer, outboundResourceAdapter, context); } - public final static OutboundResourceAdapter _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final OutboundResourceAdapter _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,76 +80,76 @@ public final static OutboundResourceAdapter _read(final XoXMLStreamReader reader context = new RuntimeContext(); } - final OutboundResourceAdapter outboundResourceAdapter = new OutboundResourceAdapter(); + OutboundResourceAdapter outboundResourceAdapter = new OutboundResourceAdapter(); context.beforeUnmarshal(outboundResourceAdapter, LifecycleCallback.NONE); List connectionDefinition = null; List authenticationMechanism = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("outbound-resourceadapterType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("outbound-resourceadapterType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, OutboundResourceAdapter.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, outboundResourceAdapter); outboundResourceAdapter.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("connection-definition" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("connection-definition" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: connectionDefinition - final ConnectionDefinition connectionDefinitionItem = readConnectionDefinition(elementReader, context); + ConnectionDefinition connectionDefinitionItem = readConnectionDefinition(elementReader, context); if (connectionDefinition == null) { connectionDefinition = outboundResourceAdapter.connectionDefinition; - if (connectionDefinition != null) { + if (connectionDefinition!= null) { connectionDefinition.clear(); } else { - connectionDefinition = new ArrayList(); + connectionDefinition = new ArrayList<>(); } } connectionDefinition.add(connectionDefinitionItem); - } else if (("transaction-support" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("transaction-support" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: transactionSupport - final TransactionSupportType transactionSupport = parseTransactionSupportType(elementReader, context, elementReader.getElementAsString()); - if (transactionSupport != null) { + TransactionSupportType transactionSupport = parseTransactionSupportType(elementReader, context, elementReader.getElementText()); + if (transactionSupport!= null) { outboundResourceAdapter.transactionSupport = transactionSupport; } - } else if (("authentication-mechanism" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("authentication-mechanism" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: authenticationMechanism - final AuthenticationMechanism authenticationMechanismItem = readAuthenticationMechanism(elementReader, context); + AuthenticationMechanism authenticationMechanismItem = readAuthenticationMechanism(elementReader, context); if (authenticationMechanism == null) { authenticationMechanism = outboundResourceAdapter.authenticationMechanism; - if (authenticationMechanism != null) { + if (authenticationMechanism!= null) { authenticationMechanism.clear(); } else { - authenticationMechanism = new ArrayList(); + authenticationMechanism = new ArrayList<>(); } } authenticationMechanism.add(authenticationMechanismItem); - } else if (("reauthentication-support" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("reauthentication-support" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: reauthenticationSupport - final Boolean reauthenticationSupport = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean reauthenticationSupport = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); outboundResourceAdapter.reauthenticationSupport = reauthenticationSupport; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "connection-definition"), new QName("http://java.sun.com/xml/ns/javaee", "transaction-support"), new QName("http://java.sun.com/xml/ns/javaee", "authentication-mechanism"), new QName("http://java.sun.com/xml/ns/javaee", "reauthentication-support")); } } - if (connectionDefinition != null) { + if (connectionDefinition!= null) { outboundResourceAdapter.connectionDefinition = connectionDefinition; } - if (authenticationMechanism != null) { + if (authenticationMechanism!= null) { outboundResourceAdapter.authenticationMechanism = authenticationMechanism; } @@ -152,48 +158,50 @@ public final static OutboundResourceAdapter _read(final XoXMLStreamReader reader return outboundResourceAdapter; } - public final OutboundResourceAdapter read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final OutboundResourceAdapter read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final OutboundResourceAdapter outboundResourceAdapter, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, OutboundResourceAdapter outboundResourceAdapter, RuntimeContext context) + throws Exception + { if (outboundResourceAdapter == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (OutboundResourceAdapter.class != outboundResourceAdapter.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (OutboundResourceAdapter.class!= outboundResourceAdapter.getClass()) { context.unexpectedSubclass(writer, outboundResourceAdapter, OutboundResourceAdapter.class); - return; + return ; } context.beforeMarshal(outboundResourceAdapter, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = outboundResourceAdapter.id; - if (idRaw != null) { + String idRaw = outboundResourceAdapter.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(outboundResourceAdapter, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: connectionDefinition - final List connectionDefinition = outboundResourceAdapter.connectionDefinition; - if (connectionDefinition != null) { - for (final ConnectionDefinition connectionDefinitionItem : connectionDefinition) { - if (connectionDefinitionItem != null) { + List connectionDefinition = outboundResourceAdapter.connectionDefinition; + if (connectionDefinition!= null) { + for (ConnectionDefinition connectionDefinitionItem: connectionDefinition) { + if (connectionDefinitionItem!= null) { writer.writeStartElement(prefix, "connection-definition", "http://java.sun.com/xml/ns/javaee"); writeConnectionDefinition(writer, connectionDefinitionItem, context); writer.writeEndElement(); @@ -202,18 +210,18 @@ public final static void _write(final XoXMLStreamWriter writer, final OutboundRe } // ELEMENT: transactionSupport - final TransactionSupportType transactionSupport = outboundResourceAdapter.transactionSupport; - if (transactionSupport != null) { + TransactionSupportType transactionSupport = outboundResourceAdapter.transactionSupport; + if (transactionSupport!= null) { writer.writeStartElement(prefix, "transaction-support", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringTransactionSupportType(outboundResourceAdapter, null, context, transactionSupport)); writer.writeEndElement(); } // ELEMENT: authenticationMechanism - final List authenticationMechanism = outboundResourceAdapter.authenticationMechanism; - if (authenticationMechanism != null) { - for (final AuthenticationMechanism authenticationMechanismItem : authenticationMechanism) { - if (authenticationMechanismItem != null) { + List authenticationMechanism = outboundResourceAdapter.authenticationMechanism; + if (authenticationMechanism!= null) { + for (AuthenticationMechanism authenticationMechanismItem: authenticationMechanism) { + if (authenticationMechanismItem!= null) { writer.writeStartElement(prefix, "authentication-mechanism", "http://java.sun.com/xml/ns/javaee"); writeAuthenticationMechanism(writer, authenticationMechanismItem, context); writer.writeEndElement(); @@ -222,8 +230,8 @@ public final static void _write(final XoXMLStreamWriter writer, final OutboundRe } // ELEMENT: reauthenticationSupport - final Boolean reauthenticationSupport = outboundResourceAdapter.reauthenticationSupport; - if (reauthenticationSupport != null) { + Boolean reauthenticationSupport = outboundResourceAdapter.reauthenticationSupport; + if (reauthenticationSupport!= null) { writer.writeStartElement(prefix, "reauthentication-support", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(reauthenticationSupport)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PackageMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PackageMapping$JAXB.java index 670553d1ccf..ebafe173998 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PackageMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PackageMapping$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class PackageMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public PackageMapping$JAXB() { super(PackageMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "package-mappingType".intern())); } - public static PackageMapping readPackageMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static PackageMapping readPackageMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writePackageMapping(final XoXMLStreamWriter writer, final PackageMapping packageMapping, final RuntimeContext context) - throws Exception { + public static void writePackageMapping(XoXMLStreamWriter writer, PackageMapping packageMapping, RuntimeContext context) + throws Exception + { _write(writer, packageMapping, context); } - public void write(final XoXMLStreamWriter writer, final PackageMapping packageMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, PackageMapping packageMapping, RuntimeContext context) + throws Exception + { _write(writer, packageMapping, context); } - public final static PackageMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final PackageMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,53 +70,53 @@ public final static PackageMapping _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final PackageMapping packageMapping = new PackageMapping(); + PackageMapping packageMapping = new PackageMapping(); context.beforeUnmarshal(packageMapping, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("package-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("package-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, PackageMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, packageMapping); packageMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("package-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("package-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: packageType - final String packageTypeRaw = elementReader.getElementAsString(); + String packageTypeRaw = elementReader.getElementText(); - final String packageType; + String packageType; try { packageType = Adapters.collapsedStringAdapterAdapter.unmarshal(packageTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } packageMapping.packageType = packageType; - } else if (("namespaceURI" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("namespaceURI" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: namespaceURI - final String namespaceURIRaw = elementReader.getElementAsString(); + String namespaceURIRaw = elementReader.getElementText(); - final String namespaceURI; + String namespaceURI; try { namespaceURI = Adapters.collapsedStringAdapterAdapter.unmarshal(namespaceURIRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -127,52 +132,54 @@ public final static PackageMapping _read(final XoXMLStreamReader reader, Runtime return packageMapping; } - public final PackageMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final PackageMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final PackageMapping packageMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, PackageMapping packageMapping, RuntimeContext context) + throws Exception + { if (packageMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (PackageMapping.class != packageMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (PackageMapping.class!= packageMapping.getClass()) { context.unexpectedSubclass(writer, packageMapping, PackageMapping.class); - return; + return ; } context.beforeMarshal(packageMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = packageMapping.id; - if (idRaw != null) { + String idRaw = packageMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(packageMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: packageType - final String packageTypeRaw = packageMapping.packageType; + String packageTypeRaw = packageMapping.packageType; String packageType = null; try { packageType = Adapters.collapsedStringAdapterAdapter.marshal(packageTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(packageMapping, "packageType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (packageType != null) { + if (packageType!= null) { writer.writeStartElement(prefix, "package-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(packageType); writer.writeEndElement(); @@ -181,14 +188,14 @@ public final static void _write(final XoXMLStreamWriter writer, final PackageMap } // ELEMENT: namespaceURI - final String namespaceURIRaw = packageMapping.namespaceURI; + String namespaceURIRaw = packageMapping.namespaceURI; String namespaceURI = null; try { namespaceURI = Adapters.collapsedStringAdapterAdapter.marshal(namespaceURIRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(packageMapping, "namespaceURI", CollapsedStringAdapter.class, String.class, String.class, e); } - if (namespaceURI != null) { + if (namespaceURI!= null) { writer.writeStartElement(prefix, "namespaceURI", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(namespaceURI); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ParamValue$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ParamValue$JAXB.java index e39875aa915..79ed1a825d1 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ParamValue$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ParamValue$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class ParamValue$JAXB - extends JAXBObject { + extends JAXBObject +{ public ParamValue$JAXB() { super(ParamValue.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "param-valueType".intern()), Text$JAXB.class); } - public static ParamValue readParamValue(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ParamValue readParamValue(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeParamValue(final XoXMLStreamWriter writer, final ParamValue paramValue, final RuntimeContext context) - throws Exception { + public static void writeParamValue(XoXMLStreamWriter writer, ParamValue paramValue, RuntimeContext context) + throws Exception + { _write(writer, paramValue, context); } - public void write(final XoXMLStreamWriter writer, final ParamValue paramValue, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ParamValue paramValue, RuntimeContext context) + throws Exception + { _write(writer, paramValue, context); } - public final static ParamValue _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ParamValue _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,61 +75,61 @@ public final static ParamValue _read(final XoXMLStreamReader reader, RuntimeCont context = new RuntimeContext(); } - final ParamValue paramValue = new ParamValue(); + ParamValue paramValue = new ParamValue(); context.beforeUnmarshal(paramValue, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("param-valueType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("param-valueType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ParamValue.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, paramValue); paramValue.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("param-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("param-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: paramName - final String paramNameRaw = elementReader.getElementAsString(); + String paramNameRaw = elementReader.getElementText(); - final String paramName; + String paramName; try { paramName = Adapters.collapsedStringAdapterAdapter.unmarshal(paramNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } paramValue.paramName = paramName; - } else if (("param-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("param-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: paramValue - final String paramValue1Raw = elementReader.getElementAsString(); + String paramValue1Raw = elementReader.getElementText(); - final String paramValue1; + String paramValue1; try { paramValue1 = Adapters.collapsedStringAdapterAdapter.unmarshal(paramValue1Raw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -133,10 +139,10 @@ public final static ParamValue _read(final XoXMLStreamReader reader, RuntimeCont context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "param-name"), new QName("http://java.sun.com/xml/ns/javaee", "param-value")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - paramValue.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + paramValue.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, ParamValue.class, "setDescriptions", Text[].class, e); } } @@ -146,38 +152,40 @@ public final static ParamValue _read(final XoXMLStreamReader reader, RuntimeCont return paramValue; } - public final ParamValue read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ParamValue read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ParamValue paramValue, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ParamValue paramValue, RuntimeContext context) + throws Exception + { if (paramValue == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ParamValue.class != paramValue.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ParamValue.class!= paramValue.getClass()) { context.unexpectedSubclass(writer, paramValue, ParamValue.class); - return; + return ; } context.beforeMarshal(paramValue, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = paramValue.id; - if (idRaw != null) { + String idRaw = paramValue.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(paramValue, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -187,12 +195,12 @@ public final static void _write(final XoXMLStreamWriter writer, final ParamValue Text[] descriptions = null; try { descriptions = paramValue.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(paramValue, "descriptions", ParamValue.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -203,14 +211,14 @@ public final static void _write(final XoXMLStreamWriter writer, final ParamValue } // ELEMENT: paramName - final String paramNameRaw = paramValue.paramName; + String paramNameRaw = paramValue.paramName; String paramName = null; try { paramName = Adapters.collapsedStringAdapterAdapter.marshal(paramNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(paramValue, "paramName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (paramName != null) { + if (paramName!= null) { writer.writeStartElement(prefix, "param-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(paramName); writer.writeEndElement(); @@ -219,11 +227,11 @@ public final static void _write(final XoXMLStreamWriter writer, final ParamValue } // ELEMENT: paramValue - final String paramValueRaw = paramValue.paramValue; + String paramValueRaw = paramValue.paramValue; String paramValue1 = null; try { paramValue1 = Adapters.collapsedStringAdapterAdapter.marshal(paramValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(paramValue, "paramValue", CollapsedStringAdapter.class, String.class, String.class, e); } if (paramValue1 != null) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextRef$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextRef$JAXB.java index 0749ac6a04f..4f4041a5ae8 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextRef$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextRef$JAXB.java @@ -1,21 +1,29 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,16 +31,11 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; import static org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget; import static org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget; +import static org.apache.openejb.jee.PersistenceContextSynchronization$JAXB.parsePersistenceContextSynchronization; +import static org.apache.openejb.jee.PersistenceContextSynchronization$JAXB.toStringPersistenceContextSynchronization; import static org.apache.openejb.jee.PersistenceContextType$JAXB.parsePersistenceContextType; import static org.apache.openejb.jee.PersistenceContextType$JAXB.toStringPersistenceContextType; import static org.apache.openejb.jee.Property$JAXB.readProperty; @@ -44,30 +47,35 @@ "StringEquality" }) public class PersistenceContextRef$JAXB - extends JAXBObject { + extends JAXBObject +{ public PersistenceContextRef$JAXB() { - super(PersistenceContextRef.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "persistence-context-refType".intern()), Text$JAXB.class, PersistenceContextType$JAXB.class, Property$JAXB.class, InjectionTarget$JAXB.class); + super(PersistenceContextRef.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "persistence-context-refType".intern()), Text$JAXB.class, PersistenceContextType$JAXB.class, PersistenceContextSynchronization$JAXB.class, Property$JAXB.class, InjectionTarget$JAXB.class); } - public static PersistenceContextRef readPersistenceContextRef(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static PersistenceContextRef readPersistenceContextRef(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writePersistenceContextRef(final XoXMLStreamWriter writer, final PersistenceContextRef persistenceContextRef, final RuntimeContext context) - throws Exception { + public static void writePersistenceContextRef(XoXMLStreamWriter writer, PersistenceContextRef persistenceContextRef, RuntimeContext context) + throws Exception + { _write(writer, persistenceContextRef, context); } - public void write(final XoXMLStreamWriter writer, final PersistenceContextRef persistenceContextRef, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, PersistenceContextRef persistenceContextRef, RuntimeContext context) + throws Exception + { _write(writer, persistenceContextRef, context); } - public final static PersistenceContextRef _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final PersistenceContextRef _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -78,7 +86,7 @@ public final static PersistenceContextRef _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final PersistenceContextRef persistenceContextRef = new PersistenceContextRef(); + PersistenceContextRef persistenceContextRef = new PersistenceContextRef(); context.beforeUnmarshal(persistenceContextRef, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -86,137 +94,137 @@ public final static PersistenceContextRef _read(final XoXMLStreamReader reader, Set injectionTarget = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("persistence-context-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("persistence-context-refType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, PersistenceContextRef.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, persistenceContextRef); persistenceContextRef.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("persistence-context-ref-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-context-ref-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceContextRefName - final String persistenceContextRefNameRaw = elementReader.getElementAsString(); + String persistenceContextRefNameRaw = elementReader.getElementText(); - final String persistenceContextRefName; + String persistenceContextRefName; try { persistenceContextRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(persistenceContextRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } persistenceContextRef.persistenceContextRefName = persistenceContextRefName; - } else if (("persistence-unit-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-unit-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceUnitName - final String persistenceUnitNameRaw = elementReader.getElementAsString(); + String persistenceUnitNameRaw = elementReader.getElementText(); - final String persistenceUnitName; + String persistenceUnitName; try { persistenceUnitName = Adapters.collapsedStringAdapterAdapter.unmarshal(persistenceUnitNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } persistenceContextRef.persistenceUnitName = persistenceUnitName; - } else if (("persistence-context-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-context-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceContextType - final PersistenceContextType persistenceContextType = parsePersistenceContextType(elementReader, context, elementReader.getElementAsString()); - if (persistenceContextType != null) { + PersistenceContextType persistenceContextType = parsePersistenceContextType(elementReader, context, elementReader.getElementText()); + if (persistenceContextType!= null) { persistenceContextRef.persistenceContextType = persistenceContextType; } - } else if (("persistence-context-synchronization" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - // ELEMENT: persistenceContextType - final PersistenceContextSynchronization synchronization = parsePersistenceContextSynchronization(elementReader, context, elementReader.getElementAsString()); - if (synchronization != null) { - persistenceContextRef.persistenceContextSynchronization = synchronization; + } else if (("persistence-context-synchronization" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: persistenceContextSynchronization + PersistenceContextSynchronization persistenceContextSynchronization = parsePersistenceContextSynchronization(elementReader, context, elementReader.getElementText()); + if (persistenceContextSynchronization!= null) { + persistenceContextRef.persistenceContextSynchronization = persistenceContextSynchronization; } - } else if (("persistence-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceProperty - final Property persistencePropertyItem = readProperty(elementReader, context); + Property persistencePropertyItem = readProperty(elementReader, context); if (persistenceProperty == null) { persistenceProperty = persistenceContextRef.persistenceProperty; - if (persistenceProperty != null) { + if (persistenceProperty!= null) { persistenceProperty.clear(); } else { - persistenceProperty = new ArrayList(); + persistenceProperty = new ArrayList<>(); } } persistenceProperty.add(persistencePropertyItem); - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } persistenceContextRef.mappedName = mappedName; - } else if (("injection-target" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("injection-target" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: injectionTarget - final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); + InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); if (injectionTarget == null) { injectionTarget = persistenceContextRef.injectionTarget; - if (injectionTarget != null) { + if (injectionTarget!= null) { injectionTarget.clear(); } else { - injectionTarget = new LinkedHashSet(); + injectionTarget = new LinkedHashSet<>(); } } injectionTarget.add(injectionTargetItem); - } else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lookup-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lookupName - final String lookupNameRaw = elementReader.getElementAsString(); + String lookupNameRaw = elementReader.getElementText(); - final String lookupName; + String lookupName; try { lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } persistenceContextRef.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", "persistence-context-ref-name"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-unit-name"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-context-type"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-property"), 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")); + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-context-ref-name"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-unit-name"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-context-type"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-context-synchronization"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-property"), 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) { + if (descriptions!= null) { try { - persistenceContextRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + persistenceContextRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, PersistenceContextRef.class, "setDescriptions", Text[].class, e); } } - if (persistenceProperty != null) { + if (persistenceProperty!= null) { persistenceContextRef.persistenceProperty = persistenceProperty; } - if (injectionTarget != null) { + if (injectionTarget!= null) { persistenceContextRef.injectionTarget = injectionTarget; } @@ -225,38 +233,40 @@ public final static PersistenceContextRef _read(final XoXMLStreamReader reader, return persistenceContextRef; } - public final PersistenceContextRef read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final PersistenceContextRef read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final PersistenceContextRef persistenceContextRef, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, PersistenceContextRef persistenceContextRef, RuntimeContext context) + throws Exception + { if (persistenceContextRef == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (PersistenceContextRef.class != persistenceContextRef.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (PersistenceContextRef.class!= persistenceContextRef.getClass()) { context.unexpectedSubclass(writer, persistenceContextRef, PersistenceContextRef.class); - return; + return ; } context.beforeMarshal(persistenceContextRef, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = persistenceContextRef.id; - if (idRaw != null) { + String idRaw = persistenceContextRef.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(persistenceContextRef, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -266,12 +276,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Persistenc Text[] descriptions = null; try { descriptions = persistenceContextRef.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(persistenceContextRef, "descriptions", PersistenceContextRef.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -282,14 +292,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Persistenc } // ELEMENT: persistenceContextRefName - final String persistenceContextRefNameRaw = persistenceContextRef.persistenceContextRefName; + String persistenceContextRefNameRaw = persistenceContextRef.persistenceContextRefName; String persistenceContextRefName = null; try { persistenceContextRefName = Adapters.collapsedStringAdapterAdapter.marshal(persistenceContextRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(persistenceContextRef, "persistenceContextRefName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (persistenceContextRefName != null) { + if (persistenceContextRefName!= null) { writer.writeStartElement(prefix, "persistence-context-ref-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(persistenceContextRefName); writer.writeEndElement(); @@ -298,32 +308,40 @@ public final static void _write(final XoXMLStreamWriter writer, final Persistenc } // ELEMENT: persistenceUnitName - final String persistenceUnitNameRaw = persistenceContextRef.persistenceUnitName; + String persistenceUnitNameRaw = persistenceContextRef.persistenceUnitName; String persistenceUnitName = null; try { persistenceUnitName = Adapters.collapsedStringAdapterAdapter.marshal(persistenceUnitNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(persistenceContextRef, "persistenceUnitName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (persistenceUnitName != null) { + if (persistenceUnitName!= null) { writer.writeStartElement(prefix, "persistence-unit-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(persistenceUnitName); writer.writeEndElement(); } // ELEMENT: persistenceContextType - final PersistenceContextType persistenceContextType = persistenceContextRef.persistenceContextType; - if (persistenceContextType != null) { + PersistenceContextType persistenceContextType = persistenceContextRef.persistenceContextType; + if (persistenceContextType!= null) { writer.writeStartElement(prefix, "persistence-context-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringPersistenceContextType(persistenceContextRef, null, context, persistenceContextType)); writer.writeEndElement(); } + // ELEMENT: persistenceContextSynchronization + PersistenceContextSynchronization persistenceContextSynchronization = persistenceContextRef.persistenceContextSynchronization; + if (persistenceContextSynchronization!= null) { + writer.writeStartElement(prefix, "persistence-context-synchronization", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringPersistenceContextSynchronization(persistenceContextRef, null, context, persistenceContextSynchronization)); + writer.writeEndElement(); + } + // ELEMENT: persistenceProperty - final List persistenceProperty = persistenceContextRef.persistenceProperty; - if (persistenceProperty != null) { - for (final Property persistencePropertyItem : persistenceProperty) { - if (persistencePropertyItem != null) { + List persistenceProperty = persistenceContextRef.persistenceProperty; + if (persistenceProperty!= null) { + for (Property persistencePropertyItem: persistenceProperty) { + if (persistencePropertyItem!= null) { writer.writeStartElement(prefix, "persistence-property", "http://java.sun.com/xml/ns/javaee"); writeProperty(writer, persistencePropertyItem, context); writer.writeEndElement(); @@ -334,24 +352,24 @@ public final static void _write(final XoXMLStreamWriter writer, final Persistenc } // ELEMENT: mappedName - final String mappedNameRaw = persistenceContextRef.mappedName; + String mappedNameRaw = persistenceContextRef.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(persistenceContextRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + 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 = persistenceContextRef.injectionTarget; - if (injectionTarget != null) { - for (final InjectionTarget injectionTargetItem : injectionTarget) { - if (injectionTargetItem != null) { + Set injectionTarget = persistenceContextRef.injectionTarget; + if (injectionTarget!= null) { + for (InjectionTarget injectionTargetItem: injectionTarget) { + if (injectionTargetItem!= null) { writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee"); writeInjectionTarget(writer, injectionTargetItem, context); writer.writeEndElement(); @@ -362,14 +380,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Persistenc } // ELEMENT: lookupName - final String lookupNameRaw = persistenceContextRef.lookupName; + String lookupNameRaw = persistenceContextRef.lookupName; String lookupName = null; try { lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(persistenceContextRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lookupName != null) { + if (lookupName!= null) { writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lookupName); writer.writeEndElement(); @@ -378,15 +396,4 @@ public final static void _write(final XoXMLStreamWriter writer, final Persistenc context.afterMarshal(persistenceContextRef, LifecycleCallback.NONE); } - // should be in PersistenceContextSynchronization$JAXB but no need to generate the full sxc bean since we only need it here for now - public static PersistenceContextSynchronization parsePersistenceContextSynchronization(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { - if ("Synchronized".equals(value)) { - return PersistenceContextSynchronization.SYNCHRONIZED; - } else if ("Unsynchronized".equals(value)) { - return PersistenceContextSynchronization.UNSYNCHRONIZED; - } - context.unexpectedEnumValue(reader, PersistenceContextType.class, value, "Synchronized", "Unsynchronized"); - return null; - } } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextSynchronization$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextSynchronization$JAXB.java new file mode 100644 index 00000000000..5240292fa81 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextSynchronization$JAXB.java @@ -0,0 +1,72 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.namespace.QName; +import org.metatype.sxc.jaxb.JAXBEnum; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.XoXMLStreamReader; + +public class PersistenceContextSynchronization$JAXB + extends JAXBEnum +{ + + + public PersistenceContextSynchronization$JAXB() { + super(PersistenceContextSynchronization.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "persistenceContextSynchronization".intern())); + } + + public PersistenceContextSynchronization parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { + return parsePersistenceContextSynchronization(reader, context, value); + } + + public String toString(Object bean, String parameterName, RuntimeContext context, PersistenceContextSynchronization persistenceContextSynchronization) + throws Exception + { + return toStringPersistenceContextSynchronization(bean, parameterName, context, persistenceContextSynchronization); + } + + public static PersistenceContextSynchronization parsePersistenceContextSynchronization(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { + if ("Synchronized".equals(value)) { + return PersistenceContextSynchronization.SYNCHRONIZED; + } else if ("Unsynchronized".equals(value)) { + return PersistenceContextSynchronization.UNSYNCHRONIZED; + } else { + context.unexpectedEnumValue(reader, PersistenceContextSynchronization.class, value, "Synchronized", "Unsynchronized"); + return null; + } + } + + public static String toStringPersistenceContextSynchronization(Object bean, String parameterName, RuntimeContext context, PersistenceContextSynchronization persistenceContextSynchronization) + throws Exception + { + if (PersistenceContextSynchronization.SYNCHRONIZED == persistenceContextSynchronization) { + return "Synchronized"; + } else if (PersistenceContextSynchronization.UNSYNCHRONIZED == persistenceContextSynchronization) { + return "Unsynchronized"; + } else { + context.unexpectedEnumConst(bean, parameterName, persistenceContextSynchronization, PersistenceContextSynchronization.SYNCHRONIZED, PersistenceContextSynchronization.UNSYNCHRONIZED); + return null; + } + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextType$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextType$JAXB.java index 94690315858..86b57ca9adb 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextType$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceContextType$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class PersistenceContextType$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public PersistenceContextType$JAXB() { super(PersistenceContextType.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "persistenceContextType".intern())); } - public PersistenceContextType parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public PersistenceContextType parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parsePersistenceContextType(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final PersistenceContextType persistenceContextType) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, PersistenceContextType persistenceContextType) + throws Exception + { return toStringPersistenceContextType(bean, parameterName, context, persistenceContextType); } - public static PersistenceContextType parsePersistenceContextType(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static PersistenceContextType parsePersistenceContextType(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Transaction".equals(value)) { return PersistenceContextType.TRANSACTION; } else if ("Extended".equals(value)) { @@ -52,8 +56,9 @@ public static PersistenceContextType parsePersistenceContextType(final XoXMLStre } } - public static String toStringPersistenceContextType(final Object bean, final String parameterName, final RuntimeContext context, final PersistenceContextType persistenceContextType) - throws Exception { + public static String toStringPersistenceContextType(Object bean, String parameterName, RuntimeContext context, PersistenceContextType persistenceContextType) + throws Exception + { if (PersistenceContextType.TRANSACTION == persistenceContextType) { return "Transaction"; } else if (PersistenceContextType.EXTENDED == persistenceContextType) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceType$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceType$JAXB.java index a4b00c488b8..7c35cd960d6 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceType$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceType$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class PersistenceType$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public PersistenceType$JAXB() { super(PersistenceType.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "persistenceType".intern())); } - public PersistenceType parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public PersistenceType parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parsePersistenceType(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final PersistenceType persistenceType) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, PersistenceType persistenceType) + throws Exception + { return toStringPersistenceType(bean, parameterName, context, persistenceType); } - public static PersistenceType parsePersistenceType(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static PersistenceType parsePersistenceType(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Bean".equals(value)) { return PersistenceType.BEAN; } else if ("Container".equals(value)) { @@ -52,8 +56,9 @@ public static PersistenceType parsePersistenceType(final XoXMLStreamReader reade } } - public static String toStringPersistenceType(final Object bean, final String parameterName, final RuntimeContext context, final PersistenceType persistenceType) - throws Exception { + public static String toStringPersistenceType(Object bean, String parameterName, RuntimeContext context, PersistenceType persistenceType) + throws Exception + { if (PersistenceType.BEAN == persistenceType) { return "Bean"; } else if (PersistenceType.CONTAINER == persistenceType) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceUnitRef$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceUnitRef$JAXB.java index 58e53cad2e0..619a0030046 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceUnitRef$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PersistenceUnitRef$JAXB.java @@ -1,21 +1,28 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,12 +30,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; import static org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget; import static org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget; @@ -39,30 +40,35 @@ "StringEquality" }) public class PersistenceUnitRef$JAXB - extends JAXBObject { + extends JAXBObject +{ public PersistenceUnitRef$JAXB() { super(PersistenceUnitRef.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "persistence-unit-refType".intern()), Text$JAXB.class, InjectionTarget$JAXB.class); } - public static PersistenceUnitRef readPersistenceUnitRef(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static PersistenceUnitRef readPersistenceUnitRef(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writePersistenceUnitRef(final XoXMLStreamWriter writer, final PersistenceUnitRef persistenceUnitRef, final RuntimeContext context) - throws Exception { + public static void writePersistenceUnitRef(XoXMLStreamWriter writer, PersistenceUnitRef persistenceUnitRef, RuntimeContext context) + throws Exception + { _write(writer, persistenceUnitRef, context); } - public void write(final XoXMLStreamWriter writer, final PersistenceUnitRef persistenceUnitRef, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, PersistenceUnitRef persistenceUnitRef, RuntimeContext context) + throws Exception + { _write(writer, persistenceUnitRef, context); } - public final static PersistenceUnitRef _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final PersistenceUnitRef _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -73,100 +79,100 @@ public final static PersistenceUnitRef _read(final XoXMLStreamReader reader, Run context = new RuntimeContext(); } - final PersistenceUnitRef persistenceUnitRef = new PersistenceUnitRef(); + PersistenceUnitRef persistenceUnitRef = new PersistenceUnitRef(); context.beforeUnmarshal(persistenceUnitRef, LifecycleCallback.NONE); ArrayList descriptions = null; Set injectionTarget = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("persistence-unit-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("persistence-unit-refType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, PersistenceUnitRef.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, persistenceUnitRef); persistenceUnitRef.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("persistence-unit-ref-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-unit-ref-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceUnitRefName - final String persistenceUnitRefNameRaw = elementReader.getElementAsString(); + String persistenceUnitRefNameRaw = elementReader.getElementText(); - final String persistenceUnitRefName; + String persistenceUnitRefName; try { persistenceUnitRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(persistenceUnitRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } persistenceUnitRef.persistenceUnitRefName = persistenceUnitRefName; - } else if (("persistence-unit-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-unit-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceUnitName - final String persistenceUnitNameRaw = elementReader.getElementAsString(); + String persistenceUnitNameRaw = elementReader.getElementText(); - final String persistenceUnitName; + String persistenceUnitName; try { persistenceUnitName = Adapters.collapsedStringAdapterAdapter.unmarshal(persistenceUnitNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } persistenceUnitRef.persistenceUnitName = persistenceUnitName; - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } persistenceUnitRef.mappedName = mappedName; - } else if (("injection-target" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("injection-target" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: injectionTarget - final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); + InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); if (injectionTarget == null) { injectionTarget = persistenceUnitRef.injectionTarget; - if (injectionTarget != null) { + if (injectionTarget!= null) { injectionTarget.clear(); } else { - injectionTarget = new LinkedHashSet(); + injectionTarget = new LinkedHashSet<>(); } } injectionTarget.add(injectionTargetItem); - } else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lookup-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lookupName - final String lookupNameRaw = elementReader.getElementAsString(); + String lookupNameRaw = elementReader.getElementText(); - final String lookupName; + String lookupName; try { lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -176,14 +182,14 @@ public final static PersistenceUnitRef _read(final XoXMLStreamReader reader, Run context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-unit-ref-name"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-unit-name"), 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) { + if (descriptions!= null) { try { - persistenceUnitRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + persistenceUnitRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, PersistenceUnitRef.class, "setDescriptions", Text[].class, e); } } - if (injectionTarget != null) { + if (injectionTarget!= null) { persistenceUnitRef.injectionTarget = injectionTarget; } @@ -192,38 +198,40 @@ public final static PersistenceUnitRef _read(final XoXMLStreamReader reader, Run return persistenceUnitRef; } - public final PersistenceUnitRef read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final PersistenceUnitRef read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final PersistenceUnitRef persistenceUnitRef, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, PersistenceUnitRef persistenceUnitRef, RuntimeContext context) + throws Exception + { if (persistenceUnitRef == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (PersistenceUnitRef.class != persistenceUnitRef.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (PersistenceUnitRef.class!= persistenceUnitRef.getClass()) { context.unexpectedSubclass(writer, persistenceUnitRef, PersistenceUnitRef.class); - return; + return ; } context.beforeMarshal(persistenceUnitRef, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = persistenceUnitRef.id; - if (idRaw != null) { + String idRaw = persistenceUnitRef.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(persistenceUnitRef, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -233,12 +241,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Persistenc Text[] descriptions = null; try { descriptions = persistenceUnitRef.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(persistenceUnitRef, "descriptions", PersistenceUnitRef.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -249,14 +257,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Persistenc } // ELEMENT: persistenceUnitRefName - final String persistenceUnitRefNameRaw = persistenceUnitRef.persistenceUnitRefName; + String persistenceUnitRefNameRaw = persistenceUnitRef.persistenceUnitRefName; String persistenceUnitRefName = null; try { persistenceUnitRefName = Adapters.collapsedStringAdapterAdapter.marshal(persistenceUnitRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(persistenceUnitRef, "persistenceUnitRefName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (persistenceUnitRefName != null) { + if (persistenceUnitRefName!= null) { writer.writeStartElement(prefix, "persistence-unit-ref-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(persistenceUnitRefName); writer.writeEndElement(); @@ -265,38 +273,38 @@ public final static void _write(final XoXMLStreamWriter writer, final Persistenc } // ELEMENT: persistenceUnitName - final String persistenceUnitNameRaw = persistenceUnitRef.persistenceUnitName; + String persistenceUnitNameRaw = persistenceUnitRef.persistenceUnitName; String persistenceUnitName = null; try { persistenceUnitName = Adapters.collapsedStringAdapterAdapter.marshal(persistenceUnitNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(persistenceUnitRef, "persistenceUnitName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (persistenceUnitName != null) { + if (persistenceUnitName!= null) { writer.writeStartElement(prefix, "persistence-unit-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(persistenceUnitName); writer.writeEndElement(); } // ELEMENT: mappedName - final String mappedNameRaw = persistenceUnitRef.mappedName; + String mappedNameRaw = persistenceUnitRef.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(persistenceUnitRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + 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 = persistenceUnitRef.injectionTarget; - if (injectionTarget != null) { - for (final InjectionTarget injectionTargetItem : injectionTarget) { - if (injectionTargetItem != null) { + Set injectionTarget = persistenceUnitRef.injectionTarget; + if (injectionTarget!= null) { + for (InjectionTarget injectionTargetItem: injectionTarget) { + if (injectionTargetItem!= null) { writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee"); writeInjectionTarget(writer, injectionTargetItem, context); writer.writeEndElement(); @@ -307,14 +315,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Persistenc } // ELEMENT: lookupName - final String lookupNameRaw = persistenceUnitRef.lookupName; + String lookupNameRaw = persistenceUnitRef.lookupName; String lookupName = null; try { lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(persistenceUnitRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lookupName != null) { + if (lookupName!= null) { writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lookupName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortComponent$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortComponent$JAXB.java index e3e8a816488..a11c73f4267 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortComponent$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortComponent$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Addressing$JAXB.readAddressing; import static org.apache.openejb.jee.Addressing$JAXB.writeAddressing; @@ -46,30 +47,35 @@ "StringEquality" }) public class PortComponent$JAXB - extends JAXBObject { + extends JAXBObject +{ public PortComponent$JAXB() { super(PortComponent.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "port-componentType".intern()), Icon$JAXB.class, Addressing$JAXB.class, RespectBinding$JAXB.class, ServiceImplBean$JAXB.class, Handler$JAXB.class, HandlerChains$JAXB.class); } - public static PortComponent readPortComponent(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static PortComponent readPortComponent(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writePortComponent(final XoXMLStreamWriter writer, final PortComponent portComponent, final RuntimeContext context) - throws Exception { + public static void writePortComponent(XoXMLStreamWriter writer, PortComponent portComponent, RuntimeContext context) + throws Exception + { _write(writer, portComponent, context); } - public void write(final XoXMLStreamWriter writer, final PortComponent portComponent, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, PortComponent portComponent, RuntimeContext context) + throws Exception + { _write(writer, portComponent, context); } - public final static PortComponent _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final PortComponent _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -80,151 +86,151 @@ public final static PortComponent _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final PortComponent portComponent = new PortComponent(); + PortComponent portComponent = new PortComponent(); context.beforeUnmarshal(portComponent, LifecycleCallback.NONE); List handler = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("port-componentType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("port-componentType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, PortComponent.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, portComponent); portComponent.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: description - final String descriptionRaw = elementReader.getElementAsString(); + String descriptionRaw = elementReader.getElementText(); - final String description; + String description; try { description = Adapters.collapsedStringAdapterAdapter.unmarshal(descriptionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } portComponent.description = description; - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayName - final String displayNameRaw = elementReader.getElementAsString(); + String displayNameRaw = elementReader.getElementText(); - final String displayName; + String displayName; try { displayName = Adapters.collapsedStringAdapterAdapter.unmarshal(displayNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } portComponent.displayName = displayName; - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon icon = readIcon(elementReader, context); + Icon icon = readIcon(elementReader, context); portComponent.icon = icon; - } else if (("port-component-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("port-component-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: portComponentName - final String portComponentNameRaw = elementReader.getElementAsString(); + String portComponentNameRaw = elementReader.getElementText(); - final String portComponentName; + String portComponentName; try { portComponentName = Adapters.collapsedStringAdapterAdapter.unmarshal(portComponentNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } portComponent.portComponentName = portComponentName; - } else if (("wsdl-service" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlService - final QName wsdlService = elementReader.getElementAsQName(); + QName wsdlService = elementReader.getElementAsQName(); portComponent.wsdlService = wsdlService; - } else if (("wsdl-port" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-port" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlPort - final QName wsdlPort = elementReader.getElementAsQName(); + QName wsdlPort = elementReader.getElementAsQName(); portComponent.wsdlPort = wsdlPort; - } else if (("enable-mtom" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("enable-mtom" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: enableMtom - final Boolean enableMtom = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean enableMtom = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); portComponent.enableMtom = enableMtom; - } else if (("mtom-threshold" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mtom-threshold" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mtomThreshold - final Integer mtomThreshold = Integer.valueOf(elementReader.getElementAsString()); + Integer mtomThreshold = Integer.valueOf(elementReader.getElementText()); portComponent.mtomThreshold = mtomThreshold; - } else if (("addressing" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("addressing" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: addressing - final Addressing addressing = readAddressing(elementReader, context); + Addressing addressing = readAddressing(elementReader, context); portComponent.addressing = addressing; - } else if (("respect-binding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("respect-binding" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: respectBinding - final RespectBinding respectBinding = readRespectBinding(elementReader, context); + RespectBinding respectBinding = readRespectBinding(elementReader, context); portComponent.respectBinding = respectBinding; - } else if (("protocol-binding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("protocol-binding" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: protocolBinding - final String protocolBindingRaw = elementReader.getElementAsString(); + String protocolBindingRaw = elementReader.getElementText(); - final String protocolBinding; + String protocolBinding; try { protocolBinding = Adapters.collapsedStringAdapterAdapter.unmarshal(protocolBindingRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } portComponent.protocolBinding = protocolBinding; - } else if (("service-endpoint-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-endpoint-interface" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceEndpointInterface - final String serviceEndpointInterfaceRaw = elementReader.getElementAsString(); + String serviceEndpointInterfaceRaw = elementReader.getElementText(); - final String serviceEndpointInterface; + String serviceEndpointInterface; try { serviceEndpointInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceEndpointInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } portComponent.serviceEndpointInterface = serviceEndpointInterface; - } else if (("service-impl-bean" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-impl-bean" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceImplBean - final ServiceImplBean serviceImplBean = readServiceImplBean(elementReader, context); + ServiceImplBean serviceImplBean = readServiceImplBean(elementReader, context); portComponent.serviceImplBean = serviceImplBean; - } else if (("handler" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("handler" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: handler - final Handler handlerItem = readHandler(elementReader, context); + Handler handlerItem = readHandler(elementReader, context); if (handler == null) { handler = portComponent.handler; - if (handler != null) { + if (handler!= null) { handler.clear(); } else { - handler = new ArrayList(); + handler = new ArrayList<>(); } } handler.add(handlerItem); - } else if (("handler-chains" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("handler-chains" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: handlerChains - final HandlerChains handlerChains = readHandlerChains(elementReader, context); + HandlerChains handlerChains = readHandlerChains(elementReader, context); portComponent.handlerChains = handlerChains; } 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", "port-component-name"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-service"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-port"), new QName("http://java.sun.com/xml/ns/javaee", "enable-mtom"), new QName("http://java.sun.com/xml/ns/javaee", "mtom-threshold"), new QName("http://java.sun.com/xml/ns/javaee", "addressing"), new QName("http://java.sun.com/xml/ns/javaee", "respect-binding"), new QName("http://java.sun.com/xml/ns/javaee", "protocol-binding"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint-interface"), new QName("http://java.sun.com/xml/ns/javaee", "service-impl-bean"), new QName("http://java.sun.com/xml/ns/javaee", "handler"), new QName("http://java.sun.com/xml/ns/javaee", "handler-chains")); } } - if (handler != null) { + if (handler!= null) { portComponent.handler = handler; } @@ -233,88 +239,90 @@ public final static PortComponent _read(final XoXMLStreamReader reader, RuntimeC return portComponent; } - public final PortComponent read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final PortComponent read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final PortComponent portComponent, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, PortComponent portComponent, RuntimeContext context) + throws Exception + { if (portComponent == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (PortComponent.class != portComponent.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (PortComponent.class!= portComponent.getClass()) { context.unexpectedSubclass(writer, portComponent, PortComponent.class); - return; + return ; } context.beforeMarshal(portComponent, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = portComponent.id; - if (idRaw != null) { + String idRaw = portComponent.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portComponent, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: description - final String descriptionRaw = portComponent.description; + String descriptionRaw = portComponent.description; String description = null; try { description = Adapters.collapsedStringAdapterAdapter.marshal(descriptionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portComponent, "description", CollapsedStringAdapter.class, String.class, String.class, e); } - if (description != null) { + if (description!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(description); writer.writeEndElement(); } // ELEMENT: displayName - final String displayNameRaw = portComponent.displayName; + String displayNameRaw = portComponent.displayName; String displayName = null; try { displayName = Adapters.collapsedStringAdapterAdapter.marshal(displayNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portComponent, "displayName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (displayName != null) { + if (displayName!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(displayName); writer.writeEndElement(); } // ELEMENT: icon - final Icon icon = portComponent.icon; - if (icon != null) { + Icon icon = portComponent.icon; + if (icon!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, icon, context); writer.writeEndElement(); } // ELEMENT: portComponentName - final String portComponentNameRaw = portComponent.portComponentName; + String portComponentNameRaw = portComponent.portComponentName; String portComponentName = null; try { portComponentName = Adapters.collapsedStringAdapterAdapter.marshal(portComponentNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portComponent, "portComponentName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (portComponentName != null) { + if (portComponentName!= null) { writer.writeStartElement(prefix, "port-component-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(portComponentName); writer.writeEndElement(); @@ -323,84 +331,84 @@ public final static void _write(final XoXMLStreamWriter writer, final PortCompon } // ELEMENT: wsdlService - final QName wsdlService = portComponent.wsdlService; - if (wsdlService != null) { + QName wsdlService = portComponent.wsdlService; + if (wsdlService!= null) { writer.writeStartElement(prefix, "wsdl-service", "http://java.sun.com/xml/ns/javaee"); writer.writeQName(wsdlService); writer.writeEndElement(); } // ELEMENT: wsdlPort - final QName wsdlPort = portComponent.wsdlPort; - if (wsdlPort != null) { + QName wsdlPort = portComponent.wsdlPort; + if (wsdlPort!= null) { writer.writeStartElement(prefix, "wsdl-port", "http://java.sun.com/xml/ns/javaee"); writer.writeQName(wsdlPort); writer.writeEndElement(); } // ELEMENT: enableMtom - final Boolean enableMtom = portComponent.enableMtom; - if (enableMtom != null) { + Boolean enableMtom = portComponent.enableMtom; + if (enableMtom!= null) { writer.writeStartElement(prefix, "enable-mtom", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(enableMtom)); writer.writeEndElement(); } // ELEMENT: mtomThreshold - final Integer mtomThreshold = portComponent.mtomThreshold; - if (mtomThreshold != null) { + Integer mtomThreshold = portComponent.mtomThreshold; + if (mtomThreshold!= null) { writer.writeStartElement(prefix, "mtom-threshold", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(mtomThreshold)); writer.writeEndElement(); } // ELEMENT: addressing - final Addressing addressing = portComponent.addressing; - if (addressing != null) { + Addressing addressing = portComponent.addressing; + if (addressing!= null) { writer.writeStartElement(prefix, "addressing", "http://java.sun.com/xml/ns/javaee"); writeAddressing(writer, addressing, context); writer.writeEndElement(); } // ELEMENT: respectBinding - final RespectBinding respectBinding = portComponent.respectBinding; - if (respectBinding != null) { + RespectBinding respectBinding = portComponent.respectBinding; + if (respectBinding!= null) { writer.writeStartElement(prefix, "respect-binding", "http://java.sun.com/xml/ns/javaee"); writeRespectBinding(writer, respectBinding, context); writer.writeEndElement(); } // ELEMENT: protocolBinding - final String protocolBindingRaw = portComponent.protocolBinding; + String protocolBindingRaw = portComponent.protocolBinding; String protocolBinding = null; try { protocolBinding = Adapters.collapsedStringAdapterAdapter.marshal(protocolBindingRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portComponent, "protocolBinding", CollapsedStringAdapter.class, String.class, String.class, e); } - if (protocolBinding != null) { + if (protocolBinding!= null) { writer.writeStartElement(prefix, "protocol-binding", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(protocolBinding); writer.writeEndElement(); } // ELEMENT: serviceEndpointInterface - final String serviceEndpointInterfaceRaw = portComponent.serviceEndpointInterface; + String serviceEndpointInterfaceRaw = portComponent.serviceEndpointInterface; String serviceEndpointInterface = null; try { serviceEndpointInterface = Adapters.collapsedStringAdapterAdapter.marshal(serviceEndpointInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portComponent, "serviceEndpointInterface", CollapsedStringAdapter.class, String.class, String.class, e); } - if (serviceEndpointInterface != null) { + if (serviceEndpointInterface!= null) { writer.writeStartElement(prefix, "service-endpoint-interface", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(serviceEndpointInterface); writer.writeEndElement(); } // ELEMENT: serviceImplBean - final ServiceImplBean serviceImplBean = portComponent.serviceImplBean; - if (serviceImplBean != null) { + ServiceImplBean serviceImplBean = portComponent.serviceImplBean; + if (serviceImplBean!= null) { writer.writeStartElement(prefix, "service-impl-bean", "http://java.sun.com/xml/ns/javaee"); writeServiceImplBean(writer, serviceImplBean, context); writer.writeEndElement(); @@ -409,11 +417,11 @@ public final static void _write(final XoXMLStreamWriter writer, final PortCompon } // ELEMENT: handler - final List handler = portComponent.handler; - if (handler != null) { - for (final Handler handlerItem : handler) { + List handler = portComponent.handler; + if (handler!= null) { + for (Handler handlerItem: handler) { writer.writeStartElement(prefix, "handler", "http://java.sun.com/xml/ns/javaee"); - if (handlerItem != null) { + if (handlerItem!= null) { writeHandler(writer, handlerItem, context); } else { writer.writeXsiNil(); @@ -423,8 +431,8 @@ public final static void _write(final XoXMLStreamWriter writer, final PortCompon } // ELEMENT: handlerChains - final HandlerChains handlerChains = portComponent.handlerChains; - if (handlerChains != null) { + HandlerChains handlerChains = portComponent.handlerChains; + if (handlerChains!= null) { writer.writeStartElement(prefix, "handler-chains", "http://java.sun.com/xml/ns/javaee"); writeHandlerChains(writer, handlerChains, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortComponentRef$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortComponentRef$JAXB.java index 2abe37ae4da..5e79bee98d7 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortComponentRef$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortComponentRef$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.Addressing$JAXB.readAddressing; import static org.apache.openejb.jee.Addressing$JAXB.writeAddressing; @@ -36,30 +37,35 @@ "StringEquality" }) public class PortComponentRef$JAXB - extends JAXBObject { + extends JAXBObject +{ public PortComponentRef$JAXB() { super(PortComponentRef.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "port-component-refType".intern()), Addressing$JAXB.class, RespectBinding$JAXB.class); } - public static PortComponentRef readPortComponentRef(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static PortComponentRef readPortComponentRef(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writePortComponentRef(final XoXMLStreamWriter writer, final PortComponentRef portComponentRef, final RuntimeContext context) - throws Exception { + public static void writePortComponentRef(XoXMLStreamWriter writer, PortComponentRef portComponentRef, RuntimeContext context) + throws Exception + { _write(writer, portComponentRef, context); } - public void write(final XoXMLStreamWriter writer, final PortComponentRef portComponentRef, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, PortComponentRef portComponentRef, RuntimeContext context) + throws Exception + { _write(writer, portComponentRef, context); } - public final static PortComponentRef _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final PortComponentRef _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,69 +76,69 @@ public final static PortComponentRef _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final PortComponentRef portComponentRef = new PortComponentRef(); + PortComponentRef portComponentRef = new PortComponentRef(); context.beforeUnmarshal(portComponentRef, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("port-component-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("port-component-refType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, PortComponentRef.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, portComponentRef); portComponentRef.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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(); + String serviceEndpointInterfaceRaw = elementReader.getElementText(); - final String serviceEndpointInterface; + String serviceEndpointInterface; try { serviceEndpointInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceEndpointInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } portComponentRef.serviceEndpointInterface = serviceEndpointInterface; - } else if (("enable-mtom" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("enable-mtom" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: enableMtom - final Boolean enableMtom = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean enableMtom = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); portComponentRef.enableMtom = enableMtom; - } else if (("mtom-threshold" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mtom-threshold" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mtomThreshold - final Integer mtomThreshold = Integer.valueOf(elementReader.getElementAsString()); + Integer mtomThreshold = Integer.valueOf(elementReader.getElementText()); portComponentRef.mtomThreshold = mtomThreshold; - } else if (("addressing" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("addressing" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: addressing - final Addressing addressing = readAddressing(elementReader, context); + Addressing addressing = readAddressing(elementReader, context); portComponentRef.addressing = addressing; - } else if (("respect-binding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("respect-binding" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: respectBinding - final RespectBinding respectBinding = readRespectBinding(elementReader, context); + RespectBinding respectBinding = readRespectBinding(elementReader, context); portComponentRef.respectBinding = respectBinding; - } else if (("port-component-link" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("port-component-link" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: portComponentLink - final String portComponentLinkRaw = elementReader.getElementAsString(); + String portComponentLinkRaw = elementReader.getElementText(); - final String portComponentLink; + String portComponentLink; try { portComponentLink = Adapters.collapsedStringAdapterAdapter.unmarshal(portComponentLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -148,52 +154,54 @@ public final static PortComponentRef _read(final XoXMLStreamReader reader, Runti return portComponentRef; } - public final PortComponentRef read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final PortComponentRef read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final PortComponentRef portComponentRef, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, PortComponentRef portComponentRef, RuntimeContext context) + throws Exception + { if (portComponentRef == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (PortComponentRef.class != portComponentRef.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (PortComponentRef.class!= portComponentRef.getClass()) { context.unexpectedSubclass(writer, portComponentRef, PortComponentRef.class); - return; + return ; } context.beforeMarshal(portComponentRef, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = portComponentRef.id; - if (idRaw != null) { + String idRaw = portComponentRef.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portComponentRef, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: serviceEndpointInterface - final String serviceEndpointInterfaceRaw = portComponentRef.serviceEndpointInterface; + String serviceEndpointInterfaceRaw = portComponentRef.serviceEndpointInterface; String serviceEndpointInterface = null; try { serviceEndpointInterface = Adapters.collapsedStringAdapterAdapter.marshal(serviceEndpointInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portComponentRef, "serviceEndpointInterface", CollapsedStringAdapter.class, String.class, String.class, e); } - if (serviceEndpointInterface != null) { + if (serviceEndpointInterface!= null) { writer.writeStartElement(prefix, "service-endpoint-interface", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(serviceEndpointInterface); writer.writeEndElement(); @@ -202,46 +210,46 @@ public final static void _write(final XoXMLStreamWriter writer, final PortCompon } // ELEMENT: enableMtom - final Boolean enableMtom = portComponentRef.enableMtom; - if (enableMtom != null) { + Boolean enableMtom = portComponentRef.enableMtom; + if (enableMtom!= null) { writer.writeStartElement(prefix, "enable-mtom", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(enableMtom)); writer.writeEndElement(); } // ELEMENT: mtomThreshold - final Integer mtomThreshold = portComponentRef.mtomThreshold; - if (mtomThreshold != null) { + Integer mtomThreshold = portComponentRef.mtomThreshold; + if (mtomThreshold!= null) { writer.writeStartElement(prefix, "mtom-threshold", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(mtomThreshold)); writer.writeEndElement(); } // ELEMENT: addressing - final Addressing addressing = portComponentRef.addressing; - if (addressing != null) { + Addressing addressing = portComponentRef.addressing; + if (addressing!= null) { writer.writeStartElement(prefix, "addressing", "http://java.sun.com/xml/ns/javaee"); writeAddressing(writer, addressing, context); writer.writeEndElement(); } // ELEMENT: respectBinding - final RespectBinding respectBinding = portComponentRef.respectBinding; - if (respectBinding != null) { + RespectBinding respectBinding = portComponentRef.respectBinding; + if (respectBinding!= null) { writer.writeStartElement(prefix, "respect-binding", "http://java.sun.com/xml/ns/javaee"); writeRespectBinding(writer, respectBinding, context); writer.writeEndElement(); } // ELEMENT: portComponentLink - final String portComponentLinkRaw = portComponentRef.portComponentLink; + String portComponentLinkRaw = portComponentRef.portComponentLink; String portComponentLink = null; try { portComponentLink = Adapters.collapsedStringAdapterAdapter.marshal(portComponentLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portComponentRef, "portComponentLink", CollapsedStringAdapter.class, String.class, String.class, e); } - if (portComponentLink != null) { + if (portComponentLink!= null) { writer.writeStartElement(prefix, "port-component-link", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(portComponentLink); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortMapping$JAXB.java index 1bc76029b43..0866a9eac63 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/PortMapping$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class PortMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public PortMapping$JAXB() { super(PortMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "port-mappingType".intern())); } - public static PortMapping readPortMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static PortMapping readPortMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writePortMapping(final XoXMLStreamWriter writer, final PortMapping portMapping, final RuntimeContext context) - throws Exception { + public static void writePortMapping(XoXMLStreamWriter writer, PortMapping portMapping, RuntimeContext context) + throws Exception + { _write(writer, portMapping, context); } - public void write(final XoXMLStreamWriter writer, final PortMapping portMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, PortMapping portMapping, RuntimeContext context) + throws Exception + { _write(writer, portMapping, context); } - public final static PortMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final PortMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,53 +70,53 @@ public final static PortMapping _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final PortMapping portMapping = new PortMapping(); + PortMapping portMapping = new PortMapping(); context.beforeUnmarshal(portMapping, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("port-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("port-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, PortMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, portMapping); portMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("port-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("port-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: portName - final String portNameRaw = elementReader.getElementAsString(); + String portNameRaw = elementReader.getElementText(); - final String portName; + String portName; try { portName = Adapters.collapsedStringAdapterAdapter.unmarshal(portNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } portMapping.portName = portName; - } else if (("java-port-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("java-port-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: javaPortName - final String javaPortNameRaw = elementReader.getElementAsString(); + String javaPortNameRaw = elementReader.getElementText(); - final String javaPortName; + String javaPortName; try { javaPortName = Adapters.collapsedStringAdapterAdapter.unmarshal(javaPortNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -127,52 +132,54 @@ public final static PortMapping _read(final XoXMLStreamReader reader, RuntimeCon return portMapping; } - public final PortMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final PortMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final PortMapping portMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, PortMapping portMapping, RuntimeContext context) + throws Exception + { if (portMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (PortMapping.class != portMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (PortMapping.class!= portMapping.getClass()) { context.unexpectedSubclass(writer, portMapping, PortMapping.class); - return; + return ; } context.beforeMarshal(portMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = portMapping.id; - if (idRaw != null) { + String idRaw = portMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: portName - final String portNameRaw = portMapping.portName; + String portNameRaw = portMapping.portName; String portName = null; try { portName = Adapters.collapsedStringAdapterAdapter.marshal(portNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portMapping, "portName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (portName != null) { + if (portName!= null) { writer.writeStartElement(prefix, "port-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(portName); writer.writeEndElement(); @@ -181,14 +188,14 @@ public final static void _write(final XoXMLStreamWriter writer, final PortMappin } // ELEMENT: javaPortName - final String javaPortNameRaw = portMapping.javaPortName; + String javaPortNameRaw = portMapping.javaPortName; String javaPortName = null; try { javaPortName = Adapters.collapsedStringAdapterAdapter.marshal(javaPortNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(portMapping, "javaPortName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (javaPortName != null) { + if (javaPortName!= null) { writer.writeStartElement(prefix, "java-port-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(javaPortName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Property$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Property$JAXB.java index b4006104470..b5750849af3 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Property$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Property$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class Property$JAXB - extends JAXBObject { + extends JAXBObject +{ public Property$JAXB() { super(Property.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "propertyType".intern())); } - public static Property readProperty(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Property readProperty(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeProperty(final XoXMLStreamWriter writer, final Property property, final RuntimeContext context) - throws Exception { + public static void writeProperty(XoXMLStreamWriter writer, Property property, RuntimeContext context) + throws Exception + { _write(writer, property, context); } - public void write(final XoXMLStreamWriter writer, final Property property, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Property property, RuntimeContext context) + throws Exception + { _write(writer, property, context); } - public final static Property _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Property _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,53 +70,53 @@ public final static Property _read(final XoXMLStreamReader reader, RuntimeContex context = new RuntimeContext(); } - final Property property = new Property(); + Property property = new Property(); context.beforeUnmarshal(property, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("propertyType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Property.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, property); property.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + String nameRaw = elementReader.getElementText(); - final String name; + String name; try { name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } property.name = name; - } else if (("value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: value - final String valueRaw = elementReader.getElementAsString(); + String valueRaw = elementReader.getElementText(); - final String value; + String value; try { value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -127,52 +132,54 @@ public final static Property _read(final XoXMLStreamReader reader, RuntimeContex return property; } - public final Property read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Property read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Property property, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Property property, RuntimeContext context) + throws Exception + { if (property == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Property.class != property.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Property.class!= property.getClass()) { context.unexpectedSubclass(writer, property, Property.class); - return; + return ; } context.beforeMarshal(property, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = property.id; - if (idRaw != null) { + String idRaw = property.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(property, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: name - final String nameRaw = property.name; + String nameRaw = property.name; String name = null; try { name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(property, "name", CollapsedStringAdapter.class, String.class, String.class, e); } - if (name != null) { + if (name!= null) { writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(name); writer.writeEndElement(); @@ -181,14 +188,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Property p } // ELEMENT: value - final String valueRaw = property.value; + String valueRaw = property.value; String value = null; try { value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(property, "value", CollapsedStringAdapter.class, String.class, String.class, e); } - if (value != null) { + if (value!= null) { writer.writeStartElement(prefix, "value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(value); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Query$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Query$JAXB.java index 7c1373fa266..306775a01ac 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Query$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Query$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.QueryMethod$JAXB.readQueryMethod; import static org.apache.openejb.jee.QueryMethod$JAXB.writeQueryMethod; @@ -38,30 +39,35 @@ "StringEquality" }) public class Query$JAXB - extends JAXBObject { + extends JAXBObject +{ public Query$JAXB() { super(Query.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "queryType".intern()), Text$JAXB.class, QueryMethod$JAXB.class, ResultTypeMapping$JAXB.class); } - public static Query readQuery(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Query readQuery(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeQuery(final XoXMLStreamWriter writer, final Query query, final RuntimeContext context) - throws Exception { + public static void writeQuery(XoXMLStreamWriter writer, Query query, RuntimeContext context) + throws Exception + { _write(writer, query, context); } - public void write(final XoXMLStreamWriter writer, final Query query, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Query query, RuntimeContext context) + throws Exception + { _write(writer, query, context); } - public final static Query _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Query _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,54 +78,54 @@ public final static Query _read(final XoXMLStreamReader reader, RuntimeContext c context = new RuntimeContext(); } - final Query query = new Query(); + Query query = new Query(); context.beforeUnmarshal(query, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("queryType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("queryType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Query.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, query); query.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: description - final Text description = readText(elementReader, context); + Text description = readText(elementReader, context); query.description = description; - } else if (("query-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("query-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: queryMethod - final QueryMethod queryMethod = readQueryMethod(elementReader, context); + QueryMethod queryMethod = readQueryMethod(elementReader, context); query.queryMethod = queryMethod; - } else if (("result-type-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("result-type-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resultTypeMapping - final ResultTypeMapping resultTypeMapping = parseResultTypeMapping(elementReader, context, elementReader.getElementAsString()); - if (resultTypeMapping != null) { + ResultTypeMapping resultTypeMapping = parseResultTypeMapping(elementReader, context, elementReader.getElementText()); + if (resultTypeMapping!= null) { query.resultTypeMapping = resultTypeMapping; } - } else if (("ejb-ql" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-ql" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbQl - final String ejbQlRaw = elementReader.getElementAsString(); + String ejbQlRaw = elementReader.getElementText(); - final String ejbQl; + String ejbQl; try { ejbQl = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbQlRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -135,54 +141,56 @@ public final static Query _read(final XoXMLStreamReader reader, RuntimeContext c return query; } - public final Query read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Query read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Query query, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Query query, RuntimeContext context) + throws Exception + { if (query == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Query.class != query.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Query.class!= query.getClass()) { context.unexpectedSubclass(writer, query, Query.class); - return; + return ; } context.beforeMarshal(query, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = query.id; - if (idRaw != null) { + String idRaw = query.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(query, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: description - final Text description = query.description; - if (description != null) { + Text description = query.description; + if (description!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, description, context); writer.writeEndElement(); } // ELEMENT: queryMethod - final QueryMethod queryMethod = query.queryMethod; - if (queryMethod != null) { + QueryMethod queryMethod = query.queryMethod; + if (queryMethod!= null) { writer.writeStartElement(prefix, "query-method", "http://java.sun.com/xml/ns/javaee"); writeQueryMethod(writer, queryMethod, context); writer.writeEndElement(); @@ -191,22 +199,22 @@ public final static void _write(final XoXMLStreamWriter writer, final Query quer } // ELEMENT: resultTypeMapping - final ResultTypeMapping resultTypeMapping = query.resultTypeMapping; - if (resultTypeMapping != null) { + ResultTypeMapping resultTypeMapping = query.resultTypeMapping; + if (resultTypeMapping!= null) { writer.writeStartElement(prefix, "result-type-mapping", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringResultTypeMapping(query, null, context, resultTypeMapping)); writer.writeEndElement(); } // ELEMENT: ejbQl - final String ejbQlRaw = query.ejbQl; + String ejbQlRaw = query.ejbQl; String ejbQl = null; try { ejbQl = Adapters.collapsedStringAdapterAdapter.marshal(ejbQlRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(query, "ejbQl", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbQl != null) { + if (ejbQl!= null) { writer.writeStartElement(prefix, "ejb-ql", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbQl); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/QueryMethod$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/QueryMethod$JAXB.java index eb14b4f60c5..1b6ed4ce58a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/QueryMethod$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/QueryMethod$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.MethodParams$JAXB.readMethodParams; import static org.apache.openejb.jee.MethodParams$JAXB.writeMethodParams; @@ -34,30 +35,35 @@ "StringEquality" }) public class QueryMethod$JAXB - extends JAXBObject { + extends JAXBObject +{ public QueryMethod$JAXB() { super(QueryMethod.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "query-methodType".intern()), MethodParams$JAXB.class); } - public static QueryMethod readQueryMethod(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static QueryMethod readQueryMethod(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeQueryMethod(final XoXMLStreamWriter writer, final QueryMethod queryMethod, final RuntimeContext context) - throws Exception { + public static void writeQueryMethod(XoXMLStreamWriter writer, QueryMethod queryMethod, RuntimeContext context) + throws Exception + { _write(writer, queryMethod, context); } - public void write(final XoXMLStreamWriter writer, final QueryMethod queryMethod, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, QueryMethod queryMethod, RuntimeContext context) + throws Exception + { _write(writer, queryMethod, context); } - public final static QueryMethod _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final QueryMethod _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -68,48 +74,48 @@ public final static QueryMethod _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final QueryMethod queryMethod = new QueryMethod(); + QueryMethod queryMethod = new QueryMethod(); context.beforeUnmarshal(queryMethod, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("query-methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("query-methodType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, QueryMethod.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, queryMethod); queryMethod.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("method-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("method-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodName - final String methodNameRaw = elementReader.getElementAsString(); + String methodNameRaw = elementReader.getElementText(); - final String methodName; + String methodName; try { methodName = Adapters.collapsedStringAdapterAdapter.unmarshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } queryMethod.methodName = methodName; - } else if (("method-params" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("method-params" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodParams - final MethodParams methodParams = readMethodParams(elementReader, context); + MethodParams methodParams = readMethodParams(elementReader, context); queryMethod.methodParams = methodParams; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "method-name"), new QName("http://java.sun.com/xml/ns/javaee", "method-params")); @@ -121,52 +127,54 @@ public final static QueryMethod _read(final XoXMLStreamReader reader, RuntimeCon return queryMethod; } - public final QueryMethod read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final QueryMethod read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final QueryMethod queryMethod, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, QueryMethod queryMethod, RuntimeContext context) + throws Exception + { if (queryMethod == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (QueryMethod.class != queryMethod.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (QueryMethod.class!= queryMethod.getClass()) { context.unexpectedSubclass(writer, queryMethod, QueryMethod.class); - return; + return ; } context.beforeMarshal(queryMethod, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = queryMethod.id; - if (idRaw != null) { + String idRaw = queryMethod.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(queryMethod, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: methodName - final String methodNameRaw = queryMethod.methodName; + String methodNameRaw = queryMethod.methodName; String methodName = null; try { methodName = Adapters.collapsedStringAdapterAdapter.marshal(methodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(queryMethod, "methodName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (methodName != null) { + if (methodName!= null) { writer.writeStartElement(prefix, "method-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(methodName); writer.writeEndElement(); @@ -175,8 +183,8 @@ public final static void _write(final XoXMLStreamWriter writer, final QueryMetho } // ELEMENT: methodParams - final MethodParams methodParams = queryMethod.methodParams; - if (methodParams != null) { + MethodParams methodParams = queryMethod.methodParams; + if (methodParams!= null) { writer.writeStartElement(prefix, "method-params", "http://java.sun.com/xml/ns/javaee"); writeMethodParams(writer, methodParams, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RelationshipRoleSource$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RelationshipRoleSource$JAXB.java index 1cd134f4e01..4ccdf9e4713 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RelationshipRoleSource$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RelationshipRoleSource$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class RelationshipRoleSource$JAXB - extends JAXBObject { + extends JAXBObject +{ public RelationshipRoleSource$JAXB() { super(RelationshipRoleSource.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "relationship-role-sourceType".intern()), Text$JAXB.class); } - public static RelationshipRoleSource readRelationshipRoleSource(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static RelationshipRoleSource readRelationshipRoleSource(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeRelationshipRoleSource(final XoXMLStreamWriter writer, final RelationshipRoleSource relationshipRoleSource, final RuntimeContext context) - throws Exception { + public static void writeRelationshipRoleSource(XoXMLStreamWriter writer, RelationshipRoleSource relationshipRoleSource, RuntimeContext context) + throws Exception + { _write(writer, relationshipRoleSource, context); } - public void write(final XoXMLStreamWriter writer, final RelationshipRoleSource relationshipRoleSource, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, RelationshipRoleSource relationshipRoleSource, RuntimeContext context) + throws Exception + { _write(writer, relationshipRoleSource, context); } - public final static RelationshipRoleSource _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final RelationshipRoleSource _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,48 +75,48 @@ public final static RelationshipRoleSource _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final RelationshipRoleSource relationshipRoleSource = new RelationshipRoleSource(); + RelationshipRoleSource relationshipRoleSource = new RelationshipRoleSource(); context.beforeUnmarshal(relationshipRoleSource, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("relationship-role-sourceType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("relationship-role-sourceType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, RelationshipRoleSource.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, relationshipRoleSource); relationshipRoleSource.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbName - final String ejbNameRaw = elementReader.getElementAsString(); + String ejbNameRaw = elementReader.getElementText(); - final String ejbName; + String ejbName; try { ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -120,10 +126,10 @@ public final static RelationshipRoleSource _read(final XoXMLStreamReader reader, context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-name")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - relationshipRoleSource.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + relationshipRoleSource.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, RelationshipRoleSource.class, "setDescriptions", Text[].class, e); } } @@ -133,38 +139,40 @@ public final static RelationshipRoleSource _read(final XoXMLStreamReader reader, return relationshipRoleSource; } - public final RelationshipRoleSource read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final RelationshipRoleSource read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final RelationshipRoleSource relationshipRoleSource, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, RelationshipRoleSource relationshipRoleSource, RuntimeContext context) + throws Exception + { if (relationshipRoleSource == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (RelationshipRoleSource.class != relationshipRoleSource.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (RelationshipRoleSource.class!= relationshipRoleSource.getClass()) { context.unexpectedSubclass(writer, relationshipRoleSource, RelationshipRoleSource.class); - return; + return ; } context.beforeMarshal(relationshipRoleSource, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = relationshipRoleSource.id; - if (idRaw != null) { + String idRaw = relationshipRoleSource.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(relationshipRoleSource, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -174,12 +182,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Relationsh Text[] descriptions = null; try { descriptions = relationshipRoleSource.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(relationshipRoleSource, "descriptions", RelationshipRoleSource.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -190,14 +198,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Relationsh } // ELEMENT: ejbName - final String ejbNameRaw = relationshipRoleSource.ejbName; + String ejbNameRaw = relationshipRoleSource.ejbName; String ejbName = null; try { ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(relationshipRoleSource, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbName != null) { + if (ejbName!= null) { writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Relationships$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Relationships$JAXB.java index 979e267d295..14989fe04b3 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Relationships$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Relationships$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.EjbRelation$JAXB.readEjbRelation; import static org.apache.openejb.jee.EjbRelation$JAXB.writeEjbRelation; @@ -38,30 +39,35 @@ "StringEquality" }) public class Relationships$JAXB - extends JAXBObject { + extends JAXBObject +{ public Relationships$JAXB() { super(Relationships.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "relationshipsType".intern()), Text$JAXB.class, EjbRelation$JAXB.class); } - public static Relationships readRelationships(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Relationships readRelationships(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeRelationships(final XoXMLStreamWriter writer, final Relationships relationships, final RuntimeContext context) - throws Exception { + public static void writeRelationships(XoXMLStreamWriter writer, Relationships relationships, RuntimeContext context) + throws Exception + { _write(writer, relationships, context); } - public void write(final XoXMLStreamWriter writer, final Relationships relationships, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Relationships relationships, RuntimeContext context) + throws Exception + { _write(writer, relationships, context); } - public final static Relationships _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Relationships _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,50 +78,50 @@ public final static Relationships _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final Relationships relationships = new Relationships(); + Relationships relationships = new Relationships(); context.beforeUnmarshal(relationships, LifecycleCallback.NONE); ArrayList descriptions = null; List ejbRelation = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("relationshipsType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("relationshipsType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Relationships.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, relationships); relationships.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("ejb-relation" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-relation" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRelation - final EjbRelation ejbRelationItem = readEjbRelation(elementReader, context); + EjbRelation ejbRelationItem = readEjbRelation(elementReader, context); if (ejbRelation == null) { ejbRelation = relationships.ejbRelation; - if (ejbRelation != null) { + if (ejbRelation!= null) { ejbRelation.clear(); } else { - ejbRelation = new ArrayList(); + ejbRelation = new ArrayList<>(); } } ejbRelation.add(ejbRelationItem); @@ -123,14 +129,14 @@ public final static Relationships _read(final XoXMLStreamReader reader, RuntimeC context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-relation")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - relationships.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + relationships.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Relationships.class, "setDescriptions", Text[].class, e); } } - if (ejbRelation != null) { + if (ejbRelation!= null) { relationships.ejbRelation = ejbRelation; } @@ -139,38 +145,40 @@ public final static Relationships _read(final XoXMLStreamReader reader, RuntimeC return relationships; } - public final Relationships read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Relationships read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Relationships relationships, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Relationships relationships, RuntimeContext context) + throws Exception + { if (relationships == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Relationships.class != relationships.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Relationships.class!= relationships.getClass()) { context.unexpectedSubclass(writer, relationships, Relationships.class); - return; + return ; } context.beforeMarshal(relationships, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = relationships.id; - if (idRaw != null) { + String idRaw = relationships.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(relationships, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -180,12 +188,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Relationsh Text[] descriptions = null; try { descriptions = relationships.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(relationships, "descriptions", Relationships.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -196,10 +204,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Relationsh } // ELEMENT: ejbRelation - final List ejbRelation = relationships.ejbRelation; - if (ejbRelation != null) { - for (final EjbRelation ejbRelationItem : ejbRelation) { - if (ejbRelationItem != null) { + List ejbRelation = relationships.ejbRelation; + if (ejbRelation!= null) { + for (EjbRelation ejbRelationItem: ejbRelation) { + if (ejbRelationItem!= null) { writer.writeStartElement(prefix, "ejb-relation", "http://java.sun.com/xml/ns/javaee"); writeEjbRelation(writer, ejbRelationItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RemoveMethod$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RemoveMethod$JAXB.java index d87119999a6..6addfe85f3e 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RemoveMethod$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RemoveMethod$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.NamedMethod$JAXB.readNamedMethod; import static org.apache.openejb.jee.NamedMethod$JAXB.writeNamedMethod; @@ -34,30 +35,35 @@ "StringEquality" }) public class RemoveMethod$JAXB - extends JAXBObject { + extends JAXBObject +{ public RemoveMethod$JAXB() { super(RemoveMethod.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "remove-methodType".intern()), NamedMethod$JAXB.class); } - public static RemoveMethod readRemoveMethod(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static RemoveMethod readRemoveMethod(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeRemoveMethod(final XoXMLStreamWriter writer, final RemoveMethod removeMethod, final RuntimeContext context) - throws Exception { + public static void writeRemoveMethod(XoXMLStreamWriter writer, RemoveMethod removeMethod, RuntimeContext context) + throws Exception + { _write(writer, removeMethod, context); } - public void write(final XoXMLStreamWriter writer, final RemoveMethod removeMethod, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, RemoveMethod removeMethod, RuntimeContext context) + throws Exception + { _write(writer, removeMethod, context); } - public final static RemoveMethod _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final RemoveMethod _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -68,39 +74,39 @@ public final static RemoveMethod _read(final XoXMLStreamReader reader, RuntimeCo context = new RuntimeContext(); } - final RemoveMethod removeMethod = new RemoveMethod(); + RemoveMethod removeMethod = new RemoveMethod(); context.beforeUnmarshal(removeMethod, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("remove-methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("remove-methodType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, RemoveMethod.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, removeMethod); removeMethod.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("bean-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("bean-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: beanMethod - final NamedMethod beanMethod = readNamedMethod(elementReader, context); + NamedMethod beanMethod = readNamedMethod(elementReader, context); removeMethod.beanMethod = beanMethod; - } else if (("retain-if-exception" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("retain-if-exception" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: retainIfException - final Boolean retainIfException = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean retainIfException = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); removeMethod.retainIfException = retainIfException; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "bean-method"), new QName("http://java.sun.com/xml/ns/javaee", "retain-if-exception")); @@ -112,46 +118,48 @@ public final static RemoveMethod _read(final XoXMLStreamReader reader, RuntimeCo return removeMethod; } - public final RemoveMethod read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final RemoveMethod read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final RemoveMethod removeMethod, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, RemoveMethod removeMethod, RuntimeContext context) + throws Exception + { if (removeMethod == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (RemoveMethod.class != removeMethod.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (RemoveMethod.class!= removeMethod.getClass()) { context.unexpectedSubclass(writer, removeMethod, RemoveMethod.class); - return; + return ; } context.beforeMarshal(removeMethod, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = removeMethod.id; - if (idRaw != null) { + String idRaw = removeMethod.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(removeMethod, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: beanMethod - final NamedMethod beanMethod = removeMethod.beanMethod; - if (beanMethod != null) { + NamedMethod beanMethod = removeMethod.beanMethod; + if (beanMethod!= null) { writer.writeStartElement(prefix, "bean-method", "http://java.sun.com/xml/ns/javaee"); writeNamedMethod(writer, beanMethod, context); writer.writeEndElement(); @@ -160,8 +168,8 @@ public final static void _write(final XoXMLStreamWriter writer, final RemoveMeth } // ELEMENT: retainIfException - final Boolean retainIfException = removeMethod.retainIfException; - if (retainIfException != null) { + Boolean retainIfException = removeMethod.retainIfException; + if (retainIfException!= null) { writer.writeStartElement(prefix, "retain-if-exception", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(retainIfException)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RequiredConfigProperty$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RequiredConfigProperty$JAXB.java index 8f66fe7a08e..dcc43dd2d97 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RequiredConfigProperty$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RequiredConfigProperty$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class RequiredConfigProperty$JAXB - extends JAXBObject { + extends JAXBObject +{ public RequiredConfigProperty$JAXB() { super(RequiredConfigProperty.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "required-config-propertyType".intern()), Text$JAXB.class); } - public static RequiredConfigProperty readRequiredConfigProperty(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static RequiredConfigProperty readRequiredConfigProperty(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeRequiredConfigProperty(final XoXMLStreamWriter writer, final RequiredConfigProperty requiredConfigProperty, final RuntimeContext context) - throws Exception { + public static void writeRequiredConfigProperty(XoXMLStreamWriter writer, RequiredConfigProperty requiredConfigProperty, RuntimeContext context) + throws Exception + { _write(writer, requiredConfigProperty, context); } - public void write(final XoXMLStreamWriter writer, final RequiredConfigProperty requiredConfigProperty, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, RequiredConfigProperty requiredConfigProperty, RuntimeContext context) + throws Exception + { _write(writer, requiredConfigProperty, context); } - public final static RequiredConfigProperty _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final RequiredConfigProperty _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,48 +75,48 @@ public final static RequiredConfigProperty _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final RequiredConfigProperty requiredConfigProperty = new RequiredConfigProperty(); + RequiredConfigProperty requiredConfigProperty = new RequiredConfigProperty(); context.beforeUnmarshal(requiredConfigProperty, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("required-config-propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("required-config-propertyType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, RequiredConfigProperty.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, requiredConfigProperty); requiredConfigProperty.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("config-property-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("config-property-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: configPropertyName - final String configPropertyNameRaw = elementReader.getElementAsString(); + String configPropertyNameRaw = elementReader.getElementText(); - final String configPropertyName; + String configPropertyName; try { configPropertyName = Adapters.collapsedStringAdapterAdapter.unmarshal(configPropertyNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -120,10 +126,10 @@ public final static RequiredConfigProperty _read(final XoXMLStreamReader reader, context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-name")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - requiredConfigProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + requiredConfigProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, RequiredConfigProperty.class, "setDescriptions", Text[].class, e); } } @@ -133,38 +139,40 @@ public final static RequiredConfigProperty _read(final XoXMLStreamReader reader, return requiredConfigProperty; } - public final RequiredConfigProperty read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final RequiredConfigProperty read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final RequiredConfigProperty requiredConfigProperty, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, RequiredConfigProperty requiredConfigProperty, RuntimeContext context) + throws Exception + { if (requiredConfigProperty == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (RequiredConfigProperty.class != requiredConfigProperty.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (RequiredConfigProperty.class!= requiredConfigProperty.getClass()) { context.unexpectedSubclass(writer, requiredConfigProperty, RequiredConfigProperty.class); - return; + return ; } context.beforeMarshal(requiredConfigProperty, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = requiredConfigProperty.id; - if (idRaw != null) { + String idRaw = requiredConfigProperty.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(requiredConfigProperty, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -174,12 +182,12 @@ public final static void _write(final XoXMLStreamWriter writer, final RequiredCo Text[] descriptions = null; try { descriptions = requiredConfigProperty.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(requiredConfigProperty, "descriptions", RequiredConfigProperty.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -190,14 +198,14 @@ public final static void _write(final XoXMLStreamWriter writer, final RequiredCo } // ELEMENT: configPropertyName - final String configPropertyNameRaw = requiredConfigProperty.configPropertyName; + String configPropertyNameRaw = requiredConfigProperty.configPropertyName; String configPropertyName = null; try { configPropertyName = Adapters.collapsedStringAdapterAdapter.marshal(configPropertyNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(requiredConfigProperty, "configPropertyName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (configPropertyName != null) { + if (configPropertyName!= null) { writer.writeStartElement(prefix, "config-property-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(configPropertyName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResAuth$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResAuth$JAXB.java index b959b63334c..ed143a4fd16 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResAuth$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResAuth$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class ResAuth$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public ResAuth$JAXB() { super(ResAuth.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "resAuth".intern())); } - public ResAuth parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public ResAuth parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseResAuth(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final ResAuth resAuth) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, ResAuth resAuth) + throws Exception + { return toStringResAuth(bean, parameterName, context, resAuth); } - public static ResAuth parseResAuth(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static ResAuth parseResAuth(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Application".equals(value)) { return ResAuth.APPLICATION; } else if ("Container".equals(value)) { @@ -52,8 +56,9 @@ public static ResAuth parseResAuth(final XoXMLStreamReader reader, final Runtime } } - public static String toStringResAuth(final Object bean, final String parameterName, final RuntimeContext context, final ResAuth resAuth) - throws Exception { + public static String toStringResAuth(Object bean, String parameterName, RuntimeContext context, ResAuth resAuth) + throws Exception + { if (ResAuth.APPLICATION == resAuth) { return "Application"; } else if (ResAuth.CONTAINER == resAuth) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResSharingScope$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResSharingScope$JAXB.java index 5e2477051cc..a21ec614c2a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResSharingScope$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResSharingScope$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class ResSharingScope$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public ResSharingScope$JAXB() { super(ResSharingScope.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "resSharingScope".intern())); } - public ResSharingScope parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public ResSharingScope parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseResSharingScope(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final ResSharingScope resSharingScope) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, ResSharingScope resSharingScope) + throws Exception + { return toStringResSharingScope(bean, parameterName, context, resSharingScope); } - public static ResSharingScope parseResSharingScope(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static ResSharingScope parseResSharingScope(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Shareable".equals(value)) { return ResSharingScope.SHAREABLE; } else if ("Unshareable".equals(value)) { @@ -52,8 +56,9 @@ public static ResSharingScope parseResSharingScope(final XoXMLStreamReader reade } } - public static String toStringResSharingScope(final Object bean, final String parameterName, final RuntimeContext context, final ResSharingScope resSharingScope) - throws Exception { + public static String toStringResSharingScope(Object bean, String parameterName, RuntimeContext context, ResSharingScope resSharingScope) + throws Exception + { if (ResSharingScope.SHAREABLE == resSharingScope) { return "Shareable"; } else if (ResSharingScope.UNSHAREABLE == resSharingScope) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceAdapter$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceAdapter$JAXB.java index f3abac0a9b0..a1abe129a1d 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceAdapter$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceAdapter$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.AdminObject$JAXB.readAdminObject; import static org.apache.openejb.jee.AdminObject$JAXB.writeAdminObject; @@ -44,30 +45,35 @@ "StringEquality" }) public class ResourceAdapter$JAXB - extends JAXBObject { + extends JAXBObject +{ public ResourceAdapter$JAXB() { super(ResourceAdapter.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "resourceadapterType".intern()), ConfigProperty$JAXB.class, OutboundResourceAdapter$JAXB.class, InboundResourceadapter$JAXB.class, AdminObject$JAXB.class, SecurityPermission$JAXB.class); } - public static ResourceAdapter readResourceAdapter(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ResourceAdapter readResourceAdapter(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeResourceAdapter(final XoXMLStreamWriter writer, final ResourceAdapter resourceAdapter, final RuntimeContext context) - throws Exception { + public static void writeResourceAdapter(XoXMLStreamWriter writer, ResourceAdapter resourceAdapter, RuntimeContext context) + throws Exception + { _write(writer, resourceAdapter, context); } - public void write(final XoXMLStreamWriter writer, final ResourceAdapter resourceAdapter, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ResourceAdapter resourceAdapter, RuntimeContext context) + throws Exception + { _write(writer, resourceAdapter, context); } - public final static ResourceAdapter _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ResourceAdapter _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -78,7 +84,7 @@ public final static ResourceAdapter _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final ResourceAdapter resourceAdapter = new ResourceAdapter(); + ResourceAdapter resourceAdapter = new ResourceAdapter(); context.beforeUnmarshal(resourceAdapter, LifecycleCallback.NONE); List configProperty = null; @@ -86,81 +92,81 @@ public final static ResourceAdapter _read(final XoXMLStreamReader reader, Runtim List securityPermission = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("resourceadapterType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("resourceadapterType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ResourceAdapter.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, resourceAdapter); resourceAdapter.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("resourceadapter-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("resourceadapter-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceAdapterClass - final String resourceAdapterClassRaw = elementReader.getElementAsString(); + String resourceAdapterClassRaw = elementReader.getElementText(); - final String resourceAdapterClass; + String resourceAdapterClass; try { resourceAdapterClass = Adapters.collapsedStringAdapterAdapter.unmarshal(resourceAdapterClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } resourceAdapter.resourceAdapterClass = resourceAdapterClass; - } else if (("config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("config-property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: configProperty - final ConfigProperty configPropertyItem = readConfigProperty(elementReader, context); + ConfigProperty configPropertyItem = readConfigProperty(elementReader, context); if (configProperty == null) { configProperty = resourceAdapter.configProperty; - if (configProperty != null) { + if (configProperty!= null) { configProperty.clear(); } else { - configProperty = new ArrayList(); + configProperty = new ArrayList<>(); } } configProperty.add(configPropertyItem); - } else if (("outbound-resourceadapter" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("outbound-resourceadapter" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: outboundResourceAdapter - final OutboundResourceAdapter outboundResourceAdapter = readOutboundResourceAdapter(elementReader, context); + OutboundResourceAdapter outboundResourceAdapter = readOutboundResourceAdapter(elementReader, context); resourceAdapter.outboundResourceAdapter = outboundResourceAdapter; - } else if (("inbound-resourceadapter" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("inbound-resourceadapter" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: inboundResourceAdapter - final InboundResourceadapter inboundResourceAdapter = readInboundResourceadapter(elementReader, context); + InboundResourceadapter inboundResourceAdapter = readInboundResourceadapter(elementReader, context); resourceAdapter.inboundResourceAdapter = inboundResourceAdapter; - } else if (("adminobject" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("adminobject" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: adminObject - final AdminObject adminObjectItem = readAdminObject(elementReader, context); + AdminObject adminObjectItem = readAdminObject(elementReader, context); if (adminObject == null) { adminObject = resourceAdapter.adminObject; - if (adminObject != null) { + if (adminObject!= null) { adminObject.clear(); } else { - adminObject = new ArrayList(); + adminObject = new ArrayList<>(); } } adminObject.add(adminObjectItem); - } else if (("security-permission" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("security-permission" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityPermission - final SecurityPermission securityPermissionItem = readSecurityPermission(elementReader, context); + SecurityPermission securityPermissionItem = readSecurityPermission(elementReader, context); if (securityPermission == null) { securityPermission = resourceAdapter.securityPermission; - if (securityPermission != null) { + if (securityPermission!= null) { securityPermission.clear(); } else { - securityPermission = new ArrayList(); + securityPermission = new ArrayList<>(); } } securityPermission.add(securityPermissionItem); @@ -168,13 +174,13 @@ public final static ResourceAdapter _read(final XoXMLStreamReader reader, Runtim context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "resourceadapter-class"), new QName("http://java.sun.com/xml/ns/javaee", "config-property"), new QName("http://java.sun.com/xml/ns/javaee", "outbound-resourceadapter"), new QName("http://java.sun.com/xml/ns/javaee", "inbound-resourceadapter"), new QName("http://java.sun.com/xml/ns/javaee", "adminobject"), new QName("http://java.sun.com/xml/ns/javaee", "security-permission")); } } - if (configProperty != null) { + if (configProperty!= null) { resourceAdapter.configProperty = configProperty; } - if (adminObject != null) { + if (adminObject!= null) { resourceAdapter.adminObject = adminObject; } - if (securityPermission != null) { + if (securityPermission!= null) { resourceAdapter.securityPermission = securityPermission; } @@ -183,62 +189,64 @@ public final static ResourceAdapter _read(final XoXMLStreamReader reader, Runtim return resourceAdapter; } - public final ResourceAdapter read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ResourceAdapter read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ResourceAdapter resourceAdapter, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ResourceAdapter resourceAdapter, RuntimeContext context) + throws Exception + { if (resourceAdapter == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ResourceAdapter.class != resourceAdapter.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ResourceAdapter.class!= resourceAdapter.getClass()) { context.unexpectedSubclass(writer, resourceAdapter, ResourceAdapter.class); - return; + return ; } context.beforeMarshal(resourceAdapter, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = resourceAdapter.id; - if (idRaw != null) { + String idRaw = resourceAdapter.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceAdapter, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: resourceAdapterClass - final String resourceAdapterClassRaw = resourceAdapter.resourceAdapterClass; + String resourceAdapterClassRaw = resourceAdapter.resourceAdapterClass; String resourceAdapterClass = null; try { resourceAdapterClass = Adapters.collapsedStringAdapterAdapter.marshal(resourceAdapterClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceAdapter, "resourceAdapterClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (resourceAdapterClass != null) { + if (resourceAdapterClass!= null) { writer.writeStartElement(prefix, "resourceadapter-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(resourceAdapterClass); writer.writeEndElement(); } // ELEMENT: configProperty - final List configProperty = resourceAdapter.configProperty; - if (configProperty != null) { - for (final ConfigProperty configPropertyItem : configProperty) { - if (configPropertyItem != null) { + List configProperty = resourceAdapter.configProperty; + if (configProperty!= null) { + for (ConfigProperty configPropertyItem: configProperty) { + if (configPropertyItem!= null) { writer.writeStartElement(prefix, "config-property", "http://java.sun.com/xml/ns/javaee"); writeConfigProperty(writer, configPropertyItem, context); writer.writeEndElement(); @@ -247,26 +255,26 @@ public final static void _write(final XoXMLStreamWriter writer, final ResourceAd } // ELEMENT: outboundResourceAdapter - final OutboundResourceAdapter outboundResourceAdapter = resourceAdapter.outboundResourceAdapter; - if (outboundResourceAdapter != null) { + OutboundResourceAdapter outboundResourceAdapter = resourceAdapter.outboundResourceAdapter; + if (outboundResourceAdapter!= null) { writer.writeStartElement(prefix, "outbound-resourceadapter", "http://java.sun.com/xml/ns/javaee"); writeOutboundResourceAdapter(writer, outboundResourceAdapter, context); writer.writeEndElement(); } // ELEMENT: inboundResourceAdapter - final InboundResourceadapter inboundResourceAdapter = resourceAdapter.inboundResourceAdapter; - if (inboundResourceAdapter != null) { + InboundResourceadapter inboundResourceAdapter = resourceAdapter.inboundResourceAdapter; + if (inboundResourceAdapter!= null) { writer.writeStartElement(prefix, "inbound-resourceadapter", "http://java.sun.com/xml/ns/javaee"); writeInboundResourceadapter(writer, inboundResourceAdapter, context); writer.writeEndElement(); } // ELEMENT: adminObject - final List adminObject = resourceAdapter.adminObject; - if (adminObject != null) { - for (final AdminObject adminObjectItem : adminObject) { - if (adminObjectItem != null) { + List adminObject = resourceAdapter.adminObject; + if (adminObject!= null) { + for (AdminObject adminObjectItem: adminObject) { + if (adminObjectItem!= null) { writer.writeStartElement(prefix, "adminobject", "http://java.sun.com/xml/ns/javaee"); writeAdminObject(writer, adminObjectItem, context); writer.writeEndElement(); @@ -275,10 +283,10 @@ public final static void _write(final XoXMLStreamWriter writer, final ResourceAd } // ELEMENT: securityPermission - final List securityPermission = resourceAdapter.securityPermission; - if (securityPermission != null) { - for (final SecurityPermission securityPermissionItem : securityPermission) { - if (securityPermissionItem != null) { + List securityPermission = resourceAdapter.securityPermission; + if (securityPermission!= null) { + for (SecurityPermission securityPermissionItem: securityPermission) { + if (securityPermissionItem!= null) { writer.writeStartElement(prefix, "security-permission", "http://java.sun.com/xml/ns/javaee"); writeSecurityPermission(writer, securityPermissionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceEnvRef$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceEnvRef$JAXB.java index 00e5f8514bf..7530d5399bb 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceEnvRef$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceEnvRef$JAXB.java @@ -1,21 +1,28 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,12 +30,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; import static org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget; import static org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget; @@ -39,30 +40,35 @@ "StringEquality" }) public class ResourceEnvRef$JAXB - extends JAXBObject { + extends JAXBObject +{ public ResourceEnvRef$JAXB() { super(ResourceEnvRef.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "resource-env-refType".intern()), Text$JAXB.class, InjectionTarget$JAXB.class); } - public static ResourceEnvRef readResourceEnvRef(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ResourceEnvRef readResourceEnvRef(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeResourceEnvRef(final XoXMLStreamWriter writer, final ResourceEnvRef resourceEnvRef, final RuntimeContext context) - throws Exception { + public static void writeResourceEnvRef(XoXMLStreamWriter writer, ResourceEnvRef resourceEnvRef, RuntimeContext context) + throws Exception + { _write(writer, resourceEnvRef, context); } - public void write(final XoXMLStreamWriter writer, final ResourceEnvRef resourceEnvRef, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ResourceEnvRef resourceEnvRef, RuntimeContext context) + throws Exception + { _write(writer, resourceEnvRef, context); } - public final static ResourceEnvRef _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ResourceEnvRef _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -73,100 +79,100 @@ public final static ResourceEnvRef _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final ResourceEnvRef resourceEnvRef = new ResourceEnvRef(); + ResourceEnvRef resourceEnvRef = new ResourceEnvRef(); context.beforeUnmarshal(resourceEnvRef, LifecycleCallback.NONE); ArrayList descriptions = null; Set injectionTarget = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("resource-env-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("resource-env-refType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ResourceEnvRef.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, resourceEnvRef); resourceEnvRef.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("resource-env-ref-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-env-ref-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceEnvRefName - final String resourceEnvRefNameRaw = elementReader.getElementAsString(); + String resourceEnvRefNameRaw = elementReader.getElementText(); - final String resourceEnvRefName; + String resourceEnvRefName; try { resourceEnvRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(resourceEnvRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } resourceEnvRef.resourceEnvRefName = resourceEnvRefName; - } else if (("resource-env-ref-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-env-ref-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceEnvRefType - final String resourceEnvRefTypeRaw = elementReader.getElementAsString(); + String resourceEnvRefTypeRaw = elementReader.getElementText(); - final String resourceEnvRefType; + String resourceEnvRefType; try { resourceEnvRefType = Adapters.collapsedStringAdapterAdapter.unmarshal(resourceEnvRefTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } resourceEnvRef.resourceEnvRefType = resourceEnvRefType; - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } resourceEnvRef.mappedName = mappedName; - } else if (("injection-target" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("injection-target" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: injectionTarget - final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); + InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); if (injectionTarget == null) { injectionTarget = resourceEnvRef.injectionTarget; - if (injectionTarget != null) { + if (injectionTarget!= null) { injectionTarget.clear(); } else { - injectionTarget = new LinkedHashSet(); + injectionTarget = new LinkedHashSet<>(); } } injectionTarget.add(injectionTargetItem); - } else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lookup-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lookupName - final String lookupNameRaw = elementReader.getElementAsString(); + String lookupNameRaw = elementReader.getElementText(); - final String lookupName; + String lookupName; try { lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -176,14 +182,14 @@ public final static ResourceEnvRef _read(final XoXMLStreamReader reader, Runtime context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "resource-env-ref-name"), new QName("http://java.sun.com/xml/ns/javaee", "resource-env-ref-type"), 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) { + if (descriptions!= null) { try { - resourceEnvRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + resourceEnvRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, ResourceEnvRef.class, "setDescriptions", Text[].class, e); } } - if (injectionTarget != null) { + if (injectionTarget!= null) { resourceEnvRef.injectionTarget = injectionTarget; } @@ -192,38 +198,40 @@ public final static ResourceEnvRef _read(final XoXMLStreamReader reader, Runtime return resourceEnvRef; } - public final ResourceEnvRef read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ResourceEnvRef read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ResourceEnvRef resourceEnvRef, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ResourceEnvRef resourceEnvRef, RuntimeContext context) + throws Exception + { if (resourceEnvRef == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ResourceEnvRef.class != resourceEnvRef.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ResourceEnvRef.class!= resourceEnvRef.getClass()) { context.unexpectedSubclass(writer, resourceEnvRef, ResourceEnvRef.class); - return; + return ; } context.beforeMarshal(resourceEnvRef, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = resourceEnvRef.id; - if (idRaw != null) { + String idRaw = resourceEnvRef.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceEnvRef, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -233,12 +241,12 @@ public final static void _write(final XoXMLStreamWriter writer, final ResourceEn Text[] descriptions = null; try { descriptions = resourceEnvRef.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(resourceEnvRef, "descriptions", ResourceEnvRef.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -249,14 +257,14 @@ public final static void _write(final XoXMLStreamWriter writer, final ResourceEn } // ELEMENT: resourceEnvRefName - final String resourceEnvRefNameRaw = resourceEnvRef.resourceEnvRefName; + String resourceEnvRefNameRaw = resourceEnvRef.resourceEnvRefName; String resourceEnvRefName = null; try { resourceEnvRefName = Adapters.collapsedStringAdapterAdapter.marshal(resourceEnvRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceEnvRef, "resourceEnvRefName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (resourceEnvRefName != null) { + if (resourceEnvRefName!= null) { writer.writeStartElement(prefix, "resource-env-ref-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(resourceEnvRefName); writer.writeEndElement(); @@ -265,38 +273,38 @@ public final static void _write(final XoXMLStreamWriter writer, final ResourceEn } // ELEMENT: resourceEnvRefType - final String resourceEnvRefTypeRaw = resourceEnvRef.resourceEnvRefType; + String resourceEnvRefTypeRaw = resourceEnvRef.resourceEnvRefType; String resourceEnvRefType = null; try { resourceEnvRefType = Adapters.collapsedStringAdapterAdapter.marshal(resourceEnvRefTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceEnvRef, "resourceEnvRefType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (resourceEnvRefType != null) { + 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 mappedNameRaw = resourceEnvRef.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceEnvRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + 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 = resourceEnvRef.injectionTarget; - if (injectionTarget != null) { - for (final InjectionTarget injectionTargetItem : injectionTarget) { - if (injectionTargetItem != null) { + Set injectionTarget = resourceEnvRef.injectionTarget; + if (injectionTarget!= null) { + for (InjectionTarget injectionTargetItem: injectionTarget) { + if (injectionTargetItem!= null) { writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee"); writeInjectionTarget(writer, injectionTargetItem, context); writer.writeEndElement(); @@ -307,14 +315,14 @@ public final static void _write(final XoXMLStreamWriter writer, final ResourceEn } // ELEMENT: lookupName - final String lookupNameRaw = resourceEnvRef.lookupName; + String lookupNameRaw = resourceEnvRef.lookupName; String lookupName = null; try { lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceEnvRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lookupName != null) { + if (lookupName!= null) { writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lookupName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceRef$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceRef$JAXB.java index 1ffab6bea94..0b3e5b1f329 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceRef$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResourceRef$JAXB.java @@ -1,21 +1,28 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,12 +30,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.Set; import static org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget; import static org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget; @@ -43,30 +44,35 @@ "StringEquality" }) public class ResourceRef$JAXB - extends JAXBObject { + extends JAXBObject +{ public ResourceRef$JAXB() { super(ResourceRef.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "resource-refType".intern()), Text$JAXB.class, ResAuth$JAXB.class, ResSharingScope$JAXB.class, InjectionTarget$JAXB.class); } - public static ResourceRef readResourceRef(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ResourceRef readResourceRef(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeResourceRef(final XoXMLStreamWriter writer, final ResourceRef resourceRef, final RuntimeContext context) - throws Exception { + public static void writeResourceRef(XoXMLStreamWriter writer, ResourceRef resourceRef, RuntimeContext context) + throws Exception + { _write(writer, resourceRef, context); } - public void write(final XoXMLStreamWriter writer, final ResourceRef resourceRef, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ResourceRef resourceRef, RuntimeContext context) + throws Exception + { _write(writer, resourceRef, context); } - public final static ResourceRef _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ResourceRef _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -77,112 +83,112 @@ public final static ResourceRef _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final ResourceRef resourceRef = new ResourceRef(); + ResourceRef resourceRef = new ResourceRef(); context.beforeUnmarshal(resourceRef, LifecycleCallback.NONE); ArrayList descriptions = null; Set injectionTarget = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("resource-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("resource-refType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ResourceRef.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, resourceRef); resourceRef.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("res-ref-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("res-ref-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resRefName - final String resRefNameRaw = elementReader.getElementAsString(); + String resRefNameRaw = elementReader.getElementText(); - final String resRefName; + String resRefName; try { resRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(resRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } resourceRef.resRefName = resRefName; - } else if (("res-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("res-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resType - final String resTypeRaw = elementReader.getElementAsString(); + String resTypeRaw = elementReader.getElementText(); - final String resType; + String resType; try { resType = Adapters.collapsedStringAdapterAdapter.unmarshal(resTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } resourceRef.resType = resType; - } else if (("res-auth" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("res-auth" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resAuth - final ResAuth resAuth = parseResAuth(elementReader, context, elementReader.getElementAsString()); - if (resAuth != null) { + ResAuth resAuth = parseResAuth(elementReader, context, elementReader.getElementText()); + if (resAuth!= null) { resourceRef.resAuth = resAuth; } - } else if (("res-sharing-scope" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("res-sharing-scope" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resSharingScope - final ResSharingScope resSharingScope = parseResSharingScope(elementReader, context, elementReader.getElementAsString()); - if (resSharingScope != null) { + ResSharingScope resSharingScope = parseResSharingScope(elementReader, context, elementReader.getElementText()); + if (resSharingScope!= null) { resourceRef.resSharingScope = resSharingScope; } - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } resourceRef.mappedName = mappedName; - } else if (("injection-target" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("injection-target" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: injectionTarget - final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); + InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); if (injectionTarget == null) { injectionTarget = resourceRef.injectionTarget; - if (injectionTarget != null) { + if (injectionTarget!= null) { injectionTarget.clear(); } else { - injectionTarget = new LinkedHashSet(); + injectionTarget = new LinkedHashSet<>(); } } injectionTarget.add(injectionTargetItem); - } else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lookup-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lookupName - final String lookupNameRaw = elementReader.getElementAsString(); + String lookupNameRaw = elementReader.getElementText(); - final String lookupName; + String lookupName; try { lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -192,14 +198,14 @@ public final static ResourceRef _read(final XoXMLStreamReader reader, RuntimeCon context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "res-ref-name"), new QName("http://java.sun.com/xml/ns/javaee", "res-type"), new QName("http://java.sun.com/xml/ns/javaee", "res-auth"), new QName("http://java.sun.com/xml/ns/javaee", "res-sharing-scope"), 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) { + if (descriptions!= null) { try { - resourceRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + resourceRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, ResourceRef.class, "setDescriptions", Text[].class, e); } } - if (injectionTarget != null) { + if (injectionTarget!= null) { resourceRef.injectionTarget = injectionTarget; } @@ -208,38 +214,40 @@ public final static ResourceRef _read(final XoXMLStreamReader reader, RuntimeCon return resourceRef; } - public final ResourceRef read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ResourceRef read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ResourceRef resourceRef, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ResourceRef resourceRef, RuntimeContext context) + throws Exception + { if (resourceRef == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ResourceRef.class != resourceRef.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ResourceRef.class!= resourceRef.getClass()) { context.unexpectedSubclass(writer, resourceRef, ResourceRef.class); - return; + return ; } context.beforeMarshal(resourceRef, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = resourceRef.id; - if (idRaw != null) { + String idRaw = resourceRef.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceRef, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -249,12 +257,12 @@ public final static void _write(final XoXMLStreamWriter writer, final ResourceRe Text[] descriptions = null; try { descriptions = resourceRef.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(resourceRef, "descriptions", ResourceRef.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -265,14 +273,14 @@ public final static void _write(final XoXMLStreamWriter writer, final ResourceRe } // ELEMENT: resRefName - final String resRefNameRaw = resourceRef.resRefName; + String resRefNameRaw = resourceRef.resRefName; String resRefName = null; try { resRefName = Adapters.collapsedStringAdapterAdapter.marshal(resRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceRef, "resRefName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (resRefName != null) { + if (resRefName!= null) { writer.writeStartElement(prefix, "res-ref-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(resRefName); writer.writeEndElement(); @@ -281,54 +289,54 @@ public final static void _write(final XoXMLStreamWriter writer, final ResourceRe } // ELEMENT: resType - final String resTypeRaw = resourceRef.resType; + String resTypeRaw = resourceRef.resType; String resType = null; try { resType = Adapters.collapsedStringAdapterAdapter.marshal(resTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceRef, "resType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (resType != null) { + 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) { + 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) { + 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 mappedNameRaw = resourceRef.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + 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 = resourceRef.injectionTarget; - if (injectionTarget != null) { - for (final InjectionTarget injectionTargetItem : injectionTarget) { - if (injectionTargetItem != null) { + Set injectionTarget = resourceRef.injectionTarget; + if (injectionTarget!= null) { + for (InjectionTarget injectionTargetItem: injectionTarget) { + if (injectionTargetItem!= null) { writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee"); writeInjectionTarget(writer, injectionTargetItem, context); writer.writeEndElement(); @@ -339,14 +347,14 @@ public final static void _write(final XoXMLStreamWriter writer, final ResourceRe } // ELEMENT: lookupName - final String lookupNameRaw = resourceRef.lookupName; + String lookupNameRaw = resourceRef.lookupName; String lookupName = null; try { lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(resourceRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lookupName != null) { + if (lookupName!= null) { writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lookupName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RespectBinding$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RespectBinding$JAXB.java index b95825540f0..2931d4da460 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RespectBinding$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RespectBinding$JAXB.java @@ -1,21 +1,24 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,37 +26,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class RespectBinding$JAXB - extends JAXBObject { + extends JAXBObject +{ public RespectBinding$JAXB() { super(RespectBinding.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "respect-bindingType".intern())); } - public static RespectBinding readRespectBinding(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static RespectBinding readRespectBinding(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeRespectBinding(final XoXMLStreamWriter writer, final RespectBinding respectBinding, final RuntimeContext context) - throws Exception { + public static void writeRespectBinding(XoXMLStreamWriter writer, RespectBinding respectBinding, RuntimeContext context) + throws Exception + { _write(writer, respectBinding, context); } - public void write(final XoXMLStreamWriter writer, final RespectBinding respectBinding, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, RespectBinding respectBinding, RuntimeContext context) + throws Exception + { _write(writer, respectBinding, context); } - public final static RespectBinding _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final RespectBinding _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -64,30 +69,30 @@ public final static RespectBinding _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final RespectBinding respectBinding = new RespectBinding(); + RespectBinding respectBinding = new RespectBinding(); context.beforeUnmarshal(respectBinding, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("respect-bindingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("respect-bindingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, RespectBinding.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + for (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 (("enabled" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("enabled" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: enabled - final Boolean enabled = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean enabled = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); respectBinding.enabled = enabled; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "enabled")); @@ -99,33 +104,35 @@ public final static RespectBinding _read(final XoXMLStreamReader reader, Runtime return respectBinding; } - public final RespectBinding read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final RespectBinding read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final RespectBinding respectBinding, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, RespectBinding respectBinding, RuntimeContext context) + throws Exception + { if (respectBinding == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (RespectBinding.class != respectBinding.getClass()) { + if (RespectBinding.class!= respectBinding.getClass()) { context.unexpectedSubclass(writer, respectBinding, RespectBinding.class); - return; + return ; } context.beforeMarshal(respectBinding, LifecycleCallback.NONE); // ELEMENT: enabled - final Boolean enabled = respectBinding.enabled; - if (enabled != null) { + Boolean enabled = respectBinding.enabled; + if (enabled!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "enabled"); writer.writeCharacters(Boolean.toString(enabled)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResultTypeMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResultTypeMapping$JAXB.java index 0cacb8d86ed..7f2af645d55 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResultTypeMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ResultTypeMapping$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class ResultTypeMapping$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public ResultTypeMapping$JAXB() { super(ResultTypeMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "resultTypeMapping".intern())); } - public ResultTypeMapping parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public ResultTypeMapping parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseResultTypeMapping(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final ResultTypeMapping resultTypeMapping) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, ResultTypeMapping resultTypeMapping) + throws Exception + { return toStringResultTypeMapping(bean, parameterName, context, resultTypeMapping); } - public static ResultTypeMapping parseResultTypeMapping(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static ResultTypeMapping parseResultTypeMapping(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Local".equals(value)) { return ResultTypeMapping.LOCAL; } else if ("Remote".equals(value)) { @@ -52,8 +56,9 @@ public static ResultTypeMapping parseResultTypeMapping(final XoXMLStreamReader r } } - public static String toStringResultTypeMapping(final Object bean, final String parameterName, final RuntimeContext context, final ResultTypeMapping resultTypeMapping) - throws Exception { + public static String toStringResultTypeMapping(Object bean, String parameterName, RuntimeContext context, ResultTypeMapping resultTypeMapping) + throws Exception + { if (ResultTypeMapping.LOCAL == resultTypeMapping) { return "Local"; } else if (ResultTypeMapping.REMOTE == resultTypeMapping) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RunAs$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RunAs$JAXB.java index 958a7fdea42..a2748fb0508 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RunAs$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/RunAs$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class RunAs$JAXB - extends JAXBObject { + extends JAXBObject +{ public RunAs$JAXB() { super(RunAs.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "run-asType".intern()), Text$JAXB.class); } - public static RunAs readRunAs(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static RunAs readRunAs(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeRunAs(final XoXMLStreamWriter writer, final RunAs runAs, final RuntimeContext context) - throws Exception { + public static void writeRunAs(XoXMLStreamWriter writer, RunAs runAs, RuntimeContext context) + throws Exception + { _write(writer, runAs, context); } - public void write(final XoXMLStreamWriter writer, final RunAs runAs, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, RunAs runAs, RuntimeContext context) + throws Exception + { _write(writer, runAs, context); } - public final static RunAs _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final RunAs _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,48 +75,48 @@ public final static RunAs _read(final XoXMLStreamReader reader, RuntimeContext c context = new RuntimeContext(); } - final RunAs runAs = new RunAs(); + RunAs runAs = new RunAs(); context.beforeUnmarshal(runAs, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("run-asType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("run-asType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, RunAs.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, runAs); runAs.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("role-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("role-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: roleName - final String roleNameRaw = elementReader.getElementAsString(); + String roleNameRaw = elementReader.getElementText(); - final String roleName; + String roleName; try { roleName = Adapters.collapsedStringAdapterAdapter.unmarshal(roleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -120,10 +126,10 @@ public final static RunAs _read(final XoXMLStreamReader reader, RuntimeContext c context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "role-name")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - runAs.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + runAs.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, RunAs.class, "setDescriptions", Text[].class, e); } } @@ -133,38 +139,40 @@ public final static RunAs _read(final XoXMLStreamReader reader, RuntimeContext c return runAs; } - public final RunAs read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final RunAs read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final RunAs runAs, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, RunAs runAs, RuntimeContext context) + throws Exception + { if (runAs == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (RunAs.class != runAs.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (RunAs.class!= runAs.getClass()) { context.unexpectedSubclass(writer, runAs, RunAs.class); - return; + return ; } context.beforeMarshal(runAs, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = runAs.id; - if (idRaw != null) { + String idRaw = runAs.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(runAs, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -174,12 +182,12 @@ public final static void _write(final XoXMLStreamWriter writer, final RunAs runA Text[] descriptions = null; try { descriptions = runAs.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(runAs, "descriptions", RunAs.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -190,14 +198,14 @@ public final static void _write(final XoXMLStreamWriter writer, final RunAs runA } // ELEMENT: roleName - final String roleNameRaw = runAs.roleName; + String roleNameRaw = runAs.roleName; String roleName = null; try { roleName = Adapters.collapsedStringAdapterAdapter.marshal(roleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(runAs, "roleName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (roleName != null) { + if (roleName!= null) { writer.writeStartElement(prefix, "role-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(roleName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityConstraint$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityConstraint$JAXB.java index 7cc81e5172c..48a166f7256 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityConstraint$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityConstraint$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.AuthConstraint$JAXB.readAuthConstraint; import static org.apache.openejb.jee.AuthConstraint$JAXB.writeAuthConstraint; @@ -40,30 +41,35 @@ "StringEquality" }) public class SecurityConstraint$JAXB - extends JAXBObject { + extends JAXBObject +{ public SecurityConstraint$JAXB() { super(SecurityConstraint.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "security-constraintType".intern()), WebResourceCollection$JAXB.class, AuthConstraint$JAXB.class, UserDataConstraint$JAXB.class); } - public static SecurityConstraint readSecurityConstraint(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static SecurityConstraint readSecurityConstraint(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeSecurityConstraint(final XoXMLStreamWriter writer, final SecurityConstraint securityConstraint, final RuntimeContext context) - throws Exception { + public static void writeSecurityConstraint(XoXMLStreamWriter writer, SecurityConstraint securityConstraint, RuntimeContext context) + throws Exception + { _write(writer, securityConstraint, context); } - public void write(final XoXMLStreamWriter writer, final SecurityConstraint securityConstraint, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, SecurityConstraint securityConstraint, RuntimeContext context) + throws Exception + { _write(writer, securityConstraint, context); } - public final static SecurityConstraint _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final SecurityConstraint _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,83 +80,83 @@ public final static SecurityConstraint _read(final XoXMLStreamReader reader, Run context = new RuntimeContext(); } - final SecurityConstraint securityConstraint = new SecurityConstraint(); + SecurityConstraint securityConstraint = new SecurityConstraint(); context.beforeUnmarshal(securityConstraint, LifecycleCallback.NONE); List displayName = null; List webResourceCollection = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("security-constraintType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("security-constraintType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, SecurityConstraint.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, securityConstraint); securityConstraint.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayName - final String displayNameItemRaw = elementReader.getElementAsString(); + String displayNameItemRaw = elementReader.getElementText(); - final String displayNameItem; + String displayNameItem; try { displayNameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(displayNameItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (displayName == null) { displayName = securityConstraint.displayName; - if (displayName != null) { + if (displayName!= null) { displayName.clear(); } else { - displayName = new ArrayList(); + displayName = new ArrayList<>(); } } displayName.add(displayNameItem); - } else if (("web-resource-collection" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("web-resource-collection" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: webResourceCollection - final WebResourceCollection webResourceCollectionItem = readWebResourceCollection(elementReader, context); + WebResourceCollection webResourceCollectionItem = readWebResourceCollection(elementReader, context); if (webResourceCollection == null) { webResourceCollection = securityConstraint.webResourceCollection; - if (webResourceCollection != null) { + if (webResourceCollection!= null) { webResourceCollection.clear(); } else { - webResourceCollection = new ArrayList(); + webResourceCollection = new ArrayList<>(); } } webResourceCollection.add(webResourceCollectionItem); - } else if (("auth-constraint" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("auth-constraint" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: authConstraint - final AuthConstraint authConstraint = readAuthConstraint(elementReader, context); + AuthConstraint authConstraint = readAuthConstraint(elementReader, context); securityConstraint.authConstraint = authConstraint; - } else if (("user-data-constraint" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("user-data-constraint" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: userDataConstraint - final UserDataConstraint userDataConstraint = readUserDataConstraint(elementReader, context); + UserDataConstraint userDataConstraint = readUserDataConstraint(elementReader, context); securityConstraint.userDataConstraint = userDataConstraint; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "display-name"), new QName("http://java.sun.com/xml/ns/javaee", "web-resource-collection"), new QName("http://java.sun.com/xml/ns/javaee", "auth-constraint"), new QName("http://java.sun.com/xml/ns/javaee", "user-data-constraint")); } } - if (displayName != null) { + if (displayName!= null) { securityConstraint.displayName = displayName; } - if (webResourceCollection != null) { + if (webResourceCollection!= null) { securityConstraint.webResourceCollection = webResourceCollection; } @@ -159,54 +165,56 @@ public final static SecurityConstraint _read(final XoXMLStreamReader reader, Run return securityConstraint; } - public final SecurityConstraint read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final SecurityConstraint read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final SecurityConstraint securityConstraint, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, SecurityConstraint securityConstraint, RuntimeContext context) + throws Exception + { if (securityConstraint == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (SecurityConstraint.class != securityConstraint.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (SecurityConstraint.class!= securityConstraint.getClass()) { context.unexpectedSubclass(writer, securityConstraint, SecurityConstraint.class); - return; + return ; } context.beforeMarshal(securityConstraint, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = securityConstraint.id; - if (idRaw != null) { + String idRaw = securityConstraint.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(securityConstraint, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: displayName - final List displayNameRaw = securityConstraint.displayName; - if (displayNameRaw != null) { - for (final String displayNameItem : displayNameRaw) { + List displayNameRaw = securityConstraint.displayName; + if (displayNameRaw!= null) { + for (String displayNameItem: displayNameRaw) { String displayName = null; try { displayName = Adapters.collapsedStringAdapterAdapter.marshal(displayNameItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(securityConstraint, "displayName", CollapsedStringAdapter.class, List.class, List.class, e); } - if (displayName != null) { + if (displayName!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(displayName); writer.writeEndElement(); @@ -215,10 +223,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SecurityCo } // ELEMENT: webResourceCollection - final List webResourceCollection = securityConstraint.webResourceCollection; - if (webResourceCollection != null) { - for (final WebResourceCollection webResourceCollectionItem : webResourceCollection) { - if (webResourceCollectionItem != null) { + List webResourceCollection = securityConstraint.webResourceCollection; + if (webResourceCollection!= null) { + for (WebResourceCollection webResourceCollectionItem: webResourceCollection) { + if (webResourceCollectionItem!= null) { writer.writeStartElement(prefix, "web-resource-collection", "http://java.sun.com/xml/ns/javaee"); writeWebResourceCollection(writer, webResourceCollectionItem, context); writer.writeEndElement(); @@ -229,16 +237,16 @@ public final static void _write(final XoXMLStreamWriter writer, final SecurityCo } // ELEMENT: authConstraint - final AuthConstraint authConstraint = securityConstraint.authConstraint; - if (authConstraint != null) { + AuthConstraint authConstraint = securityConstraint.authConstraint; + if (authConstraint!= null) { writer.writeStartElement(prefix, "auth-constraint", "http://java.sun.com/xml/ns/javaee"); writeAuthConstraint(writer, authConstraint, context); writer.writeEndElement(); } // ELEMENT: userDataConstraint - final UserDataConstraint userDataConstraint = securityConstraint.userDataConstraint; - if (userDataConstraint != null) { + UserDataConstraint userDataConstraint = securityConstraint.userDataConstraint; + if (userDataConstraint!= null) { writer.writeStartElement(prefix, "user-data-constraint", "http://java.sun.com/xml/ns/javaee"); writeUserDataConstraint(writer, userDataConstraint, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityIdentity$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityIdentity$JAXB.java index d771d7eedad..a9d7832cf4e 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityIdentity$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityIdentity$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Empty$JAXB.readEmpty; import static org.apache.openejb.jee.Empty$JAXB.writeEmpty; @@ -39,30 +40,35 @@ "StringEquality" }) public class SecurityIdentity$JAXB - extends JAXBObject { + extends JAXBObject +{ public SecurityIdentity$JAXB() { super(SecurityIdentity.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "security-identityType".intern()), Text$JAXB.class, Empty$JAXB.class, RunAs$JAXB.class); } - public static SecurityIdentity readSecurityIdentity(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static SecurityIdentity readSecurityIdentity(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeSecurityIdentity(final XoXMLStreamWriter writer, final SecurityIdentity securityIdentity, final RuntimeContext context) - throws Exception { + public static void writeSecurityIdentity(XoXMLStreamWriter writer, SecurityIdentity securityIdentity, RuntimeContext context) + throws Exception + { _write(writer, securityIdentity, context); } - public void write(final XoXMLStreamWriter writer, final SecurityIdentity securityIdentity, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, SecurityIdentity securityIdentity, RuntimeContext context) + throws Exception + { _write(writer, securityIdentity, context); } - public final static SecurityIdentity _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final SecurityIdentity _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -73,56 +79,56 @@ public final static SecurityIdentity _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final SecurityIdentity securityIdentity = new SecurityIdentity(); + SecurityIdentity securityIdentity = new SecurityIdentity(); context.beforeUnmarshal(securityIdentity, LifecycleCallback.NONE); ArrayList 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())) { + 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))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("use-caller-identity" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("use-caller-identity" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: useCallerIdentity - final Empty useCallerIdentity = readEmpty(elementReader, context); + Empty useCallerIdentity = readEmpty(elementReader, context); securityIdentity.useCallerIdentity = useCallerIdentity; - } else if (("run-as" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("run-as" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: runAs - final RunAs runAs = readRunAs(elementReader, context); + 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) { + if (descriptions!= null) { try { - securityIdentity.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + securityIdentity.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, SecurityIdentity.class, "setDescriptions", Text[].class, e); } } @@ -132,38 +138,40 @@ public final static SecurityIdentity _read(final XoXMLStreamReader reader, Runti return securityIdentity; } - public final SecurityIdentity read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final SecurityIdentity read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final SecurityIdentity securityIdentity, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, SecurityIdentity securityIdentity, RuntimeContext context) + throws Exception + { if (securityIdentity == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (SecurityIdentity.class != securityIdentity.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (SecurityIdentity.class!= securityIdentity.getClass()) { context.unexpectedSubclass(writer, securityIdentity, SecurityIdentity.class); - return; + return ; } context.beforeMarshal(securityIdentity, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = securityIdentity.id; - if (idRaw != null) { + String idRaw = securityIdentity.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(securityIdentity, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -173,12 +181,12 @@ public final static void _write(final XoXMLStreamWriter writer, final SecurityId Text[] descriptions = null; try { descriptions = securityIdentity.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(securityIdentity, "descriptions", SecurityIdentity.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -189,16 +197,16 @@ public final static void _write(final XoXMLStreamWriter writer, final SecurityId } // ELEMENT: useCallerIdentity - final Empty useCallerIdentity = securityIdentity.useCallerIdentity; - if (useCallerIdentity != null) { + 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) { + 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(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityPermission$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityPermission$JAXB.java index fe3446d8ba9..b6653a6bc33 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityPermission$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityPermission$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class SecurityPermission$JAXB - extends JAXBObject { + extends JAXBObject +{ public SecurityPermission$JAXB() { super(SecurityPermission.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "security-permissionType".intern()), Text$JAXB.class); } - public static SecurityPermission readSecurityPermission(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static SecurityPermission readSecurityPermission(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeSecurityPermission(final XoXMLStreamWriter writer, final SecurityPermission securityPermission, final RuntimeContext context) - throws Exception { + public static void writeSecurityPermission(XoXMLStreamWriter writer, SecurityPermission securityPermission, RuntimeContext context) + throws Exception + { _write(writer, securityPermission, context); } - public void write(final XoXMLStreamWriter writer, final SecurityPermission securityPermission, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, SecurityPermission securityPermission, RuntimeContext context) + throws Exception + { _write(writer, securityPermission, context); } - public final static SecurityPermission _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final SecurityPermission _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,48 +75,48 @@ public final static SecurityPermission _read(final XoXMLStreamReader reader, Run context = new RuntimeContext(); } - final SecurityPermission securityPermission = new SecurityPermission(); + SecurityPermission securityPermission = new SecurityPermission(); context.beforeUnmarshal(securityPermission, LifecycleCallback.NONE); ArrayList 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())) { + 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))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("security-permission-spec" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("security-permission-spec" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityPermissionSpec - final String securityPermissionSpecRaw = elementReader.getElementAsString(); + String securityPermissionSpecRaw = elementReader.getElementText(); - final String securityPermissionSpec; + String securityPermissionSpec; try { securityPermissionSpec = Adapters.collapsedStringAdapterAdapter.unmarshal(securityPermissionSpecRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -120,10 +126,10 @@ public final static SecurityPermission _read(final XoXMLStreamReader reader, Run 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) { + if (descriptions!= null) { try { - securityPermission.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + securityPermission.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, SecurityPermission.class, "setDescriptions", Text[].class, e); } } @@ -133,38 +139,40 @@ public final static SecurityPermission _read(final XoXMLStreamReader reader, Run return securityPermission; } - public final SecurityPermission read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final SecurityPermission read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final SecurityPermission securityPermission, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, SecurityPermission securityPermission, RuntimeContext context) + throws Exception + { if (securityPermission == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (SecurityPermission.class != securityPermission.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (SecurityPermission.class!= securityPermission.getClass()) { context.unexpectedSubclass(writer, securityPermission, SecurityPermission.class); - return; + return ; } context.beforeMarshal(securityPermission, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = securityPermission.id; - if (idRaw != null) { + String idRaw = securityPermission.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(securityPermission, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -174,12 +182,12 @@ public final static void _write(final XoXMLStreamWriter writer, final SecurityPe Text[] descriptions = null; try { descriptions = securityPermission.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(securityPermission, "descriptions", SecurityPermission.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -190,14 +198,14 @@ public final static void _write(final XoXMLStreamWriter writer, final SecurityPe } // ELEMENT: securityPermissionSpec - final String securityPermissionSpecRaw = securityPermission.securityPermissionSpec; + String securityPermissionSpecRaw = securityPermission.securityPermissionSpec; String securityPermissionSpec = null; try { securityPermissionSpec = Adapters.collapsedStringAdapterAdapter.marshal(securityPermissionSpecRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(securityPermission, "securityPermissionSpec", CollapsedStringAdapter.class, String.class, String.class, e); } - if (securityPermissionSpec != null) { + if (securityPermissionSpec!= null) { writer.writeStartElement(prefix, "security-permission-spec", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(securityPermissionSpec); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityRole$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityRole$JAXB.java index 930723639a6..574bcb3b860 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityRole$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityRole$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class SecurityRole$JAXB - extends JAXBObject { + extends JAXBObject +{ public SecurityRole$JAXB() { super(SecurityRole.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "security-roleType".intern()), Text$JAXB.class); } - public static SecurityRole readSecurityRole(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static SecurityRole readSecurityRole(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeSecurityRole(final XoXMLStreamWriter writer, final SecurityRole securityRole, final RuntimeContext context) - throws Exception { + public static void writeSecurityRole(XoXMLStreamWriter writer, SecurityRole securityRole, RuntimeContext context) + throws Exception + { _write(writer, securityRole, context); } - public void write(final XoXMLStreamWriter writer, final SecurityRole securityRole, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, SecurityRole securityRole, RuntimeContext context) + throws Exception + { _write(writer, securityRole, context); } - public final static SecurityRole _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final SecurityRole _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,48 +75,48 @@ public final static SecurityRole _read(final XoXMLStreamReader reader, RuntimeCo context = new RuntimeContext(); } - final SecurityRole securityRole = new SecurityRole(); + SecurityRole securityRole = new SecurityRole(); context.beforeUnmarshal(securityRole, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("security-roleType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("security-roleType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, SecurityRole.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, securityRole); securityRole.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("role-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("role-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: roleName - final String roleNameRaw = elementReader.getElementAsString(); + String roleNameRaw = elementReader.getElementText(); - final String roleName; + String roleName; try { roleName = Adapters.collapsedStringAdapterAdapter.unmarshal(roleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -120,10 +126,10 @@ public final static SecurityRole _read(final XoXMLStreamReader reader, RuntimeCo context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "role-name")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - securityRole.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + securityRole.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, SecurityRole.class, "setDescriptions", Text[].class, e); } } @@ -133,38 +139,40 @@ public final static SecurityRole _read(final XoXMLStreamReader reader, RuntimeCo return securityRole; } - public final SecurityRole read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final SecurityRole read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final SecurityRole securityRole, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, SecurityRole securityRole, RuntimeContext context) + throws Exception + { if (securityRole == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (SecurityRole.class != securityRole.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (SecurityRole.class!= securityRole.getClass()) { context.unexpectedSubclass(writer, securityRole, SecurityRole.class); - return; + return ; } context.beforeMarshal(securityRole, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = securityRole.id; - if (idRaw != null) { + String idRaw = securityRole.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(securityRole, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -174,12 +182,12 @@ public final static void _write(final XoXMLStreamWriter writer, final SecurityRo Text[] descriptions = null; try { descriptions = securityRole.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(securityRole, "descriptions", SecurityRole.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -190,14 +198,14 @@ public final static void _write(final XoXMLStreamWriter writer, final SecurityRo } // ELEMENT: roleName - final String roleNameRaw = securityRole.roleName; + String roleNameRaw = securityRole.roleName; String roleName = null; try { roleName = Adapters.collapsedStringAdapterAdapter.marshal(roleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(securityRole, "roleName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (roleName != null) { + if (roleName!= null) { writer.writeStartElement(prefix, "role-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(roleName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityRoleRef$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityRoleRef$JAXB.java index b6f3acfc20b..3697260dda0 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityRoleRef$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SecurityRoleRef$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class SecurityRoleRef$JAXB - extends JAXBObject { + extends JAXBObject +{ public SecurityRoleRef$JAXB() { super(SecurityRoleRef.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "security-role-refType".intern()), Text$JAXB.class); } - public static SecurityRoleRef readSecurityRoleRef(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static SecurityRoleRef readSecurityRoleRef(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeSecurityRoleRef(final XoXMLStreamWriter writer, final SecurityRoleRef securityRoleRef, final RuntimeContext context) - throws Exception { + public static void writeSecurityRoleRef(XoXMLStreamWriter writer, SecurityRoleRef securityRoleRef, RuntimeContext context) + throws Exception + { _write(writer, securityRoleRef, context); } - public void write(final XoXMLStreamWriter writer, final SecurityRoleRef securityRoleRef, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, SecurityRoleRef securityRoleRef, RuntimeContext context) + throws Exception + { _write(writer, securityRoleRef, context); } - public final static SecurityRoleRef _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final SecurityRoleRef _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,61 +75,61 @@ public final static SecurityRoleRef _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final SecurityRoleRef securityRoleRef = new SecurityRoleRef(); + SecurityRoleRef securityRoleRef = new SecurityRoleRef(); context.beforeUnmarshal(securityRoleRef, LifecycleCallback.NONE); ArrayList 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())) { + 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))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("role-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("role-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: roleName - final String roleNameRaw = elementReader.getElementAsString(); + String roleNameRaw = elementReader.getElementText(); - final String roleName; + String roleName; try { roleName = Adapters.collapsedStringAdapterAdapter.unmarshal(roleNameRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("role-link" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: roleLink - final String roleLinkRaw = elementReader.getElementAsString(); + String roleLinkRaw = elementReader.getElementText(); - final String roleLink; + String roleLink; try { roleLink = Adapters.collapsedStringAdapterAdapter.unmarshal(roleLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -133,10 +139,10 @@ public final static SecurityRoleRef _read(final XoXMLStreamReader reader, Runtim 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) { + if (descriptions!= null) { try { - securityRoleRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + securityRoleRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, SecurityRoleRef.class, "setDescriptions", Text[].class, e); } } @@ -146,38 +152,40 @@ public final static SecurityRoleRef _read(final XoXMLStreamReader reader, Runtim return securityRoleRef; } - public final SecurityRoleRef read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final SecurityRoleRef read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final SecurityRoleRef securityRoleRef, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, SecurityRoleRef securityRoleRef, RuntimeContext context) + throws Exception + { if (securityRoleRef == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (SecurityRoleRef.class != securityRoleRef.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (SecurityRoleRef.class!= securityRoleRef.getClass()) { context.unexpectedSubclass(writer, securityRoleRef, SecurityRoleRef.class); - return; + return ; } context.beforeMarshal(securityRoleRef, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = securityRoleRef.id; - if (idRaw != null) { + String idRaw = securityRoleRef.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(securityRoleRef, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -187,12 +195,12 @@ public final static void _write(final XoXMLStreamWriter writer, final SecurityRo Text[] descriptions = null; try { descriptions = securityRoleRef.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(securityRoleRef, "descriptions", SecurityRoleRef.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -203,14 +211,14 @@ public final static void _write(final XoXMLStreamWriter writer, final SecurityRo } // ELEMENT: roleName - final String roleNameRaw = securityRoleRef.roleName; + String roleNameRaw = securityRoleRef.roleName; String roleName = null; try { roleName = Adapters.collapsedStringAdapterAdapter.marshal(roleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(securityRoleRef, "roleName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (roleName != null) { + if (roleName!= null) { writer.writeStartElement(prefix, "role-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(roleName); writer.writeEndElement(); @@ -219,14 +227,14 @@ public final static void _write(final XoXMLStreamWriter writer, final SecurityRo } // ELEMENT: roleLink - final String roleLinkRaw = securityRoleRef.roleLink; + String roleLinkRaw = securityRoleRef.roleLink; String roleLink = null; try { roleLink = Adapters.collapsedStringAdapterAdapter.marshal(roleLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(securityRoleRef, "roleLink", CollapsedStringAdapter.class, String.class, String.class, e); } - if (roleLink != null) { + if (roleLink!= null) { writer.writeStartElement(prefix, "role-link", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(roleLink); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceEndpointInterfaceMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceEndpointInterfaceMapping$JAXB.java index 8af76faac4e..6ffc327d17a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceEndpointInterfaceMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceEndpointInterfaceMapping$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.ServiceEndpointMethodMapping$JAXB.readServiceEndpointMethodMapping; import static org.apache.openejb.jee.ServiceEndpointMethodMapping$JAXB.writeServiceEndpointMethodMapping; @@ -36,30 +37,35 @@ "StringEquality" }) public class ServiceEndpointInterfaceMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public ServiceEndpointInterfaceMapping$JAXB() { super(ServiceEndpointInterfaceMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "service-endpoint-interface-mappingType".intern()), ServiceEndpointMethodMapping$JAXB.class); } - public static ServiceEndpointInterfaceMapping readServiceEndpointInterfaceMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ServiceEndpointInterfaceMapping readServiceEndpointInterfaceMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeServiceEndpointInterfaceMapping(final XoXMLStreamWriter writer, final ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping, final RuntimeContext context) - throws Exception { + public static void writeServiceEndpointInterfaceMapping(XoXMLStreamWriter writer, ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping, RuntimeContext context) + throws Exception + { _write(writer, serviceEndpointInterfaceMapping, context); } - public void write(final XoXMLStreamWriter writer, final ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping, RuntimeContext context) + throws Exception + { _write(writer, serviceEndpointInterfaceMapping, context); } - public final static ServiceEndpointInterfaceMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ServiceEndpointInterfaceMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,63 +76,63 @@ public final static ServiceEndpointInterfaceMapping _read(final XoXMLStreamReade context = new RuntimeContext(); } - final ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping = new ServiceEndpointInterfaceMapping(); + ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping = new ServiceEndpointInterfaceMapping(); context.beforeUnmarshal(serviceEndpointInterfaceMapping, LifecycleCallback.NONE); List 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())) { + 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))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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())) { + for (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(); + String serviceEndpointInterfaceRaw = elementReader.getElementText(); - final String serviceEndpointInterface; + String serviceEndpointInterface; try { serviceEndpointInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceEndpointInterfaceRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("wsdl-port-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlPortType - final QName wsdlPortType = elementReader.getElementAsQName(); + QName wsdlPortType = elementReader.getElementAsQName(); serviceEndpointInterfaceMapping.wsdlPortType = wsdlPortType; - } else if (("wsdl-binding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-binding" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlBinding - final QName wsdlBinding = elementReader.getElementAsQName(); + QName wsdlBinding = elementReader.getElementAsQName(); serviceEndpointInterfaceMapping.wsdlBinding = wsdlBinding; - } else if (("service-endpoint-method-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } 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); + ServiceEndpointMethodMapping serviceEndpointMethodMappingItem = readServiceEndpointMethodMapping(elementReader, context); if (serviceEndpointMethodMapping == null) { serviceEndpointMethodMapping = serviceEndpointInterfaceMapping.serviceEndpointMethodMapping; - if (serviceEndpointMethodMapping != null) { + if (serviceEndpointMethodMapping!= null) { serviceEndpointMethodMapping.clear(); } else { - serviceEndpointMethodMapping = new ArrayList(); + serviceEndpointMethodMapping = new ArrayList<>(); } } serviceEndpointMethodMapping.add(serviceEndpointMethodMappingItem); @@ -134,7 +140,7 @@ public final static ServiceEndpointInterfaceMapping _read(final XoXMLStreamReade 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) { + if (serviceEndpointMethodMapping!= null) { serviceEndpointInterfaceMapping.serviceEndpointMethodMapping = serviceEndpointMethodMapping; } @@ -143,52 +149,54 @@ public final static ServiceEndpointInterfaceMapping _read(final XoXMLStreamReade return serviceEndpointInterfaceMapping; } - public final ServiceEndpointInterfaceMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ServiceEndpointInterfaceMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping, RuntimeContext context) + throws Exception + { if (serviceEndpointInterfaceMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ServiceEndpointInterfaceMapping.class != serviceEndpointInterfaceMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ServiceEndpointInterfaceMapping.class!= serviceEndpointInterfaceMapping.getClass()) { context.unexpectedSubclass(writer, serviceEndpointInterfaceMapping, ServiceEndpointInterfaceMapping.class); - return; + return ; } context.beforeMarshal(serviceEndpointInterfaceMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = serviceEndpointInterfaceMapping.id; - if (idRaw != null) { + String idRaw = serviceEndpointInterfaceMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceEndpointInterfaceMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: serviceEndpointInterface - final String serviceEndpointInterfaceRaw = serviceEndpointInterfaceMapping.serviceEndpointInterface; + String serviceEndpointInterfaceRaw = serviceEndpointInterfaceMapping.serviceEndpointInterface; String serviceEndpointInterface = null; try { serviceEndpointInterface = Adapters.collapsedStringAdapterAdapter.marshal(serviceEndpointInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceEndpointInterfaceMapping, "serviceEndpointInterface", CollapsedStringAdapter.class, String.class, String.class, e); } - if (serviceEndpointInterface != null) { + if (serviceEndpointInterface!= null) { writer.writeStartElement(prefix, "service-endpoint-interface", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(serviceEndpointInterface); writer.writeEndElement(); @@ -197,8 +205,8 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceEnd } // ELEMENT: wsdlPortType - final QName wsdlPortType = serviceEndpointInterfaceMapping.wsdlPortType; - if (wsdlPortType != null) { + QName wsdlPortType = serviceEndpointInterfaceMapping.wsdlPortType; + if (wsdlPortType!= null) { writer.writeStartElement(prefix, "wsdl-port-type", "http://java.sun.com/xml/ns/javaee"); writer.writeQName(wsdlPortType); writer.writeEndElement(); @@ -207,8 +215,8 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceEnd } // ELEMENT: wsdlBinding - final QName wsdlBinding = serviceEndpointInterfaceMapping.wsdlBinding; - if (wsdlBinding != null) { + QName wsdlBinding = serviceEndpointInterfaceMapping.wsdlBinding; + if (wsdlBinding!= null) { writer.writeStartElement(prefix, "wsdl-binding", "http://java.sun.com/xml/ns/javaee"); writer.writeQName(wsdlBinding); writer.writeEndElement(); @@ -217,10 +225,10 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceEnd } // ELEMENT: serviceEndpointMethodMapping - final List serviceEndpointMethodMapping = serviceEndpointInterfaceMapping.serviceEndpointMethodMapping; - if (serviceEndpointMethodMapping != null) { - for (final ServiceEndpointMethodMapping serviceEndpointMethodMappingItem : serviceEndpointMethodMapping) { - if (serviceEndpointMethodMappingItem != null) { + List serviceEndpointMethodMapping = serviceEndpointInterfaceMapping.serviceEndpointMethodMapping; + if (serviceEndpointMethodMapping!= null) { + for (ServiceEndpointMethodMapping serviceEndpointMethodMappingItem: serviceEndpointMethodMapping) { + if (serviceEndpointMethodMappingItem!= null) { writer.writeStartElement(prefix, "service-endpoint-method-mapping", "http://java.sun.com/xml/ns/javaee"); writeServiceEndpointMethodMapping(writer, serviceEndpointMethodMappingItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceEndpointMethodMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceEndpointMethodMapping$JAXB.java index 52c949efce5..b41ddda2458 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceEndpointMethodMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceEndpointMethodMapping$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -24,11 +30,6 @@ import org.metatype.sxc.util.XoXMLStreamWriter; import org.w3c.dom.Element; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.MethodParamPartsMapping$JAXB.readMethodParamPartsMapping; import static org.apache.openejb.jee.MethodParamPartsMapping$JAXB.writeMethodParamPartsMapping; @@ -39,30 +40,35 @@ "StringEquality" }) public class ServiceEndpointMethodMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public ServiceEndpointMethodMapping$JAXB() { super(ServiceEndpointMethodMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "service-endpoint-method-mappingType".intern()), MethodParamPartsMapping$JAXB.class, WsdlReturnValueMapping$JAXB.class); } - public static ServiceEndpointMethodMapping readServiceEndpointMethodMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ServiceEndpointMethodMapping readServiceEndpointMethodMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeServiceEndpointMethodMapping(final XoXMLStreamWriter writer, final ServiceEndpointMethodMapping serviceEndpointMethodMapping, final RuntimeContext context) - throws Exception { + public static void writeServiceEndpointMethodMapping(XoXMLStreamWriter writer, ServiceEndpointMethodMapping serviceEndpointMethodMapping, RuntimeContext context) + throws Exception + { _write(writer, serviceEndpointMethodMapping, context); } - public void write(final XoXMLStreamWriter writer, final ServiceEndpointMethodMapping serviceEndpointMethodMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ServiceEndpointMethodMapping serviceEndpointMethodMapping, RuntimeContext context) + throws Exception + { _write(writer, serviceEndpointMethodMapping, context); } - public final static ServiceEndpointMethodMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ServiceEndpointMethodMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -73,84 +79,84 @@ public final static ServiceEndpointMethodMapping _read(final XoXMLStreamReader r context = new RuntimeContext(); } - final ServiceEndpointMethodMapping serviceEndpointMethodMapping = new ServiceEndpointMethodMapping(); + ServiceEndpointMethodMapping serviceEndpointMethodMapping = new ServiceEndpointMethodMapping(); context.beforeUnmarshal(serviceEndpointMethodMapping, LifecycleCallback.NONE); List 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())) { + 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))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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())) { + for (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(); + String javaMethodNameRaw = elementReader.getElementText(); - final String javaMethodName; + String javaMethodName; try { javaMethodName = Adapters.collapsedStringAdapterAdapter.unmarshal(javaMethodNameRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("wsdl-operation" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlOperation - final String wsdlOperationRaw = elementReader.getElementAsString(); + String wsdlOperationRaw = elementReader.getElementText(); - final String wsdlOperation; + String wsdlOperation; try { wsdlOperation = Adapters.collapsedStringAdapterAdapter.unmarshal(wsdlOperationRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("wrapped-element" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wrappedElement - final Element wrappedElement = elementReader.getElementAsDomElement(); + Element wrappedElement = elementReader.getElementAsDomElement(); serviceEndpointMethodMapping.wrappedElement = wrappedElement; - } else if (("method-param-parts-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } 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); + MethodParamPartsMapping methodParamPartsMappingItem = readMethodParamPartsMapping(elementReader, context); if (methodParamPartsMapping == null) { methodParamPartsMapping = serviceEndpointMethodMapping.methodParamPartsMapping; - if (methodParamPartsMapping != null) { + if (methodParamPartsMapping!= null) { methodParamPartsMapping.clear(); } else { - methodParamPartsMapping = new ArrayList(); + methodParamPartsMapping = new ArrayList<>(); } } methodParamPartsMapping.add(methodParamPartsMappingItem); - } else if (("wsdl-return-value-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } 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); + 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) { + if (methodParamPartsMapping!= null) { serviceEndpointMethodMapping.methodParamPartsMapping = methodParamPartsMapping; } @@ -159,52 +165,54 @@ public final static ServiceEndpointMethodMapping _read(final XoXMLStreamReader r return serviceEndpointMethodMapping; } - public final ServiceEndpointMethodMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ServiceEndpointMethodMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ServiceEndpointMethodMapping serviceEndpointMethodMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ServiceEndpointMethodMapping serviceEndpointMethodMapping, RuntimeContext context) + throws Exception + { if (serviceEndpointMethodMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ServiceEndpointMethodMapping.class != serviceEndpointMethodMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ServiceEndpointMethodMapping.class!= serviceEndpointMethodMapping.getClass()) { context.unexpectedSubclass(writer, serviceEndpointMethodMapping, ServiceEndpointMethodMapping.class); - return; + return ; } context.beforeMarshal(serviceEndpointMethodMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = serviceEndpointMethodMapping.id; - if (idRaw != null) { + String idRaw = serviceEndpointMethodMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (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 javaMethodNameRaw = serviceEndpointMethodMapping.javaMethodName; String javaMethodName = null; try { javaMethodName = Adapters.collapsedStringAdapterAdapter.marshal(javaMethodNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceEndpointMethodMapping, "javaMethodName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (javaMethodName != null) { + if (javaMethodName!= null) { writer.writeStartElement(prefix, "java-method-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(javaMethodName); writer.writeEndElement(); @@ -213,14 +221,14 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceEnd } // ELEMENT: wsdlOperation - final String wsdlOperationRaw = serviceEndpointMethodMapping.wsdlOperation; + String wsdlOperationRaw = serviceEndpointMethodMapping.wsdlOperation; String wsdlOperation = null; try { wsdlOperation = Adapters.collapsedStringAdapterAdapter.marshal(wsdlOperationRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceEndpointMethodMapping, "wsdlOperation", CollapsedStringAdapter.class, String.class, String.class, e); } - if (wsdlOperation != null) { + if (wsdlOperation!= null) { writer.writeStartElement(prefix, "wsdl-operation", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(wsdlOperation); writer.writeEndElement(); @@ -229,18 +237,18 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceEnd } // ELEMENT: wrappedElement - final Object wrappedElement = serviceEndpointMethodMapping.wrappedElement; - if (wrappedElement != null) { + 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 = serviceEndpointMethodMapping.methodParamPartsMapping; - if (methodParamPartsMapping != null) { - for (final MethodParamPartsMapping methodParamPartsMappingItem : methodParamPartsMapping) { - if (methodParamPartsMappingItem != null) { + List methodParamPartsMapping = serviceEndpointMethodMapping.methodParamPartsMapping; + if (methodParamPartsMapping!= null) { + for (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(); @@ -249,8 +257,8 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceEnd } // ELEMENT: wsdlReturnValueMapping - final WsdlReturnValueMapping wsdlReturnValueMapping = serviceEndpointMethodMapping.wsdlReturnValueMapping; - if (wsdlReturnValueMapping != null) { + 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(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceImplBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceImplBean$JAXB.java index ec11b1ac28b..31bf7fafb39 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceImplBean$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceImplBean$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class ServiceImplBean$JAXB - extends JAXBObject { + extends JAXBObject +{ public ServiceImplBean$JAXB() { super(ServiceImplBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "service-impl-beanType".intern())); } - public static ServiceImplBean readServiceImplBean(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ServiceImplBean readServiceImplBean(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeServiceImplBean(final XoXMLStreamWriter writer, final ServiceImplBean serviceImplBean, final RuntimeContext context) - throws Exception { + public static void writeServiceImplBean(XoXMLStreamWriter writer, ServiceImplBean serviceImplBean, RuntimeContext context) + throws Exception + { _write(writer, serviceImplBean, context); } - public void write(final XoXMLStreamWriter writer, final ServiceImplBean serviceImplBean, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ServiceImplBean serviceImplBean, RuntimeContext context) + throws Exception + { _write(writer, serviceImplBean, context); } - public final static ServiceImplBean _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ServiceImplBean _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,53 +70,53 @@ public final static ServiceImplBean _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final ServiceImplBean serviceImplBean = new ServiceImplBean(); + ServiceImplBean serviceImplBean = new ServiceImplBean(); context.beforeUnmarshal(serviceImplBean, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("service-impl-beanType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("service-impl-beanType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ServiceImplBean.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, serviceImplBean); serviceImplBean.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("ejb-link" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("ejb-link" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbLink - final String ejbLinkRaw = elementReader.getElementAsString(); + String ejbLinkRaw = elementReader.getElementText(); - final String ejbLink; + String ejbLink; try { ejbLink = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } serviceImplBean.ejbLink = ejbLink; - } else if (("servlet-link" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("servlet-link" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: servletLink - final String servletLinkRaw = elementReader.getElementAsString(); + String servletLinkRaw = elementReader.getElementText(); - final String servletLink; + String servletLink; try { servletLink = Adapters.collapsedStringAdapterAdapter.unmarshal(servletLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -127,66 +132,68 @@ public final static ServiceImplBean _read(final XoXMLStreamReader reader, Runtim return serviceImplBean; } - public final ServiceImplBean read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ServiceImplBean read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ServiceImplBean serviceImplBean, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ServiceImplBean serviceImplBean, RuntimeContext context) + throws Exception + { if (serviceImplBean == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ServiceImplBean.class != serviceImplBean.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ServiceImplBean.class!= serviceImplBean.getClass()) { context.unexpectedSubclass(writer, serviceImplBean, ServiceImplBean.class); - return; + return ; } context.beforeMarshal(serviceImplBean, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = serviceImplBean.id; - if (idRaw != null) { + String idRaw = serviceImplBean.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceImplBean, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: ejbLink - final String ejbLinkRaw = serviceImplBean.ejbLink; + String ejbLinkRaw = serviceImplBean.ejbLink; String ejbLink = null; try { ejbLink = Adapters.collapsedStringAdapterAdapter.marshal(ejbLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceImplBean, "ejbLink", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbLink != null) { + if (ejbLink!= null) { writer.writeStartElement(prefix, "ejb-link", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbLink); writer.writeEndElement(); } // ELEMENT: servletLink - final String servletLinkRaw = serviceImplBean.servletLink; + String servletLinkRaw = serviceImplBean.servletLink; String servletLink = null; try { servletLink = Adapters.collapsedStringAdapterAdapter.marshal(servletLinkRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceImplBean, "servletLink", CollapsedStringAdapter.class, String.class, String.class, e); } - if (servletLink != null) { + if (servletLink!= null) { writer.writeStartElement(prefix, "servlet-link", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(servletLink); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceInterfaceMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceInterfaceMapping$JAXB.java index cfa62369bc9..cc75ef3424b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceInterfaceMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceInterfaceMapping$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.PortMapping$JAXB.readPortMapping; import static org.apache.openejb.jee.PortMapping$JAXB.writePortMapping; @@ -36,30 +37,35 @@ "StringEquality" }) public class ServiceInterfaceMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public ServiceInterfaceMapping$JAXB() { super(ServiceInterfaceMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "service-interface-mappingType".intern()), PortMapping$JAXB.class); } - public static ServiceInterfaceMapping readServiceInterfaceMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ServiceInterfaceMapping readServiceInterfaceMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeServiceInterfaceMapping(final XoXMLStreamWriter writer, final ServiceInterfaceMapping serviceInterfaceMapping, final RuntimeContext context) - throws Exception { + public static void writeServiceInterfaceMapping(XoXMLStreamWriter writer, ServiceInterfaceMapping serviceInterfaceMapping, RuntimeContext context) + throws Exception + { _write(writer, serviceInterfaceMapping, context); } - public void write(final XoXMLStreamWriter writer, final ServiceInterfaceMapping serviceInterfaceMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ServiceInterfaceMapping serviceInterfaceMapping, RuntimeContext context) + throws Exception + { _write(writer, serviceInterfaceMapping, context); } - public final static ServiceInterfaceMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ServiceInterfaceMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,59 +76,59 @@ public final static ServiceInterfaceMapping _read(final XoXMLStreamReader reader context = new RuntimeContext(); } - final ServiceInterfaceMapping serviceInterfaceMapping = new ServiceInterfaceMapping(); + ServiceInterfaceMapping serviceInterfaceMapping = new ServiceInterfaceMapping(); context.beforeUnmarshal(serviceInterfaceMapping, LifecycleCallback.NONE); List portMapping = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("service-interface-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("service-interface-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ServiceInterfaceMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, serviceInterfaceMapping); serviceInterfaceMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("service-interface" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceInterface - final String serviceInterfaceRaw = elementReader.getElementAsString(); + String serviceInterfaceRaw = elementReader.getElementText(); - final String serviceInterface; + String serviceInterface; try { serviceInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } serviceInterfaceMapping.serviceInterface = serviceInterface; - } else if (("wsdl-service-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-service-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlServiceName - final QName wsdlServiceName = elementReader.getElementAsQName(); + QName wsdlServiceName = elementReader.getElementAsQName(); serviceInterfaceMapping.wsdlServiceName = wsdlServiceName; - } else if (("port-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("port-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: portMapping - final PortMapping portMappingItem = readPortMapping(elementReader, context); + PortMapping portMappingItem = readPortMapping(elementReader, context); if (portMapping == null) { portMapping = serviceInterfaceMapping.portMapping; - if (portMapping != null) { + if (portMapping!= null) { portMapping.clear(); } else { - portMapping = new ArrayList(); + portMapping = new ArrayList<>(); } } portMapping.add(portMappingItem); @@ -130,7 +136,7 @@ public final static ServiceInterfaceMapping _read(final XoXMLStreamReader reader context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "service-interface"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-service-name"), new QName("http://java.sun.com/xml/ns/javaee", "port-mapping")); } } - if (portMapping != null) { + if (portMapping!= null) { serviceInterfaceMapping.portMapping = portMapping; } @@ -139,52 +145,54 @@ public final static ServiceInterfaceMapping _read(final XoXMLStreamReader reader return serviceInterfaceMapping; } - public final ServiceInterfaceMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ServiceInterfaceMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ServiceInterfaceMapping serviceInterfaceMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ServiceInterfaceMapping serviceInterfaceMapping, RuntimeContext context) + throws Exception + { if (serviceInterfaceMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ServiceInterfaceMapping.class != serviceInterfaceMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ServiceInterfaceMapping.class!= serviceInterfaceMapping.getClass()) { context.unexpectedSubclass(writer, serviceInterfaceMapping, ServiceInterfaceMapping.class); - return; + return ; } context.beforeMarshal(serviceInterfaceMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = serviceInterfaceMapping.id; - if (idRaw != null) { + String idRaw = serviceInterfaceMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceInterfaceMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: serviceInterface - final String serviceInterfaceRaw = serviceInterfaceMapping.serviceInterface; + String serviceInterfaceRaw = serviceInterfaceMapping.serviceInterface; String serviceInterface = null; try { serviceInterface = Adapters.collapsedStringAdapterAdapter.marshal(serviceInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceInterfaceMapping, "serviceInterface", CollapsedStringAdapter.class, String.class, String.class, e); } - if (serviceInterface != null) { + if (serviceInterface!= null) { writer.writeStartElement(prefix, "service-interface", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(serviceInterface); writer.writeEndElement(); @@ -193,8 +201,8 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceInt } // ELEMENT: wsdlServiceName - final QName wsdlServiceName = serviceInterfaceMapping.wsdlServiceName; - if (wsdlServiceName != null) { + QName wsdlServiceName = serviceInterfaceMapping.wsdlServiceName; + if (wsdlServiceName!= null) { writer.writeStartElement(prefix, "wsdl-service-name", "http://java.sun.com/xml/ns/javaee"); writer.writeQName(wsdlServiceName); writer.writeEndElement(); @@ -203,10 +211,10 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceInt } // ELEMENT: portMapping - final List portMapping = serviceInterfaceMapping.portMapping; - if (portMapping != null) { - for (final PortMapping portMappingItem : portMapping) { - if (portMappingItem != null) { + List portMapping = serviceInterfaceMapping.portMapping; + if (portMapping!= null) { + for (PortMapping portMappingItem: portMapping) { + if (portMappingItem!= null) { writer.writeStartElement(prefix, "port-mapping", "http://java.sun.com/xml/ns/javaee"); writePortMapping(writer, portMappingItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceRef$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceRef$JAXB.java index ede0d1f2dda..4576940c01b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceRef$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServiceRef$JAXB.java @@ -1,21 +1,29 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,13 +31,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; import static org.apache.openejb.jee.Handler$JAXB.readHandler; import static org.apache.openejb.jee.Handler$JAXB.writeHandler; @@ -48,30 +49,35 @@ "StringEquality" }) public class ServiceRef$JAXB - extends JAXBObject { + extends JAXBObject +{ public ServiceRef$JAXB() { super(ServiceRef.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "service-refType".intern()), Text$JAXB.class, Icon$JAXB.class, PortComponentRef$JAXB.class, Handler$JAXB.class, HandlerChains$JAXB.class, InjectionTarget$JAXB.class); } - public static ServiceRef readServiceRef(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ServiceRef readServiceRef(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeServiceRef(final XoXMLStreamWriter writer, final ServiceRef serviceRef, final RuntimeContext context) - throws Exception { + public static void writeServiceRef(XoXMLStreamWriter writer, ServiceRef serviceRef, RuntimeContext context) + throws Exception + { _write(writer, serviceRef, context); } - public void write(final XoXMLStreamWriter writer, final ServiceRef serviceRef, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ServiceRef serviceRef, RuntimeContext context) + throws Exception + { _write(writer, serviceRef, context); } - public final static ServiceRef _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ServiceRef _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -82,7 +88,7 @@ public final static ServiceRef _read(final XoXMLStreamReader reader, RuntimeCont context = new RuntimeContext(); } - final ServiceRef serviceRef = new ServiceRef(); + ServiceRef serviceRef = new ServiceRef(); context.beforeUnmarshal(serviceRef, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -93,183 +99,183 @@ public final static ServiceRef _read(final XoXMLStreamReader reader, RuntimeCont Set injectionTarget = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("service-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("service-refType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ServiceRef.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, serviceRef); serviceRef.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = serviceRef.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("service-ref-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-ref-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceRefName - final String serviceRefNameRaw = elementReader.getElementAsString(); + String serviceRefNameRaw = elementReader.getElementText(); - final String serviceRefName; + String serviceRefName; try { serviceRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } serviceRef.serviceRefName = serviceRefName; - } else if (("service-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-interface" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceInterface - final String serviceInterfaceRaw = elementReader.getElementAsString(); + String serviceInterfaceRaw = elementReader.getElementText(); - final String serviceInterface; + String serviceInterface; try { serviceInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } serviceRef.serviceInterface = serviceInterface; - } else if (("service-ref-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-ref-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceRefType - final String serviceRefTypeRaw = elementReader.getElementAsString(); + String serviceRefTypeRaw = elementReader.getElementText(); - final String serviceRefType; + String serviceRefType; try { serviceRefType = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceRefTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } serviceRef.serviceRefType = serviceRefType; - } else if (("wsdl-file" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-file" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlFile - final String wsdlFileRaw = elementReader.getElementAsString(); + String wsdlFileRaw = elementReader.getElementText(); - final String wsdlFile; + String wsdlFile; try { wsdlFile = Adapters.collapsedStringAdapterAdapter.unmarshal(wsdlFileRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } serviceRef.wsdlFile = wsdlFile; - } else if (("jaxrpc-mapping-file" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("jaxrpc-mapping-file" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: jaxrpcMappingFile - final String jaxrpcMappingFileRaw = elementReader.getElementAsString(); + String jaxrpcMappingFileRaw = elementReader.getElementText(); - final String jaxrpcMappingFile; + String jaxrpcMappingFile; try { jaxrpcMappingFile = Adapters.collapsedStringAdapterAdapter.unmarshal(jaxrpcMappingFileRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } serviceRef.jaxrpcMappingFile = jaxrpcMappingFile; - } else if (("service-qname" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-qname" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceQname - final QName serviceQname = elementReader.getElementAsQName(); + QName serviceQname = elementReader.getElementAsQName(); serviceRef.serviceQname = serviceQname; - } else if (("port-component-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("port-component-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: portComponentRef - final PortComponentRef portComponentRefItem = readPortComponentRef(elementReader, context); + PortComponentRef portComponentRefItem = readPortComponentRef(elementReader, context); if (portComponentRef == null) { portComponentRef = serviceRef.portComponentRef; - if (portComponentRef != null) { + if (portComponentRef!= null) { portComponentRef.clear(); } else { - portComponentRef = new ArrayList(); + portComponentRef = new ArrayList<>(); } } portComponentRef.add(portComponentRefItem); - } else if (("handler" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("handler" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: handler - final Handler handlerItem = readHandler(elementReader, context); + Handler handlerItem = readHandler(elementReader, context); if (handler == null) { handler = serviceRef.handler; - if (handler != null) { + if (handler!= null) { handler.clear(); } else { - handler = new ArrayList(); + handler = new ArrayList<>(); } } handler.add(handlerItem); - } else if (("handler-chains" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("handler-chains" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: handlerChains - final HandlerChains handlerChains = readHandlerChains(elementReader, context); + HandlerChains handlerChains = readHandlerChains(elementReader, context); serviceRef.handlerChains = handlerChains; - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } serviceRef.mappedName = mappedName; - } else if (("injection-target" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("injection-target" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: injectionTarget - final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); + InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context); if (injectionTarget == null) { injectionTarget = serviceRef.injectionTarget; - if (injectionTarget != null) { + if (injectionTarget!= null) { injectionTarget.clear(); } else { - injectionTarget = new LinkedHashSet(); + injectionTarget = new LinkedHashSet<>(); } } injectionTarget.add(injectionTargetItem); - } else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("lookup-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: lookupName - final String lookupNameRaw = elementReader.getElementAsString(); + String lookupNameRaw = elementReader.getElementText(); - final String lookupName; + String lookupName; try { lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -279,30 +285,30 @@ public final static ServiceRef _read(final XoXMLStreamReader reader, RuntimeCont 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", "service-ref-name"), new QName("http://java.sun.com/xml/ns/javaee", "service-interface"), new QName("http://java.sun.com/xml/ns/javaee", "service-ref-type"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-file"), new QName("http://java.sun.com/xml/ns/javaee", "jaxrpc-mapping-file"), new QName("http://java.sun.com/xml/ns/javaee", "service-qname"), new QName("http://java.sun.com/xml/ns/javaee", "port-component-ref"), new QName("http://java.sun.com/xml/ns/javaee", "handler"), new QName("http://java.sun.com/xml/ns/javaee", "handler-chains"), 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) { + if (descriptions!= null) { try { - serviceRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + serviceRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, ServiceRef.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - serviceRef.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + serviceRef.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, ServiceRef.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { serviceRef.icon = icon; } - if (portComponentRef != null) { + if (portComponentRef!= null) { serviceRef.portComponentRef = portComponentRef; } - if (handler != null) { + if (handler!= null) { serviceRef.handler = handler; } - if (injectionTarget != null) { + if (injectionTarget!= null) { serviceRef.injectionTarget = injectionTarget; } @@ -311,38 +317,40 @@ public final static ServiceRef _read(final XoXMLStreamReader reader, RuntimeCont return serviceRef; } - public final ServiceRef read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ServiceRef read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ServiceRef serviceRef, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ServiceRef serviceRef, RuntimeContext context) + throws Exception + { if (serviceRef == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ServiceRef.class != serviceRef.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ServiceRef.class!= serviceRef.getClass()) { context.unexpectedSubclass(writer, serviceRef, ServiceRef.class); - return; + return ; } context.beforeMarshal(serviceRef, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = serviceRef.id; - if (idRaw != null) { + String idRaw = serviceRef.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceRef, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -352,12 +360,12 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceRef Text[] descriptions = null; try { descriptions = serviceRef.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(serviceRef, "descriptions", ServiceRef.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -371,12 +379,12 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceRef Text[] displayNames = null; try { displayNames = serviceRef.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(serviceRef, "displayNames", ServiceRef.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -387,10 +395,10 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceRef } // ELEMENT: icon - final LocalCollection icon = serviceRef.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = serviceRef.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -401,14 +409,14 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceRef } // ELEMENT: serviceRefName - final String serviceRefNameRaw = serviceRef.serviceRefName; + String serviceRefNameRaw = serviceRef.serviceRefName; String serviceRefName = null; try { serviceRefName = Adapters.collapsedStringAdapterAdapter.marshal(serviceRefNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceRef, "serviceRefName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (serviceRefName != null) { + if (serviceRefName!= null) { writer.writeStartElement(prefix, "service-ref-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(serviceRefName); writer.writeEndElement(); @@ -417,14 +425,14 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceRef } // ELEMENT: serviceInterface - final String serviceInterfaceRaw = serviceRef.serviceInterface; + String serviceInterfaceRaw = serviceRef.serviceInterface; String serviceInterface = null; try { serviceInterface = Adapters.collapsedStringAdapterAdapter.marshal(serviceInterfaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceRef, "serviceInterface", CollapsedStringAdapter.class, String.class, String.class, e); } - if (serviceInterface != null) { + if (serviceInterface!= null) { writer.writeStartElement(prefix, "service-interface", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(serviceInterface); writer.writeEndElement(); @@ -433,60 +441,60 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceRef } // ELEMENT: serviceRefType - final String serviceRefTypeRaw = serviceRef.serviceRefType; + String serviceRefTypeRaw = serviceRef.serviceRefType; String serviceRefType = null; try { serviceRefType = Adapters.collapsedStringAdapterAdapter.marshal(serviceRefTypeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceRef, "serviceRefType", CollapsedStringAdapter.class, String.class, String.class, e); } - if (serviceRefType != null) { + 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 wsdlFileRaw = serviceRef.wsdlFile; String wsdlFile = null; try { wsdlFile = Adapters.collapsedStringAdapterAdapter.marshal(wsdlFileRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceRef, "wsdlFile", CollapsedStringAdapter.class, String.class, String.class, e); } - if (wsdlFile != null) { + 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 jaxrpcMappingFileRaw = serviceRef.jaxrpcMappingFile; String jaxrpcMappingFile = null; try { jaxrpcMappingFile = Adapters.collapsedStringAdapterAdapter.marshal(jaxrpcMappingFileRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceRef, "jaxrpcMappingFile", CollapsedStringAdapter.class, String.class, String.class, e); } - if (jaxrpcMappingFile != null) { + 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) { + 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 = serviceRef.portComponentRef; - if (portComponentRef != null) { - for (final PortComponentRef portComponentRefItem : portComponentRef) { - if (portComponentRefItem != null) { + List portComponentRef = serviceRef.portComponentRef; + if (portComponentRef!= null) { + for (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(); @@ -497,10 +505,10 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceRef } // ELEMENT: handler - final List handler = serviceRef.handler; - if (handler != null) { - for (final Handler handlerItem : handler) { - if (handlerItem != null) { + List handler = serviceRef.handler; + if (handler!= null) { + for (Handler handlerItem: handler) { + if (handlerItem!= null) { writer.writeStartElement(prefix, "handler", "http://java.sun.com/xml/ns/javaee"); writeHandler(writer, handlerItem, context); writer.writeEndElement(); @@ -511,32 +519,32 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceRef } // ELEMENT: handlerChains - final HandlerChains handlerChains = serviceRef.handlerChains; - if (handlerChains != null) { + 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 mappedNameRaw = serviceRef.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + 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 = serviceRef.injectionTarget; - if (injectionTarget != null) { - for (final InjectionTarget injectionTargetItem : injectionTarget) { - if (injectionTargetItem != null) { + Set injectionTarget = serviceRef.injectionTarget; + if (injectionTarget!= null) { + for (InjectionTarget injectionTargetItem: injectionTarget) { + if (injectionTargetItem!= null) { writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee"); writeInjectionTarget(writer, injectionTargetItem, context); writer.writeEndElement(); @@ -547,14 +555,14 @@ public final static void _write(final XoXMLStreamWriter writer, final ServiceRef } // ELEMENT: lookupName - final String lookupNameRaw = serviceRef.lookupName; + String lookupNameRaw = serviceRef.lookupName; String lookupName = null; try { lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(serviceRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (lookupName != null) { + if (lookupName!= null) { writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(lookupName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Servlet$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Servlet$JAXB.java index 4d54cda2c4a..aadda354175 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Servlet$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Servlet$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -46,30 +47,35 @@ "StringEquality" }) public class Servlet$JAXB - extends JAXBObject { + extends JAXBObject +{ public Servlet$JAXB() { super(Servlet.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "servletType".intern()), Text$JAXB.class, Icon$JAXB.class, ParamValue$JAXB.class, RunAs$JAXB.class, SecurityRoleRef$JAXB.class, MultipartConfig$JAXB.class); } - public static Servlet readServlet(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Servlet readServlet(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeServlet(final XoXMLStreamWriter writer, final Servlet servlet, final RuntimeContext context) - throws Exception { + public static void writeServlet(XoXMLStreamWriter writer, Servlet servlet, RuntimeContext context) + throws Exception + { _write(writer, servlet, context); } - public void write(final XoXMLStreamWriter writer, final Servlet servlet, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Servlet servlet, RuntimeContext context) + throws Exception + { _write(writer, servlet, context); } - public final static Servlet _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Servlet _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -80,7 +86,7 @@ public final static Servlet _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final Servlet servlet = new Servlet(); + Servlet servlet = new Servlet(); context.beforeUnmarshal(servlet, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -90,170 +96,170 @@ public final static Servlet _read(final XoXMLStreamReader reader, RuntimeContext List securityRoleRef = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("servletType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("servletType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Servlet.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, servlet); servlet.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = servlet.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("servlet-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("servlet-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: servletName - final String servletNameRaw = elementReader.getElementAsString(); + String servletNameRaw = elementReader.getElementText(); - final String servletName; + String servletName; try { servletName = Adapters.collapsedStringAdapterAdapter.unmarshal(servletNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } servlet.servletName = servletName; - } else if (("servlet-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("servlet-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: servletClass - final String servletClassRaw = elementReader.getElementAsString(); + String servletClassRaw = elementReader.getElementText(); - final String servletClass; + String servletClass; try { servletClass = Adapters.collapsedStringAdapterAdapter.unmarshal(servletClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } servlet.servletClass = servletClass; - } else if (("jsp-file" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("jsp-file" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: jspFile - final String jspFileRaw = elementReader.getElementAsString(); + String jspFileRaw = elementReader.getElementText(); - final String jspFile; + String jspFile; try { jspFile = Adapters.collapsedStringAdapterAdapter.unmarshal(jspFileRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } servlet.jspFile = jspFile; - } else if (("init-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("init-param" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: initParam - final ParamValue initParamItem = readParamValue(elementReader, context); + ParamValue initParamItem = readParamValue(elementReader, context); if (initParam == null) { initParam = servlet.initParam; - if (initParam != null) { + if (initParam!= null) { initParam.clear(); } else { - initParam = new ArrayList(); + initParam = new ArrayList<>(); } } initParam.add(initParamItem); - } else if (("load-on-startup" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("load-on-startup" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: loadOnStartup - final String loadOnStartupRaw = elementReader.getElementAsString(); + String loadOnStartupRaw = elementReader.getElementText(); - final Integer loadOnStartup; + Integer loadOnStartup; try { loadOnStartup = Adapters.loadOnStartupAdapterAdapter.unmarshal(loadOnStartupRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, LoadOnStartupAdapter.class, Integer.class, Integer.class, e); continue; } servlet.loadOnStartup = loadOnStartup; - } else if (("enabled" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("enabled" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: enabled - final Boolean enabled = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean enabled = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); servlet.enabled = enabled; - } else if (("async-supported" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("async-supported" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: asyncSupported - final Boolean asyncSupported = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean asyncSupported = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); servlet.asyncSupported = asyncSupported; - } else if (("run-as" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("run-as" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: runAs - final RunAs runAs = readRunAs(elementReader, context); + RunAs runAs = readRunAs(elementReader, context); servlet.runAs = runAs; - } else if (("security-role-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("security-role-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityRoleRef - final SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); + SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); if (securityRoleRef == null) { securityRoleRef = servlet.securityRoleRef; - if (securityRoleRef != null) { + if (securityRoleRef!= null) { securityRoleRef.clear(); } else { - securityRoleRef = new ArrayList(); + securityRoleRef = new ArrayList<>(); } } securityRoleRef.add(securityRoleRefItem); - } else if (("multipart-config" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("multipart-config" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: multipartConfig - final MultipartConfig multipartConfig = readMultipartConfig(elementReader, context); + MultipartConfig multipartConfig = readMultipartConfig(elementReader, context); servlet.multipartConfig = multipartConfig; } 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", "servlet-name"), new QName("http://java.sun.com/xml/ns/javaee", "servlet-class"), new QName("http://java.sun.com/xml/ns/javaee", "jsp-file"), new QName("http://java.sun.com/xml/ns/javaee", "init-param"), new QName("http://java.sun.com/xml/ns/javaee", "load-on-startup"), new QName("http://java.sun.com/xml/ns/javaee", "enabled"), new QName("http://java.sun.com/xml/ns/javaee", "async-supported"), new QName("http://java.sun.com/xml/ns/javaee", "run-as"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "multipart-config")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - servlet.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + servlet.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Servlet.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - servlet.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + servlet.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, Servlet.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { servlet.icon = icon; } - if (initParam != null) { + if (initParam!= null) { servlet.initParam = initParam; } - if (securityRoleRef != null) { + if (securityRoleRef!= null) { servlet.securityRoleRef = securityRoleRef; } @@ -262,38 +268,40 @@ public final static Servlet _read(final XoXMLStreamReader reader, RuntimeContext return servlet; } - public final Servlet read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Servlet read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Servlet servlet, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Servlet servlet, RuntimeContext context) + throws Exception + { if (servlet == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Servlet.class != servlet.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Servlet.class!= servlet.getClass()) { context.unexpectedSubclass(writer, servlet, Servlet.class); - return; + return ; } context.beforeMarshal(servlet, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = servlet.id; - if (idRaw != null) { + String idRaw = servlet.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(servlet, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -303,12 +311,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Servlet se Text[] descriptions = null; try { descriptions = servlet.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(servlet, "descriptions", Servlet.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -322,12 +330,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Servlet se Text[] displayNames = null; try { displayNames = servlet.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(servlet, "displayNames", Servlet.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -338,10 +346,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Servlet se } // ELEMENT: icon - final LocalCollection icon = servlet.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = servlet.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -352,14 +360,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Servlet se } // ELEMENT: servletName - final String servletNameRaw = servlet.servletName; + String servletNameRaw = servlet.servletName; String servletName = null; try { servletName = Adapters.collapsedStringAdapterAdapter.marshal(servletNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(servlet, "servletName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (servletName != null) { + if (servletName!= null) { writer.writeStartElement(prefix, "servlet-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(servletName); writer.writeEndElement(); @@ -368,38 +376,38 @@ public final static void _write(final XoXMLStreamWriter writer, final Servlet se } // ELEMENT: servletClass - final String servletClassRaw = servlet.servletClass; + String servletClassRaw = servlet.servletClass; String servletClass = null; try { servletClass = Adapters.collapsedStringAdapterAdapter.marshal(servletClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(servlet, "servletClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (servletClass != null) { + if (servletClass!= null) { writer.writeStartElement(prefix, "servlet-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(servletClass); writer.writeEndElement(); } // ELEMENT: jspFile - final String jspFileRaw = servlet.jspFile; + String jspFileRaw = servlet.jspFile; String jspFile = null; try { jspFile = Adapters.collapsedStringAdapterAdapter.marshal(jspFileRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(servlet, "jspFile", CollapsedStringAdapter.class, String.class, String.class, e); } - if (jspFile != null) { + if (jspFile!= null) { writer.writeStartElement(prefix, "jsp-file", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(jspFile); writer.writeEndElement(); } // ELEMENT: initParam - final List initParam = servlet.initParam; - if (initParam != null) { - for (final ParamValue initParamItem : initParam) { - if (initParamItem != null) { + List initParam = servlet.initParam; + if (initParam!= null) { + for (ParamValue initParamItem: initParam) { + if (initParamItem!= null) { writer.writeStartElement(prefix, "init-param", "http://java.sun.com/xml/ns/javaee"); writeParamValue(writer, initParamItem, context); writer.writeEndElement(); @@ -408,48 +416,48 @@ public final static void _write(final XoXMLStreamWriter writer, final Servlet se } // ELEMENT: loadOnStartup - final Integer loadOnStartupRaw = servlet.loadOnStartup; + Integer loadOnStartupRaw = servlet.loadOnStartup; String loadOnStartup = null; try { loadOnStartup = Adapters.loadOnStartupAdapterAdapter.marshal(loadOnStartupRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(servlet, "loadOnStartup", LoadOnStartupAdapter.class, Integer.class, Integer.class, e); } - if (loadOnStartup != null) { + if (loadOnStartup!= null) { writer.writeStartElement(prefix, "load-on-startup", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(loadOnStartup); writer.writeEndElement(); } // ELEMENT: enabled - final Boolean enabled = servlet.enabled; - if (enabled != null) { + Boolean enabled = servlet.enabled; + if (enabled!= null) { writer.writeStartElement(prefix, "enabled", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(enabled)); writer.writeEndElement(); } // ELEMENT: asyncSupported - final Boolean asyncSupported = servlet.asyncSupported; - if (asyncSupported != null) { + Boolean asyncSupported = servlet.asyncSupported; + if (asyncSupported!= null) { writer.writeStartElement(prefix, "async-supported", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(asyncSupported)); writer.writeEndElement(); } // ELEMENT: runAs - final RunAs runAs = servlet.runAs; - if (runAs != null) { + RunAs runAs = servlet.runAs; + if (runAs!= null) { writer.writeStartElement(prefix, "run-as", "http://java.sun.com/xml/ns/javaee"); writeRunAs(writer, runAs, context); writer.writeEndElement(); } // ELEMENT: securityRoleRef - final List securityRoleRef = servlet.securityRoleRef; - if (securityRoleRef != null) { - for (final SecurityRoleRef securityRoleRefItem : securityRoleRef) { - if (securityRoleRefItem != null) { + List securityRoleRef = servlet.securityRoleRef; + if (securityRoleRef!= null) { + for (SecurityRoleRef securityRoleRefItem: securityRoleRef) { + if (securityRoleRefItem!= null) { writer.writeStartElement(prefix, "security-role-ref", "http://java.sun.com/xml/ns/javaee"); writeSecurityRoleRef(writer, securityRoleRefItem, context); writer.writeEndElement(); @@ -458,8 +466,8 @@ public final static void _write(final XoXMLStreamWriter writer, final Servlet se } // ELEMENT: multipartConfig - final MultipartConfig multipartConfig = servlet.multipartConfig; - if (multipartConfig != null) { + MultipartConfig multipartConfig = servlet.multipartConfig; + if (multipartConfig!= null) { writer.writeStartElement(prefix, "multipart-config", "http://java.sun.com/xml/ns/javaee"); writeMultipartConfig(writer, multipartConfig, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServletMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServletMapping$JAXB.java index 164a0da486e..99c96ab6c12 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServletMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ServletMapping$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class ServletMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public ServletMapping$JAXB() { super(ServletMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "servlet-mappingType".intern())); } - public static ServletMapping readServletMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static ServletMapping readServletMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeServletMapping(final XoXMLStreamWriter writer, final ServletMapping servletMapping, final RuntimeContext context) - throws Exception { + public static void writeServletMapping(XoXMLStreamWriter writer, ServletMapping servletMapping, RuntimeContext context) + throws Exception + { _write(writer, servletMapping, context); } - public void write(final XoXMLStreamWriter writer, final ServletMapping servletMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, ServletMapping servletMapping, RuntimeContext context) + throws Exception + { _write(writer, servletMapping, context); } - public final static ServletMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final ServletMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,64 +72,64 @@ public final static ServletMapping _read(final XoXMLStreamReader reader, Runtime context = new RuntimeContext(); } - final ServletMapping servletMapping = new ServletMapping(); + ServletMapping servletMapping = new ServletMapping(); context.beforeUnmarshal(servletMapping, LifecycleCallback.NONE); List urlPattern = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("servlet-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("servlet-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, ServletMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, servletMapping); servletMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("servlet-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("servlet-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: servletName - final String servletNameRaw = elementReader.getElementAsString(); + String servletNameRaw = elementReader.getElementText(); - final String servletName; + String servletName; try { servletName = Adapters.collapsedStringAdapterAdapter.unmarshal(servletNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } servletMapping.servletName = servletName; - } else if (("url-pattern" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("url-pattern" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: urlPattern - final String urlPatternItemRaw = elementReader.getElementAsString(); + String urlPatternItemRaw = elementReader.getElementText(); - final String urlPatternItem; + String urlPatternItem; try { urlPatternItem = Adapters.trimStringAdapterAdapter.unmarshal(urlPatternItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, TrimStringAdapter.class, String.class, String.class, e); continue; } if (urlPattern == null) { urlPattern = servletMapping.urlPattern; - if (urlPattern != null) { + if (urlPattern!= null) { urlPattern.clear(); } else { - urlPattern = new ArrayList(); + urlPattern = new ArrayList<>(); } } urlPattern.add(urlPatternItem); @@ -132,7 +137,7 @@ public final static ServletMapping _read(final XoXMLStreamReader reader, Runtime context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "servlet-name"), new QName("http://java.sun.com/xml/ns/javaee", "url-pattern")); } } - if (urlPattern != null) { + if (urlPattern!= null) { servletMapping.urlPattern = urlPattern; } @@ -141,52 +146,54 @@ public final static ServletMapping _read(final XoXMLStreamReader reader, Runtime return servletMapping; } - public final ServletMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final ServletMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final ServletMapping servletMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, ServletMapping servletMapping, RuntimeContext context) + throws Exception + { if (servletMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (ServletMapping.class != servletMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ServletMapping.class!= servletMapping.getClass()) { context.unexpectedSubclass(writer, servletMapping, ServletMapping.class); - return; + return ; } context.beforeMarshal(servletMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = servletMapping.id; - if (idRaw != null) { + String idRaw = servletMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(servletMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: servletName - final String servletNameRaw = servletMapping.servletName; + String servletNameRaw = servletMapping.servletName; String servletName = null; try { servletName = Adapters.collapsedStringAdapterAdapter.marshal(servletNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(servletMapping, "servletName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (servletName != null) { + if (servletName!= null) { writer.writeStartElement(prefix, "servlet-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(servletName); writer.writeEndElement(); @@ -195,16 +202,16 @@ public final static void _write(final XoXMLStreamWriter writer, final ServletMap } // ELEMENT: urlPattern - final List urlPatternRaw = servletMapping.urlPattern; - if (urlPatternRaw != null) { - for (final String urlPatternItem : urlPatternRaw) { + List urlPatternRaw = servletMapping.urlPattern; + if (urlPatternRaw!= null) { + for (String urlPatternItem: urlPatternRaw) { String urlPattern = null; try { urlPattern = Adapters.trimStringAdapterAdapter.marshal(urlPatternItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(servletMapping, "urlPattern", TrimStringAdapter.class, List.class, List.class, e); } - if (urlPattern != null) { + if (urlPattern!= null) { writer.writeStartElement(prefix, "url-pattern", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(urlPattern); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java index 9c93f527d6d..de906da569a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java @@ -1,36 +1,35 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; import static org.apache.openejb.jee.AroundInvoke$JAXB.readAroundInvoke; import static org.apache.openejb.jee.AroundInvoke$JAXB.writeAroundInvoke; @@ -42,6 +41,8 @@ import static org.apache.openejb.jee.ConcurrencyManagementType$JAXB.toStringConcurrencyManagementType; import static org.apache.openejb.jee.ConcurrentMethod$JAXB.readConcurrentMethod; import static org.apache.openejb.jee.ConcurrentMethod$JAXB.writeConcurrentMethod; +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; @@ -56,6 +57,10 @@ import static org.apache.openejb.jee.Icon$JAXB.writeIcon; import static org.apache.openejb.jee.InitMethod$JAXB.readInitMethod; import static org.apache.openejb.jee.InitMethod$JAXB.writeInitMethod; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback; import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef; @@ -93,42 +98,36 @@ "StringEquality" }) public class SessionBean$JAXB - extends JAXBObject { - - private static final Set sessionBeanClasses; - - static { - sessionBeanClasses = new HashSet(); - sessionBeanClasses.add("org.apache.openejb.jee.SessionBean"); - sessionBeanClasses.add("org.apache.openejb.jee.ManagedBean"); - sessionBeanClasses.add("org.apache.openejb.config.CompManagedBean"); - sessionBeanClasses.add("org.apache.openejb.jee.StatefulBean"); - sessionBeanClasses.add("org.apache.openejb.jee.StatelessBean"); - sessionBeanClasses.add("org.apache.openejb.jee.SingletonBean"); - - } + extends JAXBObject +{ + + private static final FieldAccessor> sessionBeanContextService = new FieldAccessor<>(SessionBean.class, "contextService"); public SessionBean$JAXB() { - super(SessionBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "session-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, SessionType$JAXB.class, Timeout$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, ConcurrencyManagementType$JAXB.class, ConcurrentMethod$JAXB.class, InitMethod$JAXB.class, RemoveMethod$JAXB.class, AsyncMethod$JAXB.class, TransactionType$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class); + super(SessionBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "session-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, SessionType$JAXB.class, Timeout$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, ConcurrencyManagementType$JAXB.class, ConcurrentMethod$JAXB.class, InitMethod$JAXB.class, RemoveMethod$JAXB.class, AsyncMethod$JAXB.class, TransactionType$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, ContextService$JAXB.class); } - public static SessionBean readSessionBean(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static SessionBean readSessionBean(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeSessionBean(final XoXMLStreamWriter writer, final SessionBean sessionBean, final RuntimeContext context) - throws Exception { + public static void writeSessionBean(XoXMLStreamWriter writer, SessionBean sessionBean, RuntimeContext context) + throws Exception + { _write(writer, sessionBean, context); } - public void write(final XoXMLStreamWriter writer, final SessionBean sessionBean, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, SessionBean sessionBean, RuntimeContext context) + throws Exception + { _write(writer, sessionBean, context); } - public final static SessionBean _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final SessionBean _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -139,7 +138,7 @@ public final static SessionBean _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final SessionBean sessionBean = new SessionBean(); + SessionBean sessionBean = new SessionBean(); context.beforeUnmarshal(sessionBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); ArrayList descriptions = null; @@ -166,701 +165,753 @@ public final static SessionBean _read(final XoXMLStreamReader reader, RuntimeCon List postConstruct = null; List preDestroy = null; KeyedCollection dataSource = null; + KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; List postActivate = null; List prePassivate = null; List securityRoleRef = null; + KeyedCollection contextService = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("session-beanType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("session-beanType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, SessionBean.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, sessionBean); sessionBean.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = sessionBean.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbName - final String ejbNameRaw = elementReader.getElementAsString(); + String ejbNameRaw = elementReader.getElementText(); - final String ejbName; + String ejbName; try { ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } sessionBean.ejbName = ejbName; - } else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mappedName - final String mappedNameRaw = elementReader.getElementAsString(); + String mappedNameRaw = elementReader.getElementText(); - final String mappedName; + String mappedName; try { mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } sessionBean.mappedName = mappedName; - } else if (("home" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: home - final String homeRaw = elementReader.getElementAsString(); + String homeRaw = elementReader.getElementText(); - final String home; + String home; try { home = Adapters.collapsedStringAdapterAdapter.unmarshal(homeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } sessionBean.home = home; - } else if (("remote" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: remote - final String remoteRaw = elementReader.getElementAsString(); + String remoteRaw = elementReader.getElementText(); - final String remote; + String remote; try { remote = Adapters.collapsedStringAdapterAdapter.unmarshal(remoteRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } sessionBean.remote = remote; - } else if (("local-home" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("local-home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: localHome - final String localHomeRaw = elementReader.getElementAsString(); + String localHomeRaw = elementReader.getElementText(); - final String localHome; + String localHome; try { localHome = Adapters.collapsedStringAdapterAdapter.unmarshal(localHomeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } sessionBean.localHome = localHome; - } else if (("local" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: local - final String localRaw = elementReader.getElementAsString(); + String localRaw = elementReader.getElementText(); - final String local; + String local; try { local = Adapters.collapsedStringAdapterAdapter.unmarshal(localRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } sessionBean.local = local; - } else if (("business-local" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("business-local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: businessLocal - final String businessLocalItemRaw = elementReader.getElementAsString(); + String businessLocalItemRaw = elementReader.getElementText(); - final String businessLocalItem; + String businessLocalItem; try { businessLocalItem = Adapters.collapsedStringAdapterAdapter.unmarshal(businessLocalItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (businessLocal == null) { businessLocal = sessionBean.businessLocal; - if (businessLocal != null) { + if (businessLocal!= null) { businessLocal.clear(); } else { - businessLocal = new LinkedHashSet(); + businessLocal = new LinkedHashSet<>(); } } businessLocal.add(businessLocalItem); - } else if (("business-remote" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("business-remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: businessRemote - final String businessRemoteItemRaw = elementReader.getElementAsString(); + String businessRemoteItemRaw = elementReader.getElementText(); - final String businessRemoteItem; + String businessRemoteItem; try { businessRemoteItem = Adapters.collapsedStringAdapterAdapter.unmarshal(businessRemoteItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (businessRemote == null) { businessRemote = sessionBean.businessRemote; - if (businessRemote != null) { + if (businessRemote!= null) { businessRemote.clear(); } else { - businessRemote = new LinkedHashSet(); + businessRemote = new LinkedHashSet<>(); } } businessRemote.add(businessRemoteItem); - } else if (("local-bean" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("local-bean" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: localBean - final Empty localBean = readEmpty(elementReader, context); + Empty localBean = readEmpty(elementReader, context); sessionBean.localBean = localBean; - } else if (("service-endpoint" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-endpoint" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceEndpoint - final String serviceEndpointRaw = elementReader.getElementAsString(); + String serviceEndpointRaw = elementReader.getElementText(); - final String serviceEndpoint; + String serviceEndpoint; try { serviceEndpoint = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceEndpointRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } sessionBean.serviceEndpoint = serviceEndpoint; - } else if (("ejb-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbClass - final String ejbClassRaw = elementReader.getElementAsString(); + String ejbClassRaw = elementReader.getElementText(); - final String ejbClass; + String ejbClass; try { ejbClass = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } sessionBean.ejbClass = ejbClass; - } else if (("session-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("session-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: sessionType - final SessionType sessionType = parseSessionType(elementReader, context, elementReader.getElementAsString()); - if (sessionType != null) { + SessionType sessionType = parseSessionType(elementReader, context, elementReader.getElementText()); + if (sessionType!= null) { sessionBean.sessionType = sessionType; } - } else if (("stateful-timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("stateful-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: statefulTimeout - final Timeout statefulTimeout = readTimeout(elementReader, context); + Timeout statefulTimeout = readTimeout(elementReader, context); sessionBean.statefulTimeout = statefulTimeout; - } else if (("timeout-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("timeout-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: timeoutMethod - final NamedMethod timeoutMethod = readNamedMethod(elementReader, context); + NamedMethod timeoutMethod = readNamedMethod(elementReader, context); sessionBean.timeoutMethod = timeoutMethod; - } else if (("timer" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("timer" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: timer - final Timer timerItem = readTimer(elementReader, context); + Timer timerItem = readTimer(elementReader, context); if (timer == null) { timer = sessionBean.timer; - if (timer != null) { + if (timer!= null) { timer.clear(); } else { - timer = new ArrayList(); + timer = new ArrayList<>(); } } timer.add(timerItem); - } else if (("init-on-startup" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("init-on-startup" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: initOnStartup - final Boolean initOnStartup = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); + Boolean initOnStartup = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); sessionBean.initOnStartup = initOnStartup; - } else if (("concurrency-management-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("concurrency-management-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: concurrencyManagementType - final ConcurrencyManagementType concurrencyManagementType = parseConcurrencyManagementType(elementReader, context, elementReader.getElementAsString()); - if (concurrencyManagementType != null) { + ConcurrencyManagementType concurrencyManagementType = parseConcurrencyManagementType(elementReader, context, elementReader.getElementText()); + if (concurrencyManagementType!= null) { sessionBean.concurrencyManagementType = concurrencyManagementType; } - } else if (("concurrent-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("concurrent-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: concurrentMethod - final ConcurrentMethod concurrentMethodItem = readConcurrentMethod(elementReader, context); + ConcurrentMethod concurrentMethodItem = readConcurrentMethod(elementReader, context); if (concurrentMethod == null) { concurrentMethod = sessionBean.concurrentMethod; - if (concurrentMethod != null) { + if (concurrentMethod!= null) { concurrentMethod.clear(); } else { - concurrentMethod = new ArrayList(); + concurrentMethod = new ArrayList<>(); } } concurrentMethod.add(concurrentMethodItem); - } else if (("depends-on" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("depends-on" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT WRAPPER: dependsOn _readDependsOn(elementReader, context, sessionBean); - } else if (("init-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("init-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: initMethod - final InitMethod initMethodItem = readInitMethod(elementReader, context); + InitMethod initMethodItem = readInitMethod(elementReader, context); if (initMethod == null) { initMethod = sessionBean.initMethod; - if (initMethod != null) { + if (initMethod!= null) { initMethod.clear(); } else { - initMethod = new ArrayList(); + initMethod = new ArrayList<>(); } } initMethod.add(initMethodItem); - } else if (("remove-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("remove-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: removeMethod - final RemoveMethod removeMethodItem = readRemoveMethod(elementReader, context); + RemoveMethod removeMethodItem = readRemoveMethod(elementReader, context); if (removeMethod == null) { removeMethod = sessionBean.removeMethod; - if (removeMethod != null) { + if (removeMethod!= null) { removeMethod.clear(); } else { - removeMethod = new ArrayList(); + removeMethod = new ArrayList<>(); } } removeMethod.add(removeMethodItem); - } else if (("async-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("async-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: asyncMethod - final AsyncMethod asyncMethodItem = readAsyncMethod(elementReader, context); + AsyncMethod asyncMethodItem = readAsyncMethod(elementReader, context); if (asyncMethod == null) { asyncMethod = sessionBean.asyncMethod; - if (asyncMethod != null) { + if (asyncMethod!= null) { asyncMethod.clear(); } else { - asyncMethod = new ArrayList(); + asyncMethod = new ArrayList<>(); } } asyncMethod.add(asyncMethodItem); - } else if (("transaction-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("transaction-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: transactionType - final TransactionType transactionType = parseTransactionType(elementReader, context, elementReader.getElementAsString()); - if (transactionType != null) { + TransactionType transactionType = parseTransactionType(elementReader, context, elementReader.getElementText()); + if (transactionType!= null) { sessionBean.transactionType = transactionType; } - } else if (("after-begin-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("after-begin-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: afterBeginMethod - final NamedMethod afterBeginMethod = readNamedMethod(elementReader, context); + NamedMethod afterBeginMethod = readNamedMethod(elementReader, context); try { sessionBean.setAfterBeginMethod(afterBeginMethod); - } catch (final Exception e) { + } catch (Exception e) { context.setterError(reader, SessionBean.class, "setAfterBeginMethod", NamedMethod.class, e); } - } else if (("before-completion-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("before-completion-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: beforeCompletionMethod - final NamedMethod beforeCompletionMethod = readNamedMethod(elementReader, context); + NamedMethod beforeCompletionMethod = readNamedMethod(elementReader, context); try { sessionBean.setBeforeCompletionMethod(beforeCompletionMethod); - } catch (final Exception e) { + } catch (Exception e) { context.setterError(reader, SessionBean.class, "setBeforeCompletionMethod", NamedMethod.class, e); } - } else if (("after-completion-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("after-completion-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: afterCompletionMethod - final NamedMethod afterCompletionMethod = readNamedMethod(elementReader, context); + NamedMethod afterCompletionMethod = readNamedMethod(elementReader, context); try { sessionBean.setAfterCompletionMethod(afterCompletionMethod); - } catch (final Exception e) { + } catch (Exception e) { context.setterError(reader, SessionBean.class, "setAfterCompletionMethod", NamedMethod.class, e); } - } else if (("around-invoke" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("around-invoke" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: aroundInvoke - final AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context); + AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context); if (aroundInvoke == null) { aroundInvoke = sessionBean.aroundInvoke; - if (aroundInvoke != null) { + if (aroundInvoke!= null) { aroundInvoke.clear(); } else { - aroundInvoke = new ArrayList(); + aroundInvoke = new ArrayList<>(); } } aroundInvoke.add(aroundInvokeItem); - } else if (("around-timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("around-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: aroundTimeout - final AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context); + AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context); if (aroundTimeout == null) { aroundTimeout = sessionBean.aroundTimeout; - if (aroundTimeout != null) { + if (aroundTimeout!= null) { aroundTimeout.clear(); } else { - aroundTimeout = new ArrayList(); + aroundTimeout = new ArrayList<>(); } } aroundTimeout.add(aroundTimeoutItem); - } else if (("env-entry" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: envEntry - final EnvEntry envEntryItem = readEnvEntry(elementReader, context); + EnvEntry envEntryItem = readEnvEntry(elementReader, context); if (envEntry == null) { envEntry = sessionBean.envEntry; - if (envEntry != null) { + if (envEntry!= null) { envEntry.clear(); } else { - envEntry = new KeyedCollection(); + envEntry = new KeyedCollection<>(); } } envEntry.add(envEntryItem); - } else if (("ejb-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRef - final EjbRef ejbRefItem = readEjbRef(elementReader, context); + EjbRef ejbRefItem = readEjbRef(elementReader, context); if (ejbRef == null) { ejbRef = sessionBean.ejbRef; - if (ejbRef != null) { + if (ejbRef!= null) { ejbRef.clear(); } else { - ejbRef = new KeyedCollection(); + ejbRef = new KeyedCollection<>(); } } ejbRef.add(ejbRefItem); - } else if (("ejb-local-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbLocalRef - final EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); if (ejbLocalRef == null) { ejbLocalRef = sessionBean.ejbLocalRef; - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { ejbLocalRef.clear(); } else { - ejbLocalRef = new KeyedCollection(); + ejbLocalRef = new KeyedCollection<>(); } } ejbLocalRef.add(ejbLocalRefItem); - } else if (("service-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceRef - final ServiceRef serviceRefItem = readServiceRef(elementReader, context); + ServiceRef serviceRefItem = readServiceRef(elementReader, context); if (serviceRef == null) { serviceRef = sessionBean.serviceRef; - if (serviceRef != null) { + if (serviceRef!= null) { serviceRef.clear(); } else { - serviceRef = new KeyedCollection(); + serviceRef = new KeyedCollection<>(); } } serviceRef.add(serviceRefItem); - } else if (("resource-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceRef - final ResourceRef resourceRefItem = readResourceRef(elementReader, context); + ResourceRef resourceRefItem = readResourceRef(elementReader, context); if (resourceRef == null) { resourceRef = sessionBean.resourceRef; - if (resourceRef != null) { + if (resourceRef!= null) { resourceRef.clear(); } else { - resourceRef = new KeyedCollection(); + resourceRef = new KeyedCollection<>(); } } resourceRef.add(resourceRefItem); - } else if (("resource-env-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceEnvRef - final ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); if (resourceEnvRef == null) { resourceEnvRef = sessionBean.resourceEnvRef; - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { resourceEnvRef.clear(); } else { - resourceEnvRef = new KeyedCollection(); + resourceEnvRef = new KeyedCollection<>(); } } resourceEnvRef.add(resourceEnvRefItem); - } else if (("message-destination-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationRef - final MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); if (messageDestinationRef == null) { messageDestinationRef = sessionBean.messageDestinationRef; - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { messageDestinationRef.clear(); } else { - messageDestinationRef = new KeyedCollection(); + messageDestinationRef = new KeyedCollection<>(); } } messageDestinationRef.add(messageDestinationRefItem); - } else if (("persistence-context-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceContextRef - final PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); if (persistenceContextRef == null) { persistenceContextRef = sessionBean.persistenceContextRef; - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { persistenceContextRef.clear(); } else { - persistenceContextRef = new KeyedCollection(); + persistenceContextRef = new KeyedCollection<>(); } } persistenceContextRef.add(persistenceContextRefItem); - } else if (("persistence-unit-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceUnitRef - final PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); if (persistenceUnitRef == null) { persistenceUnitRef = sessionBean.persistenceUnitRef; - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { persistenceUnitRef.clear(); } else { - persistenceUnitRef = new KeyedCollection(); + persistenceUnitRef = new KeyedCollection<>(); } } persistenceUnitRef.add(persistenceUnitRefItem); - } else if (("post-construct" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("post-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: postConstruct - final org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); if (postConstruct == null) { postConstruct = sessionBean.postConstruct; - if (postConstruct != null) { + if (postConstruct!= null) { postConstruct.clear(); } else { - postConstruct = new ArrayList(); + postConstruct = new ArrayList<>(); } } postConstruct.add(postConstructItem); - } else if (("pre-destroy" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("pre-destroy" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: preDestroy - final org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); if (preDestroy == null) { preDestroy = sessionBean.preDestroy; - if (preDestroy != null) { + if (preDestroy!= null) { preDestroy.clear(); } else { - preDestroy = new ArrayList(); + preDestroy = new ArrayList<>(); } } preDestroy.add(preDestroyItem); - } else if (("data-source" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dataSource - final DataSource dataSourceItem = readDataSource(elementReader, context); + DataSource dataSourceItem = readDataSource(elementReader, context); if (dataSource == null) { dataSource = sessionBean.dataSource; - if (dataSource != null) { + if (dataSource!= null) { dataSource.clear(); } else { - dataSource = new KeyedCollection(); + dataSource = new KeyedCollection<>(); } } dataSource.add(dataSourceItem); - } else if (("post-activate" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); + if (jmsConnectionFactories == null) { + jmsConnectionFactories = sessionBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + jmsConnectionFactories.clear(); + } else { + jmsConnectionFactories = new KeyedCollection<>(); + } + } + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = sessionBean.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("post-activate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: postActivate - final org.apache.openejb.jee.LifecycleCallback postActivateItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback postActivateItem = readLifecycleCallback(elementReader, context); if (postActivate == null) { postActivate = sessionBean.postActivate; - if (postActivate != null) { + if (postActivate!= null) { postActivate.clear(); } else { - postActivate = new ArrayList(); + postActivate = new ArrayList<>(); } } postActivate.add(postActivateItem); - } else if (("pre-passivate" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("pre-passivate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: prePassivate - final org.apache.openejb.jee.LifecycleCallback prePassivateItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback prePassivateItem = readLifecycleCallback(elementReader, context); if (prePassivate == null) { prePassivate = sessionBean.prePassivate; - if (prePassivate != null) { + if (prePassivate!= null) { prePassivate.clear(); } else { - prePassivate = new ArrayList(); + prePassivate = new ArrayList<>(); } } prePassivate.add(prePassivateItem); - } else if (("security-role-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("security-role-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityRoleRef - final SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); + SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); if (securityRoleRef == null) { securityRoleRef = sessionBean.securityRoleRef; - if (securityRoleRef != null) { + if (securityRoleRef!= null) { securityRoleRef.clear(); } else { - securityRoleRef = new ArrayList(); + securityRoleRef = new ArrayList<>(); } } securityRoleRef.add(securityRoleRefItem); - } else if (("security-identity" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("security-identity" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityIdentity - final SecurityIdentity securityIdentity = readSecurityIdentity(elementReader, context); + SecurityIdentity securityIdentity = readSecurityIdentity(elementReader, context); sessionBean.securityIdentity = securityIdentity; - } else if (("passivation-capable" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - sessionBean.setPassivationCapable(Boolean.parseBoolean(elementReader.getElementAsString())); + } else if (("passivation-capable" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: passivationCapable + Boolean passivationCapable = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + sessionBean.passivationCapable = passivationCapable; + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = sessionBeanContextService.getObject(reader, context, sessionBean); + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } + } + contextService.add(contextServiceItem); } else { - context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "passivation-capable"), 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", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "home"), new QName("http://java.sun.com/xml/ns/javaee", "remote"), 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", "business-local"), new QName("http://java.sun.com/xml/ns/javaee", "business-remote"), new QName("http://java.sun.com/xml/ns/javaee", "local-bean"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-class"), new QName("http://java.sun.com/xml/ns/javaee", "session-type"), new QName("http://java.sun.com/xml/ns/javaee", "stateful-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"), new QName("http://java.sun.com/xml/ns/javaee", "timer"), new QName("http://java.sun.com/xml/ns/javaee", "init-on-startup"), new QName("http://java.sun.com/xml/ns/javaee", "concurrency-management-type"), new QName("http://java.sun.com/xml/ns/javaee", "concurrent-method"), new QName("http://java.sun.com/xml/ns/javaee", "depends-on"), new QName("http://java.sun.com/xml/ns/javaee", "init-method"), new QName("http://java.sun.com/xml/ns/javaee", "remove-method"), new QName("http://java.sun.com/xml/ns/javaee", "async-method"), new QName("http://java.sun.com/xml/ns/javaee", "transaction-type"), new QName("http://java.sun.com/xml/ns/javaee", "after-begin-method"), new QName("http://java.sun.com/xml/ns/javaee", "before-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "after-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "post-activate"), new QName("http://java.sun.com/xml/ns/javaee", "pre-passivate"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "security-identity")); + 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", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "home"), new QName("http://java.sun.com/xml/ns/javaee", "remote"), 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", "business-local"), new QName("http://java.sun.com/xml/ns/javaee", "business-remote"), new QName("http://java.sun.com/xml/ns/javaee", "local-bean"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-class"), new QName("http://java.sun.com/xml/ns/javaee", "session-type"), new QName("http://java.sun.com/xml/ns/javaee", "stateful-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"), new QName("http://java.sun.com/xml/ns/javaee", "timer"), new QName("http://java.sun.com/xml/ns/javaee", "init-on-startup"), new QName("http://java.sun.com/xml/ns/javaee", "concurrency-management-type"), new QName("http://java.sun.com/xml/ns/javaee", "concurrent-method"), new QName("http://java.sun.com/xml/ns/javaee", "depends-on"), new QName("http://java.sun.com/xml/ns/javaee", "init-method"), new QName("http://java.sun.com/xml/ns/javaee", "remove-method"), new QName("http://java.sun.com/xml/ns/javaee", "async-method"), new QName("http://java.sun.com/xml/ns/javaee", "transaction-type"), new QName("http://java.sun.com/xml/ns/javaee", "after-begin-method"), new QName("http://java.sun.com/xml/ns/javaee", "before-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "after-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "post-activate"), new QName("http://java.sun.com/xml/ns/javaee", "pre-passivate"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "security-identity"), new QName("http://java.sun.com/xml/ns/javaee", "passivation-capable"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - sessionBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + sessionBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, SessionBean.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - sessionBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + sessionBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, SessionBean.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { sessionBean.icon = icon; } - if (businessLocal != null) { + if (businessLocal!= null) { sessionBean.businessLocal = businessLocal; } - if (businessRemote != null) { + if (businessRemote!= null) { sessionBean.businessRemote = businessRemote; } - if (timer != null) { + if (timer!= null) { sessionBean.timer = timer; } - if (concurrentMethod != null) { + if (concurrentMethod!= null) { sessionBean.concurrentMethod = concurrentMethod; } - if (initMethod != null) { + if (initMethod!= null) { sessionBean.initMethod = initMethod; } - if (removeMethod != null) { + if (removeMethod!= null) { sessionBean.removeMethod = removeMethod; } - if (asyncMethod != null) { + if (asyncMethod!= null) { sessionBean.asyncMethod = asyncMethod; } - if (aroundInvoke != null) { + if (aroundInvoke!= null) { sessionBean.aroundInvoke = aroundInvoke; } - if (aroundTimeout != null) { + if (aroundTimeout!= null) { sessionBean.aroundTimeout = aroundTimeout; } - if (envEntry != null) { + if (envEntry!= null) { sessionBean.envEntry = envEntry; } - if (ejbRef != null) { + if (ejbRef!= null) { sessionBean.ejbRef = ejbRef; } - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { sessionBean.ejbLocalRef = ejbLocalRef; } - if (serviceRef != null) { + if (serviceRef!= null) { sessionBean.serviceRef = serviceRef; } - if (resourceRef != null) { + if (resourceRef!= null) { sessionBean.resourceRef = resourceRef; } - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { sessionBean.resourceEnvRef = resourceEnvRef; } - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { sessionBean.messageDestinationRef = messageDestinationRef; } - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { sessionBean.persistenceContextRef = persistenceContextRef; } - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { sessionBean.persistenceUnitRef = persistenceUnitRef; } - if (postConstruct != null) { + if (postConstruct!= null) { sessionBean.postConstruct = postConstruct; } - if (preDestroy != null) { + if (preDestroy!= null) { sessionBean.preDestroy = preDestroy; } - if (dataSource != null) { + if (dataSource!= null) { sessionBean.dataSource = dataSource; } - if (postActivate != null) { + if (jmsConnectionFactories!= null) { + sessionBean.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + sessionBean.jmsDestinations = jmsDestinations; + } + if (postActivate!= null) { sessionBean.postActivate = postActivate; } - if (prePassivate != null) { + if (prePassivate!= null) { sessionBean.prePassivate = prePassivate; } - if (securityRoleRef != null) { + if (securityRoleRef!= null) { sessionBean.securityRoleRef = securityRoleRef; } + if (contextService!= null) { + sessionBeanContextService.setObject(reader, context, sessionBean, contextService); + } context.afterUnmarshal(sessionBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); return sessionBean; } - public final SessionBean read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final SessionBean read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _readDependsOn(final XoXMLStreamReader reader, final RuntimeContext context, final SessionBean sessionBean) - throws Exception { + public static final void _readDependsOn(XoXMLStreamReader reader, RuntimeContext context, SessionBean sessionBean) + throws Exception + { List dependsOn = null; // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dependsOn - final String dependsOnItemRaw = elementReader.getElementAsString(); + String dependsOnItemRaw = elementReader.getElementText(); - final String dependsOnItem; + String dependsOnItem; try { dependsOnItem = Adapters.collapsedStringAdapterAdapter.unmarshal(dependsOnItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (dependsOn == null) { dependsOn = sessionBean.dependsOn; - if (dependsOn != null) { + if (dependsOn!= null) { dependsOn.clear(); } else { - dependsOn = new ArrayList(); + dependsOn = new ArrayList<>(); } } dependsOn.add(dependsOnItem); } } - if (dependsOn != null) { + if (dependsOn!= null) { sessionBean.dependsOn = dependsOn; } } - public final static void _write(final XoXMLStreamWriter writer, final SessionBean sessionBean, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, SessionBean sessionBean, RuntimeContext context) + throws Exception + { if (sessionBean == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - - if (! sessionBeanClasses.contains(sessionBean.getClass().getName())) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (SessionBean.class!= sessionBean.getClass()) { context.unexpectedSubclass(writer, sessionBean, SessionBean.class); - return; + return ; } context.beforeMarshal(sessionBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = sessionBean.id; - if (idRaw != null) { + String idRaw = sessionBean.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -870,12 +921,12 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea Text[] descriptions = null; try { descriptions = sessionBean.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(sessionBean, "descriptions", SessionBean.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -889,12 +940,12 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea Text[] displayNames = null; try { displayNames = sessionBean.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(sessionBean, "displayNames", SessionBean.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -905,10 +956,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: icon - final LocalCollection icon = sessionBean.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = sessionBean.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -919,14 +970,14 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: ejbName - final String ejbNameRaw = sessionBean.ejbName; + String ejbNameRaw = sessionBean.ejbName; String ejbName = null; try { ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbName != null) { + if (ejbName!= null) { writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbName); writer.writeEndElement(); @@ -935,86 +986,86 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: mappedName - final String mappedNameRaw = sessionBean.mappedName; + String mappedNameRaw = sessionBean.mappedName; String mappedName = null; try { mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (mappedName != null) { + if (mappedName!= null) { writer.writeStartElement(prefix, "mapped-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(mappedName); writer.writeEndElement(); } // ELEMENT: home - final String homeRaw = sessionBean.home; + String homeRaw = sessionBean.home; String home = null; try { home = Adapters.collapsedStringAdapterAdapter.marshal(homeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "home", CollapsedStringAdapter.class, String.class, String.class, e); } - if (home != null) { + if (home!= null) { writer.writeStartElement(prefix, "home", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(home); writer.writeEndElement(); } // ELEMENT: remote - final String remoteRaw = sessionBean.remote; + String remoteRaw = sessionBean.remote; String remote = null; try { remote = Adapters.collapsedStringAdapterAdapter.marshal(remoteRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "remote", CollapsedStringAdapter.class, String.class, String.class, e); } - if (remote != null) { + if (remote!= null) { writer.writeStartElement(prefix, "remote", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(remote); writer.writeEndElement(); } // ELEMENT: localHome - final String localHomeRaw = sessionBean.localHome; + String localHomeRaw = sessionBean.localHome; String localHome = null; try { localHome = Adapters.collapsedStringAdapterAdapter.marshal(localHomeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "localHome", CollapsedStringAdapter.class, String.class, String.class, e); } - if (localHome != null) { + if (localHome!= null) { writer.writeStartElement(prefix, "local-home", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(localHome); writer.writeEndElement(); } // ELEMENT: local - final String localRaw = sessionBean.local; + String localRaw = sessionBean.local; String local = null; try { local = Adapters.collapsedStringAdapterAdapter.marshal(localRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "local", CollapsedStringAdapter.class, String.class, String.class, e); } - if (local != null) { + if (local!= null) { writer.writeStartElement(prefix, "local", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(local); writer.writeEndElement(); } // ELEMENT: businessLocal - final LinkedHashSet businessLocalRaw = sessionBean.businessLocal; - if (businessLocalRaw != null) { - for (final String businessLocalItem : businessLocalRaw) { + LinkedHashSet businessLocalRaw = sessionBean.businessLocal; + if (businessLocalRaw!= null) { + for (String businessLocalItem: businessLocalRaw) { String businessLocal = null; try { businessLocal = Adapters.collapsedStringAdapterAdapter.marshal(businessLocalItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "businessLocal", CollapsedStringAdapter.class, LinkedHashSet.class, LinkedHashSet.class, e); } - if (businessLocal != null) { + if (businessLocal!= null) { writer.writeStartElement(prefix, "business-local", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(businessLocal); writer.writeEndElement(); @@ -1023,16 +1074,16 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: businessRemote - final LinkedHashSet businessRemoteRaw = sessionBean.businessRemote; - if (businessRemoteRaw != null) { - for (final String businessRemoteItem : businessRemoteRaw) { + LinkedHashSet businessRemoteRaw = sessionBean.businessRemote; + if (businessRemoteRaw!= null) { + for (String businessRemoteItem: businessRemoteRaw) { String businessRemote = null; try { businessRemote = Adapters.collapsedStringAdapterAdapter.marshal(businessRemoteItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "businessRemote", CollapsedStringAdapter.class, LinkedHashSet.class, LinkedHashSet.class, e); } - if (businessRemote != null) { + if (businessRemote!= null) { writer.writeStartElement(prefix, "business-remote", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(businessRemote); writer.writeEndElement(); @@ -1041,70 +1092,70 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: localBean - final Empty localBean = sessionBean.localBean; - if (localBean != null) { + Empty localBean = sessionBean.localBean; + if (localBean!= null) { writer.writeStartElement(prefix, "local-bean", "http://java.sun.com/xml/ns/javaee"); writeEmpty(writer, localBean, context); writer.writeEndElement(); } // ELEMENT: serviceEndpoint - final String serviceEndpointRaw = sessionBean.serviceEndpoint; + String serviceEndpointRaw = sessionBean.serviceEndpoint; String serviceEndpoint = null; try { serviceEndpoint = Adapters.collapsedStringAdapterAdapter.marshal(serviceEndpointRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "serviceEndpoint", CollapsedStringAdapter.class, String.class, String.class, e); } - if (serviceEndpoint != null) { + if (serviceEndpoint!= null) { writer.writeStartElement(prefix, "service-endpoint", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(serviceEndpoint); writer.writeEndElement(); } // ELEMENT: ejbClass - final String ejbClassRaw = sessionBean.ejbClass; + String ejbClassRaw = sessionBean.ejbClass; String ejbClass = null; try { ejbClass = Adapters.collapsedStringAdapterAdapter.marshal(ejbClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "ejbClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (ejbClass != null) { + if (ejbClass!= null) { writer.writeStartElement(prefix, "ejb-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(ejbClass); writer.writeEndElement(); } // ELEMENT: sessionType - final SessionType sessionType = sessionBean.sessionType; - if (sessionType != null) { + SessionType sessionType = sessionBean.sessionType; + if (sessionType!= null) { writer.writeStartElement(prefix, "session-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringSessionType(sessionBean, null, context, sessionType)); writer.writeEndElement(); } // ELEMENT: statefulTimeout - final Timeout statefulTimeout = sessionBean.statefulTimeout; - if (statefulTimeout != null) { + Timeout statefulTimeout = sessionBean.statefulTimeout; + if (statefulTimeout!= null) { writer.writeStartElement(prefix, "stateful-timeout", "http://java.sun.com/xml/ns/javaee"); writeTimeout(writer, statefulTimeout, context); writer.writeEndElement(); } // ELEMENT: timeoutMethod - final NamedMethod timeoutMethod = sessionBean.timeoutMethod; - if (timeoutMethod != null) { + NamedMethod timeoutMethod = sessionBean.timeoutMethod; + if (timeoutMethod!= null) { writer.writeStartElement(prefix, "timeout-method", "http://java.sun.com/xml/ns/javaee"); writeNamedMethod(writer, timeoutMethod, context); writer.writeEndElement(); } // ELEMENT: timer - final List timer = sessionBean.timer; - if (timer != null) { - for (final Timer timerItem : timer) { - if (timerItem != null) { + List timer = sessionBean.timer; + if (timer!= null) { + for (Timer timerItem: timer) { + if (timerItem!= null) { writer.writeStartElement(prefix, "timer", "http://java.sun.com/xml/ns/javaee"); writeTimer(writer, timerItem, context); writer.writeEndElement(); @@ -1113,26 +1164,26 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: initOnStartup - final Boolean initOnStartup = sessionBean.initOnStartup; - if (initOnStartup != null) { + Boolean initOnStartup = sessionBean.initOnStartup; + if (initOnStartup!= null) { writer.writeStartElement(prefix, "init-on-startup", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Boolean.toString(initOnStartup)); writer.writeEndElement(); } // ELEMENT: concurrencyManagementType - final ConcurrencyManagementType concurrencyManagementType = sessionBean.concurrencyManagementType; - if (concurrencyManagementType != null) { + ConcurrencyManagementType concurrencyManagementType = sessionBean.concurrencyManagementType; + if (concurrencyManagementType!= null) { writer.writeStartElement(prefix, "concurrency-management-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringConcurrencyManagementType(sessionBean, null, context, concurrencyManagementType)); writer.writeEndElement(); } // ELEMENT: concurrentMethod - final List concurrentMethod = sessionBean.concurrentMethod; - if (concurrentMethod != null) { - for (final ConcurrentMethod concurrentMethodItem : concurrentMethod) { - if (concurrentMethodItem != null) { + List concurrentMethod = sessionBean.concurrentMethod; + if (concurrentMethod!= null) { + for (ConcurrentMethod concurrentMethodItem: concurrentMethod) { + if (concurrentMethodItem!= null) { writer.writeStartElement(prefix, "concurrent-method", "http://java.sun.com/xml/ns/javaee"); writeConcurrentMethod(writer, concurrentMethodItem, context); writer.writeEndElement(); @@ -1141,17 +1192,17 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: dependsOn - final List dependsOnRaw = sessionBean.dependsOn; - if (dependsOnRaw != null) { + List dependsOnRaw = sessionBean.dependsOn; + if (dependsOnRaw!= null) { writer.writeStartElement(prefix, "depends-on", "http://java.sun.com/xml/ns/javaee"); - for (final String dependsOnItem : dependsOnRaw) { + for (String dependsOnItem: dependsOnRaw) { String dependsOn = null; try { dependsOn = Adapters.collapsedStringAdapterAdapter.marshal(dependsOnItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionBean, "dependsOn", CollapsedStringAdapter.class, List.class, List.class, e); } - if (dependsOn != null) { + if (dependsOn!= null) { writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(dependsOn); writer.writeEndElement(); @@ -1161,10 +1212,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: initMethod - final List initMethod = sessionBean.initMethod; - if (initMethod != null) { - for (final InitMethod initMethodItem : initMethod) { - if (initMethodItem != null) { + List initMethod = sessionBean.initMethod; + if (initMethod!= null) { + for (InitMethod initMethodItem: initMethod) { + if (initMethodItem!= null) { writer.writeStartElement(prefix, "init-method", "http://java.sun.com/xml/ns/javaee"); writeInitMethod(writer, initMethodItem, context); writer.writeEndElement(); @@ -1173,10 +1224,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: removeMethod - final List removeMethod = sessionBean.removeMethod; - if (removeMethod != null) { - for (final RemoveMethod removeMethodItem : removeMethod) { - if (removeMethodItem != null) { + List removeMethod = sessionBean.removeMethod; + if (removeMethod!= null) { + for (RemoveMethod removeMethodItem: removeMethod) { + if (removeMethodItem!= null) { writer.writeStartElement(prefix, "remove-method", "http://java.sun.com/xml/ns/javaee"); writeRemoveMethod(writer, removeMethodItem, context); writer.writeEndElement(); @@ -1185,10 +1236,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: asyncMethod - final List asyncMethod = sessionBean.asyncMethod; - if (asyncMethod != null) { - for (final AsyncMethod asyncMethodItem : asyncMethod) { - if (asyncMethodItem != null) { + List asyncMethod = sessionBean.asyncMethod; + if (asyncMethod!= null) { + for (AsyncMethod asyncMethodItem: asyncMethod) { + if (asyncMethodItem!= null) { writer.writeStartElement(prefix, "async-method", "http://java.sun.com/xml/ns/javaee"); writeAsyncMethod(writer, asyncMethodItem, context); writer.writeEndElement(); @@ -1197,8 +1248,8 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: transactionType - final TransactionType transactionType = sessionBean.transactionType; - if (transactionType != null) { + TransactionType transactionType = sessionBean.transactionType; + if (transactionType!= null) { writer.writeStartElement(prefix, "transaction-type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringTransactionType(sessionBean, null, context, transactionType)); writer.writeEndElement(); @@ -1208,10 +1259,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea NamedMethod afterBeginMethod = null; try { afterBeginMethod = sessionBean.getAfterBeginMethod(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(sessionBean, "afterBeginMethod", SessionBean.class, "getAfterBeginMethod", e); } - if (afterBeginMethod != null) { + if (afterBeginMethod!= null) { writer.writeStartElement(prefix, "after-begin-method", "http://java.sun.com/xml/ns/javaee"); writeNamedMethod(writer, afterBeginMethod, context); writer.writeEndElement(); @@ -1221,10 +1272,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea NamedMethod beforeCompletionMethod = null; try { beforeCompletionMethod = sessionBean.getBeforeCompletionMethod(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(sessionBean, "beforeCompletionMethod", SessionBean.class, "getBeforeCompletionMethod", e); } - if (beforeCompletionMethod != null) { + if (beforeCompletionMethod!= null) { writer.writeStartElement(prefix, "before-completion-method", "http://java.sun.com/xml/ns/javaee"); writeNamedMethod(writer, beforeCompletionMethod, context); writer.writeEndElement(); @@ -1234,20 +1285,20 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea NamedMethod afterCompletionMethod = null; try { afterCompletionMethod = sessionBean.getAfterCompletionMethod(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(sessionBean, "afterCompletionMethod", SessionBean.class, "getAfterCompletionMethod", e); } - if (afterCompletionMethod != null) { + if (afterCompletionMethod!= null) { writer.writeStartElement(prefix, "after-completion-method", "http://java.sun.com/xml/ns/javaee"); writeNamedMethod(writer, afterCompletionMethod, context); writer.writeEndElement(); } // ELEMENT: aroundInvoke - final List aroundInvoke = sessionBean.aroundInvoke; - if (aroundInvoke != null) { - for (final AroundInvoke aroundInvokeItem : aroundInvoke) { - if (aroundInvokeItem != null) { + List aroundInvoke = sessionBean.aroundInvoke; + if (aroundInvoke!= null) { + for (AroundInvoke aroundInvokeItem: aroundInvoke) { + if (aroundInvokeItem!= null) { writer.writeStartElement(prefix, "around-invoke", "http://java.sun.com/xml/ns/javaee"); writeAroundInvoke(writer, aroundInvokeItem, context); writer.writeEndElement(); @@ -1258,10 +1309,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: aroundTimeout - final List aroundTimeout = sessionBean.aroundTimeout; - if (aroundTimeout != null) { - for (final AroundTimeout aroundTimeoutItem : aroundTimeout) { - if (aroundTimeoutItem != null) { + List aroundTimeout = sessionBean.aroundTimeout; + if (aroundTimeout!= null) { + for (AroundTimeout aroundTimeoutItem: aroundTimeout) { + if (aroundTimeoutItem!= null) { writer.writeStartElement(prefix, "around-timeout", "http://java.sun.com/xml/ns/javaee"); writeAroundTimeout(writer, aroundTimeoutItem, context); writer.writeEndElement(); @@ -1270,10 +1321,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: envEntry - final KeyedCollection envEntry = sessionBean.envEntry; - if (envEntry != null) { - for (final EnvEntry envEntryItem : envEntry) { - if (envEntryItem != null) { + KeyedCollection envEntry = sessionBean.envEntry; + if (envEntry!= null) { + for (EnvEntry envEntryItem: envEntry) { + if (envEntryItem!= null) { writer.writeStartElement(prefix, "env-entry", "http://java.sun.com/xml/ns/javaee"); writeEnvEntry(writer, envEntryItem, context); writer.writeEndElement(); @@ -1284,10 +1335,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: ejbRef - final KeyedCollection ejbRef = sessionBean.ejbRef; - if (ejbRef != null) { - for (final EjbRef ejbRefItem : ejbRef) { - if (ejbRefItem != null) { + KeyedCollection ejbRef = sessionBean.ejbRef; + if (ejbRef!= null) { + for (EjbRef ejbRefItem: ejbRef) { + if (ejbRefItem!= null) { writer.writeStartElement(prefix, "ejb-ref", "http://java.sun.com/xml/ns/javaee"); writeEjbRef(writer, ejbRefItem, context); writer.writeEndElement(); @@ -1298,10 +1349,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: ejbLocalRef - final KeyedCollection ejbLocalRef = sessionBean.ejbLocalRef; - if (ejbLocalRef != null) { - for (final EjbLocalRef ejbLocalRefItem : ejbLocalRef) { - if (ejbLocalRefItem != null) { + KeyedCollection ejbLocalRef = sessionBean.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(); @@ -1312,10 +1363,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: serviceRef - final KeyedCollection serviceRef = sessionBean.serviceRef; - if (serviceRef != null) { - for (final ServiceRef serviceRefItem : serviceRef) { - if (serviceRefItem != null) { + KeyedCollection serviceRef = sessionBean.serviceRef; + if (serviceRef!= null) { + for (ServiceRef serviceRefItem: serviceRef) { + if (serviceRefItem!= null) { writer.writeStartElement(prefix, "service-ref", "http://java.sun.com/xml/ns/javaee"); writeServiceRef(writer, serviceRefItem, context); writer.writeEndElement(); @@ -1326,10 +1377,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: resourceRef - final KeyedCollection resourceRef = sessionBean.resourceRef; - if (resourceRef != null) { - for (final ResourceRef resourceRefItem : resourceRef) { - if (resourceRefItem != null) { + KeyedCollection resourceRef = sessionBean.resourceRef; + if (resourceRef!= null) { + for (ResourceRef resourceRefItem: resourceRef) { + if (resourceRefItem!= null) { writer.writeStartElement(prefix, "resource-ref", "http://java.sun.com/xml/ns/javaee"); writeResourceRef(writer, resourceRefItem, context); writer.writeEndElement(); @@ -1340,10 +1391,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: resourceEnvRef - final KeyedCollection resourceEnvRef = sessionBean.resourceEnvRef; - if (resourceEnvRef != null) { - for (final ResourceEnvRef resourceEnvRefItem : resourceEnvRef) { - if (resourceEnvRefItem != null) { + KeyedCollection resourceEnvRef = sessionBean.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(); @@ -1354,10 +1405,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: messageDestinationRef - final KeyedCollection messageDestinationRef = sessionBean.messageDestinationRef; - if (messageDestinationRef != null) { - for (final MessageDestinationRef messageDestinationRefItem : messageDestinationRef) { - if (messageDestinationRefItem != null) { + KeyedCollection messageDestinationRef = sessionBean.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(); @@ -1368,10 +1419,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: persistenceContextRef - final KeyedCollection persistenceContextRef = sessionBean.persistenceContextRef; - if (persistenceContextRef != null) { - for (final PersistenceContextRef persistenceContextRefItem : persistenceContextRef) { - if (persistenceContextRefItem != null) { + KeyedCollection persistenceContextRef = sessionBean.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(); @@ -1382,10 +1433,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: persistenceUnitRef - final KeyedCollection persistenceUnitRef = sessionBean.persistenceUnitRef; - if (persistenceUnitRef != null) { - for (final PersistenceUnitRef persistenceUnitRefItem : persistenceUnitRef) { - if (persistenceUnitRefItem != null) { + KeyedCollection persistenceUnitRef = sessionBean.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(); @@ -1396,10 +1447,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: postConstruct - final List postConstruct = sessionBean.postConstruct; - if (postConstruct != null) { - for (final org.apache.openejb.jee.LifecycleCallback postConstructItem : postConstruct) { - if (postConstructItem != null) { + List postConstruct = sessionBean.postConstruct; + if (postConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback postConstructItem: postConstruct) { + if (postConstructItem!= null) { writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, postConstructItem, context); writer.writeEndElement(); @@ -1410,10 +1461,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: preDestroy - final List preDestroy = sessionBean.preDestroy; - if (preDestroy != null) { - for (final org.apache.openejb.jee.LifecycleCallback preDestroyItem : preDestroy) { - if (preDestroyItem != null) { + List preDestroy = sessionBean.preDestroy; + if (preDestroy!= null) { + for (org.apache.openejb.jee.LifecycleCallback preDestroyItem: preDestroy) { + if (preDestroyItem!= null) { writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, preDestroyItem, context); writer.writeEndElement(); @@ -1424,10 +1475,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: dataSource - final KeyedCollection dataSource = sessionBean.dataSource; - if (dataSource != null) { - for (final DataSource dataSourceItem : dataSource) { - if (dataSourceItem != null) { + KeyedCollection dataSource = sessionBean.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); writeDataSource(writer, dataSourceItem, context); writer.writeEndElement(); @@ -1435,11 +1486,37 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } } + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = sessionBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(sessionBean, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = sessionBean.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + // ELEMENT: postActivate - final List postActivate = sessionBean.postActivate; - if (postActivate != null) { - for (final org.apache.openejb.jee.LifecycleCallback postActivateItem : postActivate) { - if (postActivateItem != null) { + List postActivate = sessionBean.postActivate; + if (postActivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback postActivateItem: postActivate) { + if (postActivateItem!= null) { writer.writeStartElement(prefix, "post-activate", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, postActivateItem, context); writer.writeEndElement(); @@ -1450,10 +1527,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: prePassivate - final List prePassivate = sessionBean.prePassivate; - if (prePassivate != null) { - for (final org.apache.openejb.jee.LifecycleCallback prePassivateItem : prePassivate) { - if (prePassivateItem != null) { + List prePassivate = sessionBean.prePassivate; + if (prePassivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback prePassivateItem: prePassivate) { + if (prePassivateItem!= null) { writer.writeStartElement(prefix, "pre-passivate", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, prePassivateItem, context); writer.writeEndElement(); @@ -1464,10 +1541,10 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: securityRoleRef - final List securityRoleRef = sessionBean.securityRoleRef; - if (securityRoleRef != null) { - for (final SecurityRoleRef securityRoleRefItem : securityRoleRef) { - if (securityRoleRefItem != null) { + List securityRoleRef = sessionBean.securityRoleRef; + if (securityRoleRef!= null) { + for (SecurityRoleRef securityRoleRefItem: securityRoleRef) { + if (securityRoleRefItem!= null) { writer.writeStartElement(prefix, "security-role-ref", "http://java.sun.com/xml/ns/javaee"); writeSecurityRoleRef(writer, securityRoleRefItem, context); writer.writeEndElement(); @@ -1478,13 +1555,33 @@ public final static void _write(final XoXMLStreamWriter writer, final SessionBea } // ELEMENT: securityIdentity - final SecurityIdentity securityIdentity = sessionBean.securityIdentity; - if (securityIdentity != null) { + SecurityIdentity securityIdentity = sessionBean.securityIdentity; + if (securityIdentity!= null) { writer.writeStartElement(prefix, "security-identity", "http://java.sun.com/xml/ns/javaee"); writeSecurityIdentity(writer, securityIdentity, context); writer.writeEndElement(); } + // ELEMENT: passivationCapable + Boolean passivationCapable = sessionBean.passivationCapable; + if (passivationCapable!= null) { + writer.writeStartElement(prefix, "passivation-capable", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Boolean.toString(passivationCapable)); + writer.writeEndElement(); + } + + // ELEMENT: contextService + KeyedCollection contextService = sessionBeanContextService.getObject(sessionBean, context, sessionBean); + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + context.afterMarshal(sessionBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionConfig$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionConfig$JAXB.java index b7963f0d14b..df99098967d 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionConfig$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionConfig$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.CookieConfig$JAXB.readCookieConfig; import static org.apache.openejb.jee.CookieConfig$JAXB.writeCookieConfig; @@ -38,30 +39,35 @@ "StringEquality" }) public class SessionConfig$JAXB - extends JAXBObject { + extends JAXBObject +{ public SessionConfig$JAXB() { super(SessionConfig.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "session-configType".intern()), CookieConfig$JAXB.class, TrackingMode$JAXB.class); } - public static SessionConfig readSessionConfig(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static SessionConfig readSessionConfig(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeSessionConfig(final XoXMLStreamWriter writer, final SessionConfig sessionConfig, final RuntimeContext context) - throws Exception { + public static void writeSessionConfig(XoXMLStreamWriter writer, SessionConfig sessionConfig, RuntimeContext context) + throws Exception + { _write(writer, sessionConfig, context); } - public void write(final XoXMLStreamWriter writer, final SessionConfig sessionConfig, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, SessionConfig sessionConfig, RuntimeContext context) + throws Exception + { _write(writer, sessionConfig, context); } - public final static SessionConfig _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final SessionConfig _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,50 +78,50 @@ public final static SessionConfig _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final SessionConfig sessionConfig = new SessionConfig(); + SessionConfig sessionConfig = new SessionConfig(); context.beforeUnmarshal(sessionConfig, LifecycleCallback.NONE); List trackingMode = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("session-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("session-configType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, SessionConfig.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, sessionConfig); sessionConfig.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("session-timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("session-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: sessionTimeout - final Integer sessionTimeout = Integer.valueOf(elementReader.getElementAsString()); + Integer sessionTimeout = Integer.valueOf(elementReader.getElementText()); sessionConfig.sessionTimeout = sessionTimeout; - } else if (("cookie-config" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("cookie-config" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: cookieConfig - final CookieConfig cookieConfig = readCookieConfig(elementReader, context); + CookieConfig cookieConfig = readCookieConfig(elementReader, context); sessionConfig.cookieConfig = cookieConfig; - } else if (("tracking-mode" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("tracking-mode" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: trackingMode - final TrackingMode trackingModeItem = parseTrackingMode(elementReader, context, elementReader.getElementAsString()); + TrackingMode trackingModeItem = parseTrackingMode(elementReader, context, elementReader.getElementText()); if (trackingMode == null) { trackingMode = sessionConfig.trackingMode; - if (trackingMode != null) { + if (trackingMode!= null) { trackingMode.clear(); } else { - trackingMode = new ArrayList(); + trackingMode = new ArrayList<>(); } } trackingMode.add(trackingModeItem); @@ -123,7 +129,7 @@ public final static SessionConfig _read(final XoXMLStreamReader reader, RuntimeC context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "session-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "cookie-config"), new QName("http://java.sun.com/xml/ns/javaee", "tracking-mode")); } } - if (trackingMode != null) { + if (trackingMode!= null) { sessionConfig.trackingMode = trackingMode; } @@ -132,64 +138,66 @@ public final static SessionConfig _read(final XoXMLStreamReader reader, RuntimeC return sessionConfig; } - public final SessionConfig read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final SessionConfig read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final SessionConfig sessionConfig, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, SessionConfig sessionConfig, RuntimeContext context) + throws Exception + { if (sessionConfig == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (SessionConfig.class != sessionConfig.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (SessionConfig.class!= sessionConfig.getClass()) { context.unexpectedSubclass(writer, sessionConfig, SessionConfig.class); - return; + return ; } context.beforeMarshal(sessionConfig, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = sessionConfig.id; - if (idRaw != null) { + String idRaw = sessionConfig.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(sessionConfig, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: sessionTimeout - final Integer sessionTimeout = sessionConfig.sessionTimeout; - if (sessionTimeout != null) { + Integer sessionTimeout = sessionConfig.sessionTimeout; + if (sessionTimeout!= null) { writer.writeStartElement(prefix, "session-timeout", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Integer.toString(sessionTimeout)); writer.writeEndElement(); } // ELEMENT: cookieConfig - final CookieConfig cookieConfig = sessionConfig.cookieConfig; - if (cookieConfig != null) { + CookieConfig cookieConfig = sessionConfig.cookieConfig; + if (cookieConfig!= null) { writer.writeStartElement(prefix, "cookie-config", "http://java.sun.com/xml/ns/javaee"); writeCookieConfig(writer, cookieConfig, context); writer.writeEndElement(); } // ELEMENT: trackingMode - final List trackingMode = sessionConfig.trackingMode; - if (trackingMode != null) { - for (final TrackingMode trackingModeItem : trackingMode) { - if (trackingModeItem != null) { + List trackingMode = sessionConfig.trackingMode; + if (trackingMode!= null) { + for (TrackingMode trackingModeItem: trackingMode) { + if (trackingModeItem!= null) { writer.writeStartElement(prefix, "tracking-mode", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringTrackingMode(sessionConfig, null, context, trackingModeItem)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionType$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionType$JAXB.java index 15de8aef9c9..48ee096db76 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionType$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionType$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class SessionType$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public SessionType$JAXB() { super(SessionType.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "sessionType".intern())); } - public SessionType parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public SessionType parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseSessionType(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final SessionType sessionType) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, SessionType sessionType) + throws Exception + { return toStringSessionType(bean, parameterName, context, sessionType); } - public static SessionType parseSessionType(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static SessionType parseSessionType(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Stateful".equals(value)) { return SessionType.STATEFUL; } else if ("Stateless".equals(value)) { @@ -56,8 +60,9 @@ public static SessionType parseSessionType(final XoXMLStreamReader reader, final } } - public static String toStringSessionType(final Object bean, final String parameterName, final RuntimeContext context, final SessionType sessionType) - throws Exception { + public static String toStringSessionType(Object bean, String parameterName, RuntimeContext context, SessionType sessionType) + throws Exception + { if (SessionType.STATEFUL == sessionType) { return "Stateful"; } else if (SessionType.STATELESS == sessionType) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SubscriptionDurability$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SubscriptionDurability$JAXB.java index 74d4e2f8e1d..e5a2789b4c2 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SubscriptionDurability$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SubscriptionDurability$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class SubscriptionDurability$JAXB - extends JAXBObject { + extends JAXBObject +{ public SubscriptionDurability$JAXB() { super(SubscriptionDurability.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "subscription-durability".intern()), null); } - public static SubscriptionDurability readSubscriptionDurability(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static SubscriptionDurability readSubscriptionDurability(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeSubscriptionDurability(final XoXMLStreamWriter writer, final SubscriptionDurability subscriptionDurability, final RuntimeContext context) - throws Exception { + public static void writeSubscriptionDurability(XoXMLStreamWriter writer, SubscriptionDurability subscriptionDurability, RuntimeContext context) + throws Exception + { _write(writer, subscriptionDurability, context); } - public void write(final XoXMLStreamWriter writer, final SubscriptionDurability subscriptionDurability, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, SubscriptionDurability subscriptionDurability, RuntimeContext context) + throws Exception + { _write(writer, subscriptionDurability, context); } - public final static SubscriptionDurability _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final SubscriptionDurability _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,37 +70,37 @@ public final static SubscriptionDurability _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final SubscriptionDurability subscriptionDurability = new SubscriptionDurability(); + SubscriptionDurability subscriptionDurability = new SubscriptionDurability(); context.beforeUnmarshal(subscriptionDurability, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { return context.unexpectedXsiType(reader, SubscriptionDurability.class); } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, subscriptionDurability); subscriptionDurability.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id")); } } // VALUE: value - final String valueRaw = reader.getElementText(); + String valueRaw = reader.getElementText(); String value = null; boolean valueConverted; try { value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); valueConverted = true; - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); valueConverted = false; } @@ -109,48 +114,50 @@ public final static SubscriptionDurability _read(final XoXMLStreamReader reader, return subscriptionDurability; } - public final SubscriptionDurability read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final SubscriptionDurability read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final SubscriptionDurability subscriptionDurability, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, SubscriptionDurability subscriptionDurability, RuntimeContext context) + throws Exception + { if (subscriptionDurability == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (SubscriptionDurability.class != subscriptionDurability.getClass()) { + if (SubscriptionDurability.class!= subscriptionDurability.getClass()) { context.unexpectedSubclass(writer, subscriptionDurability, SubscriptionDurability.class); - return; + return ; } context.beforeMarshal(subscriptionDurability, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = subscriptionDurability.id; - if (idRaw != null) { + String idRaw = subscriptionDurability.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(subscriptionDurability, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // VALUE: value - final String valueRaw = subscriptionDurability.value; + String valueRaw = subscriptionDurability.value; String value = null; try { value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(subscriptionDurability, "value", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeCharacters(value); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Tag$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Tag$JAXB.java index 4635d20172e..5dfce9e126d 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Tag$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Tag$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.BodyContent$JAXB.parseBodyContent; import static org.apache.openejb.jee.BodyContent$JAXB.toStringBodyContent; @@ -46,30 +47,35 @@ "StringEquality" }) public class Tag$JAXB - extends JAXBObject { + extends JAXBObject +{ public Tag$JAXB() { super(Tag.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "tagType".intern()), Text$JAXB.class, Icon$JAXB.class, BodyContent$JAXB.class, Variable$JAXB.class, TldAttribute$JAXB.class, TldExtension$JAXB.class); } - public static Tag readTag(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Tag readTag(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeTag(final XoXMLStreamWriter writer, final Tag tag, final RuntimeContext context) - throws Exception { + public static void writeTag(XoXMLStreamWriter writer, Tag tag, RuntimeContext context) + throws Exception + { _write(writer, tag, context); } - public void write(final XoXMLStreamWriter writer, final Tag tag, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Tag tag, RuntimeContext context) + throws Exception + { _write(writer, tag, context); } - public final static Tag _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Tag _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -80,7 +86,7 @@ public final static Tag _read(final XoXMLStreamReader reader, RuntimeContext con context = new RuntimeContext(); } - final Tag tag = new Tag(); + Tag tag = new Tag(); context.beforeUnmarshal(tag, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -91,157 +97,157 @@ public final static Tag _read(final XoXMLStreamReader reader, RuntimeContext con List tagExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("tagType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("tagType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Tag.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, tag); tag.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = tag.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + String nameRaw = elementReader.getElementText(); - final String name; + String name; try { name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tag.name = name; - } else if (("tag-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("tag-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: tagClass - final String tagClassRaw = elementReader.getElementAsString(); + String tagClassRaw = elementReader.getElementText(); - final String tagClass; + String tagClass; try { tagClass = Adapters.collapsedStringAdapterAdapter.unmarshal(tagClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tag.tagClass = tagClass; - } else if (("tei-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("tei-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: teiClass - final String teiClassRaw = elementReader.getElementAsString(); + String teiClassRaw = elementReader.getElementText(); - final String teiClass; + String teiClass; try { teiClass = Adapters.collapsedStringAdapterAdapter.unmarshal(teiClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tag.teiClass = teiClass; - } else if (("body-content" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("body-content" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: bodyContent - final BodyContent bodyContent = parseBodyContent(elementReader, context, elementReader.getElementAsString()); - if (bodyContent != null) { + BodyContent bodyContent = parseBodyContent(elementReader, context, elementReader.getElementText()); + if (bodyContent!= null) { tag.bodyContent = bodyContent; } - } else if (("variable" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("variable" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: variable - final Variable variableItem = readVariable(elementReader, context); + Variable variableItem = readVariable(elementReader, context); if (variable == null) { variable = tag.variable; - if (variable != null) { + if (variable!= null) { variable.clear(); } else { - variable = new ArrayList(); + variable = new ArrayList<>(); } } variable.add(variableItem); - } else if (("attribute" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("attribute" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: attribute - final TldAttribute attributeItem = readTldAttribute(elementReader, context); + TldAttribute attributeItem = readTldAttribute(elementReader, context); if (attribute1 == null) { attribute1 = tag.attribute; if (attribute1 != null) { - attribute1.clear(); + attribute1 .clear(); } else { - attribute1 = new ArrayList(); + attribute1 = new ArrayList<>(); } } - attribute1.add(attributeItem); - } else if (("dynamic-attributes" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + attribute1 .add(attributeItem); + } else if (("dynamic-attributes" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dynamicAttributes - final String dynamicAttributesRaw = elementReader.getElementAsString(); + String dynamicAttributesRaw = elementReader.getElementText(); - final String dynamicAttributes; + String dynamicAttributes; try { dynamicAttributes = Adapters.collapsedStringAdapterAdapter.unmarshal(dynamicAttributesRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tag.dynamicAttributes = dynamicAttributes; - } else if (("example" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("example" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: example - final String exampleRaw = elementReader.getElementAsString(); + String exampleRaw = elementReader.getElementText(); - final String example; + String example; try { example = Adapters.collapsedStringAdapterAdapter.unmarshal(exampleRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tag.example = example; - } else if (("tag-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("tag-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: tagExtension - final TldExtension tagExtensionItem = readTldExtension(elementReader, context); + TldExtension tagExtensionItem = readTldExtension(elementReader, context); if (tagExtension == null) { tagExtension = tag.tagExtension; - if (tagExtension != null) { + if (tagExtension!= null) { tagExtension.clear(); } else { - tagExtension = new ArrayList(); + tagExtension = new ArrayList<>(); } } tagExtension.add(tagExtensionItem); @@ -249,30 +255,30 @@ public final static Tag _read(final XoXMLStreamReader reader, RuntimeContext con 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", "name"), new QName("http://java.sun.com/xml/ns/javaee", "tag-class"), new QName("http://java.sun.com/xml/ns/javaee", "tei-class"), new QName("http://java.sun.com/xml/ns/javaee", "body-content"), new QName("http://java.sun.com/xml/ns/javaee", "variable"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "dynamic-attributes"), new QName("http://java.sun.com/xml/ns/javaee", "example"), new QName("http://java.sun.com/xml/ns/javaee", "tag-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - tag.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + tag.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Tag.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - tag.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + tag.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, Tag.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { tag.icon = icon; } - if (variable != null) { + if (variable!= null) { tag.variable = variable; } if (attribute1 != null) { tag.attribute = attribute1; } - if (tagExtension != null) { + if (tagExtension!= null) { tag.tagExtension = tagExtension; } @@ -281,38 +287,40 @@ public final static Tag _read(final XoXMLStreamReader reader, RuntimeContext con return tag; } - public final Tag read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Tag read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Tag tag, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Tag tag, RuntimeContext context) + throws Exception + { if (tag == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Tag.class != tag.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Tag.class!= tag.getClass()) { context.unexpectedSubclass(writer, tag, Tag.class); - return; + return ; } context.beforeMarshal(tag, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = tag.id; - if (idRaw != null) { + String idRaw = tag.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tag, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -322,12 +330,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Tag tag, R Text[] descriptions = null; try { descriptions = tag.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(tag, "descriptions", Tag.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -341,12 +349,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Tag tag, R Text[] displayNames = null; try { displayNames = tag.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(tag, "displayNames", Tag.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -357,10 +365,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Tag tag, R } // ELEMENT: icon - final LocalCollection icon = tag.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = tag.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -371,14 +379,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Tag tag, R } // ELEMENT: name - final String nameRaw = tag.name; + String nameRaw = tag.name; String name = null; try { name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tag, "name", CollapsedStringAdapter.class, String.class, String.class, e); } - if (name != null) { + if (name!= null) { writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(name); writer.writeEndElement(); @@ -387,14 +395,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Tag tag, R } // ELEMENT: tagClass - final String tagClassRaw = tag.tagClass; + String tagClassRaw = tag.tagClass; String tagClass = null; try { tagClass = Adapters.collapsedStringAdapterAdapter.marshal(tagClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tag, "tagClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (tagClass != null) { + if (tagClass!= null) { writer.writeStartElement(prefix, "tag-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(tagClass); writer.writeEndElement(); @@ -403,22 +411,22 @@ public final static void _write(final XoXMLStreamWriter writer, final Tag tag, R } // ELEMENT: teiClass - final String teiClassRaw = tag.teiClass; + String teiClassRaw = tag.teiClass; String teiClass = null; try { teiClass = Adapters.collapsedStringAdapterAdapter.marshal(teiClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tag, "teiClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (teiClass != null) { + if (teiClass!= null) { writer.writeStartElement(prefix, "tei-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(teiClass); writer.writeEndElement(); } // ELEMENT: bodyContent - final BodyContent bodyContent = tag.bodyContent; - if (bodyContent != null) { + BodyContent bodyContent = tag.bodyContent; + if (bodyContent!= null) { writer.writeStartElement(prefix, "body-content", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringBodyContent(tag, null, context, bodyContent)); writer.writeEndElement(); @@ -427,11 +435,11 @@ public final static void _write(final XoXMLStreamWriter writer, final Tag tag, R } // ELEMENT: variable - final List variable = tag.variable; - if (variable != null) { - for (final Variable variableItem : variable) { + List variable = tag.variable; + if (variable!= null) { + for (Variable variableItem: variable) { writer.writeStartElement(prefix, "variable", "http://java.sun.com/xml/ns/javaee"); - if (variableItem != null) { + if (variableItem!= null) { writeVariable(writer, variableItem, context); } else { writer.writeXsiNil(); @@ -441,11 +449,11 @@ public final static void _write(final XoXMLStreamWriter writer, final Tag tag, R } // ELEMENT: attribute - final List attribute = tag.attribute; - if (attribute != null) { - for (final TldAttribute attributeItem : attribute) { + List attribute = tag.attribute; + if (attribute!= null) { + for (TldAttribute attributeItem: attribute) { writer.writeStartElement(prefix, "attribute", "http://java.sun.com/xml/ns/javaee"); - if (attributeItem != null) { + if (attributeItem!= null) { writeTldAttribute(writer, attributeItem, context); } else { writer.writeXsiNil(); @@ -455,38 +463,38 @@ public final static void _write(final XoXMLStreamWriter writer, final Tag tag, R } // ELEMENT: dynamicAttributes - final String dynamicAttributesRaw = tag.dynamicAttributes; + String dynamicAttributesRaw = tag.dynamicAttributes; String dynamicAttributes = null; try { dynamicAttributes = Adapters.collapsedStringAdapterAdapter.marshal(dynamicAttributesRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tag, "dynamicAttributes", CollapsedStringAdapter.class, String.class, String.class, e); } - if (dynamicAttributes != null) { + if (dynamicAttributes!= null) { writer.writeStartElement(prefix, "dynamic-attributes", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(dynamicAttributes); writer.writeEndElement(); } // ELEMENT: example - final String exampleRaw = tag.example; + String exampleRaw = tag.example; String example = null; try { example = Adapters.collapsedStringAdapterAdapter.marshal(exampleRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tag, "example", CollapsedStringAdapter.class, String.class, String.class, e); } - if (example != null) { + if (example!= null) { writer.writeStartElement(prefix, "example", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(example); writer.writeEndElement(); } // ELEMENT: tagExtension - final List tagExtension = tag.tagExtension; - if (tagExtension != null) { - for (final TldExtension tagExtensionItem : tagExtension) { - if (tagExtensionItem != null) { + List tagExtension = tag.tagExtension; + if (tagExtension!= null) { + for (TldExtension tagExtensionItem: tagExtension) { + if (tagExtensionItem!= null) { writer.writeStartElement(prefix, "tag-extension", "http://java.sun.com/xml/ns/javaee"); writeTldExtension(writer, tagExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TagFile$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TagFile$JAXB.java index 5d7926697af..26ffa60131f 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TagFile$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TagFile$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -40,30 +41,35 @@ "StringEquality" }) public class TagFile$JAXB - extends JAXBObject { + extends JAXBObject +{ public TagFile$JAXB() { super(TagFile.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "tagFileType".intern()), Text$JAXB.class, Icon$JAXB.class, TldExtension$JAXB.class); } - public static TagFile readTagFile(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static TagFile readTagFile(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeTagFile(final XoXMLStreamWriter writer, final TagFile tagFile, final RuntimeContext context) - throws Exception { + public static void writeTagFile(XoXMLStreamWriter writer, TagFile tagFile, RuntimeContext context) + throws Exception + { _write(writer, tagFile, context); } - public void write(final XoXMLStreamWriter writer, final TagFile tagFile, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, TagFile tagFile, RuntimeContext context) + throws Exception + { _write(writer, tagFile, context); } - public final static TagFile _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final TagFile _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -74,7 +80,7 @@ public final static TagFile _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final TagFile tagFile = new TagFile(); + TagFile tagFile = new TagFile(); context.beforeUnmarshal(tagFile, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -83,101 +89,101 @@ public final static TagFile _read(final XoXMLStreamReader reader, RuntimeContext List tagExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("tagFileType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("tagFileType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, TagFile.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, tagFile); tagFile.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = tagFile.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + String nameRaw = elementReader.getElementText(); - final String name; + String name; try { name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tagFile.name = name; - } else if (("path" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("path" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: path - final String pathRaw = elementReader.getElementAsString(); + String pathRaw = elementReader.getElementText(); - final String path; + String path; try { path = Adapters.collapsedStringAdapterAdapter.unmarshal(pathRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tagFile.path = path; - } else if (("example" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("example" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: example - final String exampleRaw = elementReader.getElementAsString(); + String exampleRaw = elementReader.getElementText(); - final String example; + String example; try { example = Adapters.collapsedStringAdapterAdapter.unmarshal(exampleRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tagFile.example = example; - } else if (("tag-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("tag-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: tagExtension - final TldExtension tagExtensionItem = readTldExtension(elementReader, context); + TldExtension tagExtensionItem = readTldExtension(elementReader, context); if (tagExtension == null) { tagExtension = tagFile.tagExtension; - if (tagExtension != null) { + if (tagExtension!= null) { tagExtension.clear(); } else { - tagExtension = new ArrayList(); + tagExtension = new ArrayList<>(); } } tagExtension.add(tagExtensionItem); @@ -185,24 +191,24 @@ public final static TagFile _read(final XoXMLStreamReader reader, RuntimeContext 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", "name"), new QName("http://java.sun.com/xml/ns/javaee", "path"), new QName("http://java.sun.com/xml/ns/javaee", "example"), new QName("http://java.sun.com/xml/ns/javaee", "tag-extension")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - tagFile.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + tagFile.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, TagFile.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - tagFile.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + tagFile.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, TagFile.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { tagFile.icon = icon; } - if (tagExtension != null) { + if (tagExtension!= null) { tagFile.tagExtension = tagExtension; } @@ -211,38 +217,40 @@ public final static TagFile _read(final XoXMLStreamReader reader, RuntimeContext return tagFile; } - public final TagFile read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final TagFile read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final TagFile tagFile, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, TagFile tagFile, RuntimeContext context) + throws Exception + { if (tagFile == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (TagFile.class != tagFile.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (TagFile.class!= tagFile.getClass()) { context.unexpectedSubclass(writer, tagFile, TagFile.class); - return; + return ; } context.beforeMarshal(tagFile, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = tagFile.id; - if (idRaw != null) { + String idRaw = tagFile.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tagFile, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -252,12 +260,12 @@ public final static void _write(final XoXMLStreamWriter writer, final TagFile ta Text[] descriptions = null; try { descriptions = tagFile.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(tagFile, "descriptions", TagFile.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -271,12 +279,12 @@ public final static void _write(final XoXMLStreamWriter writer, final TagFile ta Text[] displayNames = null; try { displayNames = tagFile.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(tagFile, "displayNames", TagFile.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -287,10 +295,10 @@ public final static void _write(final XoXMLStreamWriter writer, final TagFile ta } // ELEMENT: icon - final LocalCollection icon = tagFile.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = tagFile.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -301,14 +309,14 @@ public final static void _write(final XoXMLStreamWriter writer, final TagFile ta } // ELEMENT: name - final String nameRaw = tagFile.name; + String nameRaw = tagFile.name; String name = null; try { name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tagFile, "name", CollapsedStringAdapter.class, String.class, String.class, e); } - if (name != null) { + if (name!= null) { writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(name); writer.writeEndElement(); @@ -317,14 +325,14 @@ public final static void _write(final XoXMLStreamWriter writer, final TagFile ta } // ELEMENT: path - final String pathRaw = tagFile.path; + String pathRaw = tagFile.path; String path = null; try { path = Adapters.collapsedStringAdapterAdapter.marshal(pathRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tagFile, "path", CollapsedStringAdapter.class, String.class, String.class, e); } - if (path != null) { + if (path!= null) { writer.writeStartElement(prefix, "path", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(path); writer.writeEndElement(); @@ -333,24 +341,24 @@ public final static void _write(final XoXMLStreamWriter writer, final TagFile ta } // ELEMENT: example - final String exampleRaw = tagFile.example; + String exampleRaw = tagFile.example; String example = null; try { example = Adapters.collapsedStringAdapterAdapter.marshal(exampleRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tagFile, "example", CollapsedStringAdapter.class, String.class, String.class, e); } - if (example != null) { + if (example!= null) { writer.writeStartElement(prefix, "example", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(example); writer.writeEndElement(); } // ELEMENT: tagExtension - final List tagExtension = tagFile.tagExtension; - if (tagExtension != null) { - for (final TldExtension tagExtensionItem : tagExtension) { - if (tagExtensionItem != null) { + List tagExtension = tagFile.tagExtension; + if (tagExtension!= null) { + for (TldExtension tagExtensionItem: tagExtension) { + if (tagExtensionItem!= null) { writer.writeStartElement(prefix, "tag-extension", "http://java.sun.com/xml/ns/javaee"); writeTldExtension(writer, tagExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Taglib$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Taglib$JAXB.java index 1b2b4320261..04629245bb7 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Taglib$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Taglib$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class Taglib$JAXB - extends JAXBObject { + extends JAXBObject +{ public Taglib$JAXB() { super(Taglib.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "taglibType".intern())); } - public static Taglib readTaglib(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Taglib readTaglib(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeTaglib(final XoXMLStreamWriter writer, final Taglib taglib, final RuntimeContext context) - throws Exception { + public static void writeTaglib(XoXMLStreamWriter writer, Taglib taglib, RuntimeContext context) + throws Exception + { _write(writer, taglib, context); } - public void write(final XoXMLStreamWriter writer, final Taglib taglib, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Taglib taglib, RuntimeContext context) + throws Exception + { _write(writer, taglib, context); } - public final static Taglib _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Taglib _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,53 +70,53 @@ public final static Taglib _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final Taglib taglib = new Taglib(); + Taglib taglib = new Taglib(); context.beforeUnmarshal(taglib, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("taglibType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("taglibType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Taglib.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, taglib); taglib.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("taglib-uri" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("taglib-uri" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: taglibUri - final String taglibUriRaw = elementReader.getElementAsString(); + String taglibUriRaw = elementReader.getElementText(); - final String taglibUri; + String taglibUri; try { taglibUri = Adapters.collapsedStringAdapterAdapter.unmarshal(taglibUriRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } taglib.taglibUri = taglibUri; - } else if (("taglib-location" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("taglib-location" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: taglibLocation - final String taglibLocationRaw = elementReader.getElementAsString(); + String taglibLocationRaw = elementReader.getElementText(); - final String taglibLocation; + String taglibLocation; try { taglibLocation = Adapters.collapsedStringAdapterAdapter.unmarshal(taglibLocationRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -127,52 +132,54 @@ public final static Taglib _read(final XoXMLStreamReader reader, RuntimeContext return taglib; } - public final Taglib read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Taglib read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Taglib taglib, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Taglib taglib, RuntimeContext context) + throws Exception + { if (taglib == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Taglib.class != taglib.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Taglib.class!= taglib.getClass()) { context.unexpectedSubclass(writer, taglib, Taglib.class); - return; + return ; } context.beforeMarshal(taglib, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = taglib.id; - if (idRaw != null) { + String idRaw = taglib.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(taglib, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: taglibUri - final String taglibUriRaw = taglib.taglibUri; + String taglibUriRaw = taglib.taglibUri; String taglibUri = null; try { taglibUri = Adapters.collapsedStringAdapterAdapter.marshal(taglibUriRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(taglib, "taglibUri", CollapsedStringAdapter.class, String.class, String.class, e); } - if (taglibUri != null) { + if (taglibUri!= null) { writer.writeStartElement(prefix, "taglib-uri", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(taglibUri); writer.writeEndElement(); @@ -181,14 +188,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Taglib tag } // ELEMENT: taglibLocation - final String taglibLocationRaw = taglib.taglibLocation; + String taglibLocationRaw = taglib.taglibLocation; String taglibLocation = null; try { taglibLocation = Adapters.collapsedStringAdapterAdapter.marshal(taglibLocationRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(taglib, "taglibLocation", CollapsedStringAdapter.class, String.class, String.class, e); } - if (taglibLocation != null) { + if (taglibLocation!= null) { writer.writeStartElement(prefix, "taglib-location", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(taglibLocation); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Text$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Text$JAXB.java index 25b1f3c0525..dac2c3071c4 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Text$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Text$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class Text$JAXB - extends JAXBObject { + extends JAXBObject +{ public Text$JAXB() { super(Text.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "string".intern())); } - public static Text readText(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Text readText(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeText(final XoXMLStreamWriter writer, final Text text, final RuntimeContext context) - throws Exception { + public static void writeText(XoXMLStreamWriter writer, Text text, RuntimeContext context) + throws Exception + { _write(writer, text, context); } - public void write(final XoXMLStreamWriter writer, final Text text, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Text text, RuntimeContext context) + throws Exception + { _write(writer, text, context); } - public final static Text _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Text _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,42 +70,42 @@ public final static Text _read(final XoXMLStreamReader reader, RuntimeContext co context = new RuntimeContext(); } - final Text text = new Text(); + Text text = new Text(); context.beforeUnmarshal(text, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("string" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("string"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Text.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, text); text.id = id; - } else if (("lang" == attribute.getLocalName()) && ("http://www.w3.org/XML/1998/namespace" == attribute.getNamespace())) { + } else if (("lang" == attribute.getLocalName())&&("http://www.w3.org/XML/1998/namespace" == attribute.getNamespace())) { // ATTRIBUTE: lang text.lang = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("http://www.w3.org/XML/1998/namespace", "lang")); } } // VALUE: value - final String valueRaw = reader.getElementText(); + String valueRaw = reader.getElementText(); String value = null; boolean valueConverted; try { value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); valueConverted = true; - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); valueConverted = false; } @@ -114,60 +119,62 @@ public final static Text _read(final XoXMLStreamReader reader, RuntimeContext co return text; } - public final Text read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Text read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Text text, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Text text, RuntimeContext context) + throws Exception + { if (text == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (Text.class != text.getClass()) { + if (Text.class!= text.getClass()) { context.unexpectedSubclass(writer, text, Text.class); - return; + return ; } context.beforeMarshal(text, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = text.id; - if (idRaw != null) { + String idRaw = text.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(text, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: lang - final String langRaw = text.lang; - if (langRaw != null) { + String langRaw = text.lang; + if (langRaw!= null) { String lang = null; try { lang = Adapters.collapsedStringAdapterAdapter.marshal(langRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(text, "lang", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("xml", "http://www.w3.org/XML/1998/namespace", "lang", lang); } // VALUE: value - final String valueRaw = text.value; + String valueRaw = text.value; String value = null; try { value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(text, "value", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeCharacters(value); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Timeout$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Timeout$JAXB.java index becae3f1561..5f4e36204dd 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Timeout$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Timeout$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.concurrent.TimeUnit; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,39 +28,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.concurrent.TimeUnit; - @SuppressWarnings({ "StringEquality" }) public class Timeout$JAXB - extends JAXBObject { + extends JAXBObject +{ public Timeout$JAXB() { super(Timeout.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "access-timeoutType".intern())); } - public static Timeout readTimeout(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Timeout readTimeout(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeTimeout(final XoXMLStreamWriter writer, final Timeout timeout, final RuntimeContext context) - throws Exception { + public static void writeTimeout(XoXMLStreamWriter writer, Timeout timeout, RuntimeContext context) + throws Exception + { _write(writer, timeout, context); } - public void write(final XoXMLStreamWriter writer, final Timeout timeout, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Timeout timeout, RuntimeContext context) + throws Exception + { _write(writer, timeout, context); } - public final static Timeout _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Timeout _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -66,49 +71,49 @@ public final static Timeout _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final Timeout timeout = new Timeout(); + Timeout timeout = new Timeout(); context.beforeUnmarshal(timeout, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("access-timeoutType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("access-timeoutType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Timeout.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, timeout); timeout.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: timeout - final Long timeout1 = Long.valueOf(elementReader.getElementAsString()); + Long timeout1 = Long.valueOf(elementReader.getElementText()); timeout.timeout = timeout1; - } else if (("unit" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("unit" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: unit - final String unitRaw = elementReader.getElementAsString(); + String unitRaw = elementReader.getElementText(); - final TimeUnit unit; + TimeUnit unit; try { unit = Adapters.timeUnitAdapterAdapter.unmarshal(unitRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, TimeUnitAdapter.class, TimeUnit.class, TimeUnit.class, e); continue; } - if (unit != null) { + if (unit!= null) { timeout.unit = unit; } } else { @@ -121,58 +126,60 @@ public final static Timeout _read(final XoXMLStreamReader reader, RuntimeContext return timeout; } - public final Timeout read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Timeout read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Timeout timeout, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Timeout timeout, RuntimeContext context) + throws Exception + { if (timeout == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Timeout.class != timeout.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Timeout.class!= timeout.getClass()) { context.unexpectedSubclass(writer, timeout, Timeout.class); - return; + return ; } context.beforeMarshal(timeout, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = timeout.id; - if (idRaw != null) { + String idRaw = timeout.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timeout, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: timeout - final Long timeout1 = timeout.timeout; + Long timeout1 = timeout.timeout; writer.writeStartElement(prefix, "timeout", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(Long.toString(timeout1)); writer.writeEndElement(); // ELEMENT: unit - final TimeUnit unitRaw = timeout.unit; + TimeUnit unitRaw = timeout.unit; String unit = null; try { unit = Adapters.timeUnitAdapterAdapter.marshal(unitRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timeout, "unit", TimeUnitAdapter.class, TimeUnit.class, TimeUnit.class, e); } - if (unit != null) { + if (unit!= null) { writer.writeStartElement(prefix, "unit", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(unit); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Timer$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Timer$JAXB.java index fce442caf50..7e80d50a446 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Timer$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Timer$JAXB.java @@ -1,21 +1,29 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,13 +31,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.NamedMethod$JAXB.readNamedMethod; import static org.apache.openejb.jee.NamedMethod$JAXB.writeNamedMethod; @@ -42,14 +43,15 @@ "StringEquality" }) public class Timer$JAXB - extends JAXBObject { + extends JAXBObject +{ - private final static DatatypeFactory datatypeFactory; + private static final DatatypeFactory datatypeFactory; static { try { datatypeFactory = DatatypeFactory.newInstance(); - } catch (final DatatypeConfigurationException e) { + } catch (DatatypeConfigurationException e) { throw new RuntimeException("Unable to initialize DatatypeFactory", e); } } @@ -58,23 +60,27 @@ public class Timer$JAXB super(Timer.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "timerType".intern()), Text$JAXB.class, TimerSchedule$JAXB.class, NamedMethod$JAXB.class); } - public static Timer readTimer(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Timer readTimer(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeTimer(final XoXMLStreamWriter writer, final Timer timer, final RuntimeContext context) - throws Exception { + public static void writeTimer(XoXMLStreamWriter writer, Timer timer, RuntimeContext context) + throws Exception + { _write(writer, timer, context); } - public void write(final XoXMLStreamWriter writer, final Timer timer, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Timer timer, RuntimeContext context) + throws Exception + { _write(writer, timer, context); } - public final static Timer _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Timer _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -85,81 +91,81 @@ public final static Timer _read(final XoXMLStreamReader reader, RuntimeContext c context = new RuntimeContext(); } - final Timer timer = new Timer(); + Timer timer = new Timer(); context.beforeUnmarshal(timer, LifecycleCallback.NONE); ArrayList 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())) { + 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))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("schedule" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("schedule" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: schedule - final TimerSchedule schedule = readTimerSchedule(elementReader, context); + TimerSchedule schedule = readTimerSchedule(elementReader, context); timer.schedule = schedule; - } else if (("start" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("start" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: start - final XMLGregorianCalendar start = datatypeFactory.newXMLGregorianCalendar(elementReader.getElementAsString()); + XMLGregorianCalendar start = datatypeFactory.newXMLGregorianCalendar(elementReader.getElementText()); timer.start = start; - } else if (("end" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("end" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: end - final XMLGregorianCalendar end = datatypeFactory.newXMLGregorianCalendar(elementReader.getElementAsString()); + XMLGregorianCalendar end = datatypeFactory.newXMLGregorianCalendar(elementReader.getElementText()); timer.end = end; - } else if (("timeout-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("timeout-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: timeoutMethod - final NamedMethod timeoutMethod = readNamedMethod(elementReader, context); + NamedMethod timeoutMethod = readNamedMethod(elementReader, context); timer.timeoutMethod = timeoutMethod; - } else if (("persistent" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } 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())); + Boolean persistent = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); timer.persistent = persistent; - } else if (("timezone" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("timezone" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: timezone - final String timezoneRaw = elementReader.getElementAsString(); + String timezoneRaw = elementReader.getElementText(); - final String timezone; + String timezone; try { timezone = Adapters.collapsedStringAdapterAdapter.unmarshal(timezoneRaw); - } catch (final Exception e) { + } catch (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())) { + } else if (("info" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: info - final String infoRaw = elementReader.getElementAsString(); + String infoRaw = elementReader.getElementText(); - final String info; + String info; try { info = Adapters.collapsedStringAdapterAdapter.unmarshal(infoRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -169,10 +175,10 @@ public final static Timer _read(final XoXMLStreamReader reader, RuntimeContext c 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) { + if (descriptions!= null) { try { - timer.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + timer.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Timer.class, "setDescriptions", Text[].class, e); } } @@ -182,38 +188,40 @@ public final static Timer _read(final XoXMLStreamReader reader, RuntimeContext c return timer; } - public final Timer read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Timer read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Timer timer, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Timer timer, RuntimeContext context) + throws Exception + { if (timer == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Timer.class != timer.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Timer.class!= timer.getClass()) { context.unexpectedSubclass(writer, timer, Timer.class); - return; + return ; } context.beforeMarshal(timer, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = timer.id; - if (idRaw != null) { + String idRaw = timer.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timer, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -223,12 +231,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Timer time Text[] descriptions = null; try { descriptions = timer.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(timer, "descriptions", Timer.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -239,8 +247,8 @@ public final static void _write(final XoXMLStreamWriter writer, final Timer time } // ELEMENT: schedule - final TimerSchedule schedule = timer.schedule; - if (schedule != null) { + TimerSchedule schedule = timer.schedule; + if (schedule!= null) { writer.writeStartElement(prefix, "schedule", "http://java.sun.com/xml/ns/javaee"); writeTimerSchedule(writer, schedule, context); writer.writeEndElement(); @@ -249,24 +257,24 @@ public final static void _write(final XoXMLStreamWriter writer, final Timer time } // ELEMENT: start - final XMLGregorianCalendar start = timer.start; - if (start != null) { + 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) { + 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) { + 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(); @@ -275,36 +283,36 @@ public final static void _write(final XoXMLStreamWriter writer, final Timer time } // ELEMENT: persistent - final Boolean persistent = timer.persistent; - if (persistent != null) { + 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 timezoneRaw = timer.timezone; String timezone = null; try { timezone = Adapters.collapsedStringAdapterAdapter.marshal(timezoneRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timer, "timezone", CollapsedStringAdapter.class, String.class, String.class, e); } - if (timezone != null) { + 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 infoRaw = timer.info; String info = null; try { info = Adapters.collapsedStringAdapterAdapter.marshal(infoRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timer, "info", CollapsedStringAdapter.class, String.class, String.class, e); } - if (info != null) { + if (info!= null) { writer.writeStartElement(prefix, "info", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(info); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TimerSchedule$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TimerSchedule$JAXB.java index 716325d823f..5dd48ec5eff 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TimerSchedule$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TimerSchedule$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class TimerSchedule$JAXB - extends JAXBObject { + extends JAXBObject +{ public TimerSchedule$JAXB() { super(TimerSchedule.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "timer-scheduleType".intern())); } - public static TimerSchedule readTimerSchedule(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static TimerSchedule readTimerSchedule(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeTimerSchedule(final XoXMLStreamWriter writer, final TimerSchedule timerSchedule, final RuntimeContext context) - throws Exception { + public static void writeTimerSchedule(XoXMLStreamWriter writer, TimerSchedule timerSchedule, RuntimeContext context) + throws Exception + { _write(writer, timerSchedule, context); } - public void write(final XoXMLStreamWriter writer, final TimerSchedule timerSchedule, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, TimerSchedule timerSchedule, RuntimeContext context) + throws Exception + { _write(writer, timerSchedule, context); } - public final static TimerSchedule _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final TimerSchedule _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,118 +70,118 @@ public final static TimerSchedule _read(final XoXMLStreamReader reader, RuntimeC context = new RuntimeContext(); } - final TimerSchedule timerSchedule = new TimerSchedule(); + TimerSchedule timerSchedule = new TimerSchedule(); context.beforeUnmarshal(timerSchedule, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("timer-scheduleType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + 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 (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + 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()) { + } 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 (("second" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("second" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: second - final String secondRaw = elementReader.getElementAsString(); + String secondRaw = elementReader.getElementText(); - final String second; + String second; try { second = Adapters.collapsedStringAdapterAdapter.unmarshal(secondRaw); - } catch (final Exception e) { + } 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())) { + } else if (("minute" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: minute - final String minuteRaw = elementReader.getElementAsString(); + String minuteRaw = elementReader.getElementText(); - final String minute; + String minute; try { minute = Adapters.collapsedStringAdapterAdapter.unmarshal(minuteRaw); - } catch (final Exception e) { + } 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())) { + } else if (("hour" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: hour - final String hourRaw = elementReader.getElementAsString(); + String hourRaw = elementReader.getElementText(); - final String hour; + String hour; try { hour = Adapters.collapsedStringAdapterAdapter.unmarshal(hourRaw); - } catch (final Exception e) { + } 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())) { + } else if (("day-of-month" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dayOfMonth - final String dayOfMonthRaw = elementReader.getElementAsString(); + String dayOfMonthRaw = elementReader.getElementText(); - final String dayOfMonth; + String dayOfMonth; try { dayOfMonth = Adapters.collapsedStringAdapterAdapter.unmarshal(dayOfMonthRaw); - } catch (final Exception e) { + } 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())) { + } else if (("month" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: month - final String monthRaw = elementReader.getElementAsString(); + String monthRaw = elementReader.getElementText(); - final String month; + String month; try { month = Adapters.collapsedStringAdapterAdapter.unmarshal(monthRaw); - } catch (final Exception e) { + } 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())) { + } else if (("day-of-week" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dayOfWeek - final String dayOfWeekRaw = elementReader.getElementAsString(); + String dayOfWeekRaw = elementReader.getElementText(); - final String dayOfWeek; + String dayOfWeek; try { dayOfWeek = Adapters.collapsedStringAdapterAdapter.unmarshal(dayOfWeekRaw); - } catch (final Exception e) { + } 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())) { + } else if (("year" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: year - final String yearRaw = elementReader.getElementAsString(); + String yearRaw = elementReader.getElementText(); - final String year; + String year; try { year = Adapters.collapsedStringAdapterAdapter.unmarshal(yearRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -192,136 +197,138 @@ public final static TimerSchedule _read(final XoXMLStreamReader reader, RuntimeC return timerSchedule; } - public final TimerSchedule read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final TimerSchedule read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final TimerSchedule timerSchedule, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, TimerSchedule timerSchedule, RuntimeContext context) + throws Exception + { if (timerSchedule == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (TimerSchedule.class != timerSchedule.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (TimerSchedule.class!= timerSchedule.getClass()) { context.unexpectedSubclass(writer, timerSchedule, TimerSchedule.class); - return; + return ; } context.beforeMarshal(timerSchedule, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = timerSchedule.id; - if (idRaw != null) { + String idRaw = timerSchedule.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timerSchedule, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: second - final String secondRaw = timerSchedule.second; + String secondRaw = timerSchedule.second; String second = null; try { second = Adapters.collapsedStringAdapterAdapter.marshal(secondRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timerSchedule, "second", CollapsedStringAdapter.class, String.class, String.class, e); } - if (second != null) { + if (second!= null) { writer.writeStartElement(prefix, "second", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(second); writer.writeEndElement(); } // ELEMENT: minute - final String minuteRaw = timerSchedule.minute; + String minuteRaw = timerSchedule.minute; String minute = null; try { minute = Adapters.collapsedStringAdapterAdapter.marshal(minuteRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timerSchedule, "minute", CollapsedStringAdapter.class, String.class, String.class, e); } - if (minute != null) { + if (minute!= null) { writer.writeStartElement(prefix, "minute", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(minute); writer.writeEndElement(); } // ELEMENT: hour - final String hourRaw = timerSchedule.hour; + String hourRaw = timerSchedule.hour; String hour = null; try { hour = Adapters.collapsedStringAdapterAdapter.marshal(hourRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timerSchedule, "hour", CollapsedStringAdapter.class, String.class, String.class, e); } - if (hour != null) { + if (hour!= null) { writer.writeStartElement(prefix, "hour", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(hour); writer.writeEndElement(); } // ELEMENT: dayOfMonth - final String dayOfMonthRaw = timerSchedule.dayOfMonth; + String dayOfMonthRaw = timerSchedule.dayOfMonth; String dayOfMonth = null; try { dayOfMonth = Adapters.collapsedStringAdapterAdapter.marshal(dayOfMonthRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timerSchedule, "dayOfMonth", CollapsedStringAdapter.class, String.class, String.class, e); } - if (dayOfMonth != null) { + if (dayOfMonth!= null) { writer.writeStartElement(prefix, "day-of-month", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(dayOfMonth); writer.writeEndElement(); } // ELEMENT: month - final String monthRaw = timerSchedule.month; + String monthRaw = timerSchedule.month; String month = null; try { month = Adapters.collapsedStringAdapterAdapter.marshal(monthRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timerSchedule, "month", CollapsedStringAdapter.class, String.class, String.class, e); } - if (month != null) { + if (month!= null) { writer.writeStartElement(prefix, "month", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(month); writer.writeEndElement(); } // ELEMENT: dayOfWeek - final String dayOfWeekRaw = timerSchedule.dayOfWeek; + String dayOfWeekRaw = timerSchedule.dayOfWeek; String dayOfWeek = null; try { dayOfWeek = Adapters.collapsedStringAdapterAdapter.marshal(dayOfWeekRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timerSchedule, "dayOfWeek", CollapsedStringAdapter.class, String.class, String.class, e); } - if (dayOfWeek != null) { + if (dayOfWeek!= null) { writer.writeStartElement(prefix, "day-of-week", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(dayOfWeek); writer.writeEndElement(); } // ELEMENT: year - final String yearRaw = timerSchedule.year; + String yearRaw = timerSchedule.year; String year = null; try { year = Adapters.collapsedStringAdapterAdapter.marshal(yearRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(timerSchedule, "year", CollapsedStringAdapter.class, String.class, String.class, e); } - if (year != null) { + if (year!= null) { writer.writeStartElement(prefix, "year", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(year); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldAttribute$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldAttribute$JAXB.java index e2856a99afe..cc1a8ada6e5 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldAttribute$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldAttribute$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -39,30 +40,35 @@ "StringEquality" }) public class TldAttribute$JAXB - extends JAXBObject { + extends JAXBObject +{ public TldAttribute$JAXB() { super(TldAttribute.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "tld-attributeType".intern()), Text$JAXB.class, TldDeferredValue$JAXB.class, TldDeferredMethod$JAXB.class); } - public static TldAttribute readTldAttribute(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static TldAttribute readTldAttribute(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeTldAttribute(final XoXMLStreamWriter writer, final TldAttribute tldAttribute, final RuntimeContext context) - throws Exception { + public static void writeTldAttribute(XoXMLStreamWriter writer, TldAttribute tldAttribute, RuntimeContext context) + throws Exception + { _write(writer, tldAttribute, context); } - public void write(final XoXMLStreamWriter writer, final TldAttribute tldAttribute, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, TldAttribute tldAttribute, RuntimeContext context) + throws Exception + { _write(writer, tldAttribute, context); } - public final static TldAttribute _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final TldAttribute _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -73,108 +79,108 @@ public final static TldAttribute _read(final XoXMLStreamReader reader, RuntimeCo context = new RuntimeContext(); } - final TldAttribute tldAttribute = new TldAttribute(); + TldAttribute tldAttribute = new TldAttribute(); context.beforeUnmarshal(tldAttribute, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("tld-attributeType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("tld-attributeType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, TldAttribute.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, tldAttribute); tldAttribute.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: name - final String nameRaw = elementReader.getElementAsString(); + String nameRaw = elementReader.getElementText(); - final String name; + String name; try { name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tldAttribute.name = name; - } else if (("required" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("required" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: required - final String requiredRaw = elementReader.getElementAsString(); + String requiredRaw = elementReader.getElementText(); - final String required; + String required; try { required = Adapters.collapsedStringAdapterAdapter.unmarshal(requiredRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tldAttribute.required = required; - } else if (("rtexprvalue" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("rtexprvalue" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: rtexprvalue - final String rtexprvalueRaw = elementReader.getElementAsString(); + String rtexprvalueRaw = elementReader.getElementText(); - final String rtexprvalue; + String rtexprvalue; try { rtexprvalue = Adapters.collapsedStringAdapterAdapter.unmarshal(rtexprvalueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tldAttribute.rtexprvalue = rtexprvalue; - } else if (("type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: type - final String typeRaw = elementReader.getElementAsString(); + String typeRaw = elementReader.getElementText(); - final String type; + String type; try { type = Adapters.collapsedStringAdapterAdapter.unmarshal(typeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tldAttribute.type = type; - } else if (("deferred-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("deferred-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: deferredValue - final TldDeferredValue deferredValue = readTldDeferredValue(elementReader, context); + TldDeferredValue deferredValue = readTldDeferredValue(elementReader, context); tldAttribute.deferredValue = deferredValue; - } else if (("deferred-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("deferred-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: deferredMethod - final TldDeferredMethod deferredMethod = readTldDeferredMethod(elementReader, context); + TldDeferredMethod deferredMethod = readTldDeferredMethod(elementReader, context); tldAttribute.deferredMethod = deferredMethod; - } else if (("fragment" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("fragment" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: fragment - final String fragmentRaw = elementReader.getElementAsString(); + String fragmentRaw = elementReader.getElementText(); - final String fragment; + String fragment; try { fragment = Adapters.collapsedStringAdapterAdapter.unmarshal(fragmentRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -184,10 +190,10 @@ public final static TldAttribute _read(final XoXMLStreamReader reader, RuntimeCo context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "required"), new QName("http://java.sun.com/xml/ns/javaee", "rtexprvalue"), new QName("http://java.sun.com/xml/ns/javaee", "type"), new QName("http://java.sun.com/xml/ns/javaee", "deferred-value"), new QName("http://java.sun.com/xml/ns/javaee", "deferred-method"), new QName("http://java.sun.com/xml/ns/javaee", "fragment")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - tldAttribute.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + tldAttribute.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, TldAttribute.class, "setDescriptions", Text[].class, e); } } @@ -197,38 +203,40 @@ public final static TldAttribute _read(final XoXMLStreamReader reader, RuntimeCo return tldAttribute; } - public final TldAttribute read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final TldAttribute read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final TldAttribute tldAttribute, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, TldAttribute tldAttribute, RuntimeContext context) + throws Exception + { if (tldAttribute == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (TldAttribute.class != tldAttribute.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (TldAttribute.class!= tldAttribute.getClass()) { context.unexpectedSubclass(writer, tldAttribute, TldAttribute.class); - return; + return ; } context.beforeMarshal(tldAttribute, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = tldAttribute.id; - if (idRaw != null) { + String idRaw = tldAttribute.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldAttribute, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -238,12 +246,12 @@ public final static void _write(final XoXMLStreamWriter writer, final TldAttribu Text[] descriptions = null; try { descriptions = tldAttribute.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(tldAttribute, "descriptions", TldAttribute.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -254,14 +262,14 @@ public final static void _write(final XoXMLStreamWriter writer, final TldAttribu } // ELEMENT: name - final String nameRaw = tldAttribute.name; + String nameRaw = tldAttribute.name; String name = null; try { name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldAttribute, "name", CollapsedStringAdapter.class, String.class, String.class, e); } - if (name != null) { + if (name!= null) { writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(name); writer.writeEndElement(); @@ -270,72 +278,72 @@ public final static void _write(final XoXMLStreamWriter writer, final TldAttribu } // ELEMENT: required - final String requiredRaw = tldAttribute.required; + String requiredRaw = tldAttribute.required; String required = null; try { required = Adapters.collapsedStringAdapterAdapter.marshal(requiredRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldAttribute, "required", CollapsedStringAdapter.class, String.class, String.class, e); } - if (required != null) { + if (required!= null) { writer.writeStartElement(prefix, "required", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(required); writer.writeEndElement(); } // ELEMENT: rtexprvalue - final String rtexprvalueRaw = tldAttribute.rtexprvalue; + String rtexprvalueRaw = tldAttribute.rtexprvalue; String rtexprvalue = null; try { rtexprvalue = Adapters.collapsedStringAdapterAdapter.marshal(rtexprvalueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldAttribute, "rtexprvalue", CollapsedStringAdapter.class, String.class, String.class, e); } - if (rtexprvalue != null) { + if (rtexprvalue!= null) { writer.writeStartElement(prefix, "rtexprvalue", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(rtexprvalue); writer.writeEndElement(); } // ELEMENT: type - final String typeRaw = tldAttribute.type; + String typeRaw = tldAttribute.type; String type = null; try { type = Adapters.collapsedStringAdapterAdapter.marshal(typeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldAttribute, "type", CollapsedStringAdapter.class, String.class, String.class, e); } - if (type != null) { + if (type!= null) { writer.writeStartElement(prefix, "type", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(type); writer.writeEndElement(); } // ELEMENT: deferredValue - final TldDeferredValue deferredValue = tldAttribute.deferredValue; - if (deferredValue != null) { + TldDeferredValue deferredValue = tldAttribute.deferredValue; + if (deferredValue!= null) { writer.writeStartElement(prefix, "deferred-value", "http://java.sun.com/xml/ns/javaee"); writeTldDeferredValue(writer, deferredValue, context); writer.writeEndElement(); } // ELEMENT: deferredMethod - final TldDeferredMethod deferredMethod = tldAttribute.deferredMethod; - if (deferredMethod != null) { + TldDeferredMethod deferredMethod = tldAttribute.deferredMethod; + if (deferredMethod!= null) { writer.writeStartElement(prefix, "deferred-method", "http://java.sun.com/xml/ns/javaee"); writeTldDeferredMethod(writer, deferredMethod, context); writer.writeEndElement(); } // ELEMENT: fragment - final String fragmentRaw = tldAttribute.fragment; + String fragmentRaw = tldAttribute.fragment; String fragment = null; try { fragment = Adapters.collapsedStringAdapterAdapter.marshal(fragmentRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldAttribute, "fragment", CollapsedStringAdapter.class, String.class, String.class, e); } - if (fragment != null) { + if (fragment!= null) { writer.writeStartElement(prefix, "fragment", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(fragment); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldDeferredMethod$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldDeferredMethod$JAXB.java index 23aa78662b7..dd595653877 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldDeferredMethod$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldDeferredMethod$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class TldDeferredMethod$JAXB - extends JAXBObject { + extends JAXBObject +{ public TldDeferredMethod$JAXB() { super(TldDeferredMethod.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "tld-deferred-methodType".intern())); } - public static TldDeferredMethod readTldDeferredMethod(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static TldDeferredMethod readTldDeferredMethod(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeTldDeferredMethod(final XoXMLStreamWriter writer, final TldDeferredMethod tldDeferredMethod, final RuntimeContext context) - throws Exception { + public static void writeTldDeferredMethod(XoXMLStreamWriter writer, TldDeferredMethod tldDeferredMethod, RuntimeContext context) + throws Exception + { _write(writer, tldDeferredMethod, context); } - public void write(final XoXMLStreamWriter writer, final TldDeferredMethod tldDeferredMethod, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, TldDeferredMethod tldDeferredMethod, RuntimeContext context) + throws Exception + { _write(writer, tldDeferredMethod, context); } - public final static TldDeferredMethod _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final TldDeferredMethod _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,40 +70,40 @@ public final static TldDeferredMethod _read(final XoXMLStreamReader reader, Runt context = new RuntimeContext(); } - final TldDeferredMethod tldDeferredMethod = new TldDeferredMethod(); + TldDeferredMethod tldDeferredMethod = new TldDeferredMethod(); context.beforeUnmarshal(tldDeferredMethod, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("tld-deferred-methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("tld-deferred-methodType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, TldDeferredMethod.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, tldDeferredMethod); tldDeferredMethod.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("method-signature" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("method-signature" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodSignature - final String methodSignatureRaw = elementReader.getElementAsString(); + String methodSignatureRaw = elementReader.getElementText(); - final String methodSignature; + String methodSignature; try { methodSignature = Adapters.collapsedStringAdapterAdapter.unmarshal(methodSignatureRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -114,51 +119,53 @@ public final static TldDeferredMethod _read(final XoXMLStreamReader reader, Runt return tldDeferredMethod; } - public final TldDeferredMethod read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final TldDeferredMethod read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final TldDeferredMethod tldDeferredMethod, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, TldDeferredMethod tldDeferredMethod, RuntimeContext context) + throws Exception + { if (tldDeferredMethod == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (TldDeferredMethod.class != tldDeferredMethod.getClass()) { + if (TldDeferredMethod.class!= tldDeferredMethod.getClass()) { context.unexpectedSubclass(writer, tldDeferredMethod, TldDeferredMethod.class); - return; + return ; } context.beforeMarshal(tldDeferredMethod, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = tldDeferredMethod.id; - if (idRaw != null) { + String idRaw = tldDeferredMethod.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldDeferredMethod, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: methodSignature - final String methodSignatureRaw = tldDeferredMethod.methodSignature; + String methodSignatureRaw = tldDeferredMethod.methodSignature; String methodSignature = null; try { methodSignature = Adapters.collapsedStringAdapterAdapter.marshal(methodSignatureRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldDeferredMethod, "methodSignature", CollapsedStringAdapter.class, String.class, String.class, e); } - if (methodSignature != null) { + if (methodSignature!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "method-signature"); writer.writeCharacters(methodSignature); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldDeferredValue$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldDeferredValue$JAXB.java index 5782c094f49..49d6645be42 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldDeferredValue$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldDeferredValue$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class TldDeferredValue$JAXB - extends JAXBObject { + extends JAXBObject +{ public TldDeferredValue$JAXB() { super(TldDeferredValue.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "tld-deferred-valueType".intern())); } - public static TldDeferredValue readTldDeferredValue(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static TldDeferredValue readTldDeferredValue(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeTldDeferredValue(final XoXMLStreamWriter writer, final TldDeferredValue tldDeferredValue, final RuntimeContext context) - throws Exception { + public static void writeTldDeferredValue(XoXMLStreamWriter writer, TldDeferredValue tldDeferredValue, RuntimeContext context) + throws Exception + { _write(writer, tldDeferredValue, context); } - public void write(final XoXMLStreamWriter writer, final TldDeferredValue tldDeferredValue, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, TldDeferredValue tldDeferredValue, RuntimeContext context) + throws Exception + { _write(writer, tldDeferredValue, context); } - public final static TldDeferredValue _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final TldDeferredValue _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,40 +70,40 @@ public final static TldDeferredValue _read(final XoXMLStreamReader reader, Runti context = new RuntimeContext(); } - final TldDeferredValue tldDeferredValue = new TldDeferredValue(); + TldDeferredValue tldDeferredValue = new TldDeferredValue(); context.beforeUnmarshal(tldDeferredValue, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("tld-deferred-valueType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("tld-deferred-valueType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, TldDeferredValue.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, tldDeferredValue); tldDeferredValue.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: type - final String typeRaw = elementReader.getElementAsString(); + String typeRaw = elementReader.getElementText(); - final String type; + String type; try { type = Adapters.collapsedStringAdapterAdapter.unmarshal(typeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -114,51 +119,53 @@ public final static TldDeferredValue _read(final XoXMLStreamReader reader, Runti return tldDeferredValue; } - public final TldDeferredValue read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final TldDeferredValue read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final TldDeferredValue tldDeferredValue, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, TldDeferredValue tldDeferredValue, RuntimeContext context) + throws Exception + { if (tldDeferredValue == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (TldDeferredValue.class != tldDeferredValue.getClass()) { + if (TldDeferredValue.class!= tldDeferredValue.getClass()) { context.unexpectedSubclass(writer, tldDeferredValue, TldDeferredValue.class); - return; + return ; } context.beforeMarshal(tldDeferredValue, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = tldDeferredValue.id; - if (idRaw != null) { + String idRaw = tldDeferredValue.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldDeferredValue, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: type - final String typeRaw = tldDeferredValue.type; + String typeRaw = tldDeferredValue.type; String type = null; try { type = Adapters.collapsedStringAdapterAdapter.marshal(typeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldDeferredValue, "type", CollapsedStringAdapter.class, String.class, String.class, e); } - if (type != null) { + if (type!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "type"); writer.writeCharacters(type); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldExtension$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldExtension$JAXB.java index 1e6549ced73..387c15194b5 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldExtension$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldExtension$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class TldExtension$JAXB - extends JAXBObject { + extends JAXBObject +{ public TldExtension$JAXB() { super(TldExtension.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "tld-extensionType".intern())); } - public static TldExtension readTldExtension(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static TldExtension readTldExtension(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeTldExtension(final XoXMLStreamWriter writer, final TldExtension tldExtension, final RuntimeContext context) - throws Exception { + public static void writeTldExtension(XoXMLStreamWriter writer, TldExtension tldExtension, RuntimeContext context) + throws Exception + { _write(writer, tldExtension, context); } - public void write(final XoXMLStreamWriter writer, final TldExtension tldExtension, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, TldExtension tldExtension, RuntimeContext context) + throws Exception + { _write(writer, tldExtension, context); } - public final static TldExtension _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final TldExtension _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,54 +72,54 @@ public final static TldExtension _read(final XoXMLStreamReader reader, RuntimeCo context = new RuntimeContext(); } - final TldExtension tldExtension = new TldExtension(); + TldExtension tldExtension = new TldExtension(); context.beforeUnmarshal(tldExtension, LifecycleCallback.NONE); List extensionElement = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("tld-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("tld-extensionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, TldExtension.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, tldExtension); tldExtension.id = id; - } else if (("namespace" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("namespace" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: namespace tldExtension.namespace = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "namespace")); } } // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("extension-element" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("extension-element" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: extensionElement - final String extensionElementItemRaw = elementReader.getElementAsString(); + String extensionElementItemRaw = elementReader.getElementText(); - final String extensionElementItem; + String extensionElementItem; try { extensionElementItem = Adapters.collapsedStringAdapterAdapter.unmarshal(extensionElementItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (extensionElement == null) { extensionElement = tldExtension.extensionElement; - if (extensionElement != null) { + if (extensionElement!= null) { extensionElement.clear(); } else { - extensionElement = new ArrayList(); + extensionElement = new ArrayList<>(); } } extensionElement.add(extensionElementItem); @@ -122,7 +127,7 @@ public final static TldExtension _read(final XoXMLStreamReader reader, RuntimeCo context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "extension-element")); } } - if (extensionElement != null) { + if (extensionElement!= null) { tldExtension.extensionElement = extensionElement; } @@ -131,65 +136,67 @@ public final static TldExtension _read(final XoXMLStreamReader reader, RuntimeCo return tldExtension; } - public final TldExtension read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final TldExtension read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final TldExtension tldExtension, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, TldExtension tldExtension, RuntimeContext context) + throws Exception + { if (tldExtension == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (TldExtension.class != tldExtension.getClass()) { + if (TldExtension.class!= tldExtension.getClass()) { context.unexpectedSubclass(writer, tldExtension, TldExtension.class); - return; + return ; } context.beforeMarshal(tldExtension, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = tldExtension.id; - if (idRaw != null) { + String idRaw = tldExtension.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: namespace - final String namespaceRaw = tldExtension.namespace; - if (namespaceRaw != null) { + String namespaceRaw = tldExtension.namespace; + if (namespaceRaw!= null) { String namespace = null; try { namespace = Adapters.collapsedStringAdapterAdapter.marshal(namespaceRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldExtension, "namespace", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "namespace", namespace); } // ELEMENT: extensionElement - final List extensionElementRaw = tldExtension.extensionElement; - if (extensionElementRaw != null) { - for (final String extensionElementItem : extensionElementRaw) { + List extensionElementRaw = tldExtension.extensionElement; + if (extensionElementRaw!= null) { + for (String extensionElementItem: extensionElementRaw) { String extensionElement = null; try { extensionElement = Adapters.collapsedStringAdapterAdapter.marshal(extensionElementItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldExtension, "extensionElement", CollapsedStringAdapter.class, List.class, List.class, e); } - if (extensionElement != null) { + if (extensionElement!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "extension-element"); writer.writeCharacters(extensionElement); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldTaglib$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldTaglib$JAXB.java index 814589fbf6a..151fd69b91b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldTaglib$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldTaglib$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Function$JAXB.readFunction; import static org.apache.openejb.jee.Function$JAXB.writeFunction; @@ -50,30 +51,35 @@ "StringEquality" }) public class TldTaglib$JAXB - extends JAXBObject { + extends JAXBObject +{ public TldTaglib$JAXB() { super(TldTaglib.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "taglib".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "tldTaglibType".intern()), Text$JAXB.class, Icon$JAXB.class, Validator$JAXB.class, Listener$JAXB.class, Tag$JAXB.class, TagFile$JAXB.class, Function$JAXB.class, TldExtension$JAXB.class); } - public static TldTaglib readTldTaglib(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static TldTaglib readTldTaglib(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeTldTaglib(final XoXMLStreamWriter writer, final TldTaglib tldTaglib, final RuntimeContext context) - throws Exception { + public static void writeTldTaglib(XoXMLStreamWriter writer, TldTaglib tldTaglib, RuntimeContext context) + throws Exception + { _write(writer, tldTaglib, context); } - public void write(final XoXMLStreamWriter writer, final TldTaglib tldTaglib, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, TldTaglib tldTaglib, RuntimeContext context) + throws Exception + { _write(writer, tldTaglib, context); } - public final static TldTaglib _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final TldTaglib _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -84,7 +90,7 @@ public final static TldTaglib _read(final XoXMLStreamReader reader, RuntimeConte context = new RuntimeContext(); } - final TldTaglib tldTaglib = new TldTaglib(); + TldTaglib tldTaglib = new TldTaglib(); context.beforeUnmarshal(tldTaglib, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -97,206 +103,206 @@ public final static TldTaglib _read(final XoXMLStreamReader reader, RuntimeConte List taglibExtension = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("tldTaglibType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("tldTaglibType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, TldTaglib.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, tldTaglib); tldTaglib.id = id; - } else if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("version" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: version tldTaglib.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "version")); } } // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = tldTaglib.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("tlib-version" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("tlib-version" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: tlibVersion - final String tlibVersionRaw = elementReader.getElementAsString(); + String tlibVersionRaw = elementReader.getElementText(); - final String tlibVersion; + String tlibVersion; try { tlibVersion = Adapters.collapsedStringAdapterAdapter.unmarshal(tlibVersionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tldTaglib.tlibVersion = tlibVersion; - } else if (("jsp-version" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("jsp-version" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: jspVersion - final String jspVersionRaw = elementReader.getElementAsString(); + String jspVersionRaw = elementReader.getElementText(); - final String jspVersion; + String jspVersion; try { jspVersion = Adapters.collapsedStringAdapterAdapter.unmarshal(jspVersionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tldTaglib.jspVersion = jspVersion; - } else if (("short-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("short-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: shortName - final String shortNameRaw = elementReader.getElementAsString(); + String shortNameRaw = elementReader.getElementText(); - final String shortName; + String shortName; try { shortName = Adapters.collapsedStringAdapterAdapter.unmarshal(shortNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tldTaglib.shortName = shortName; - } else if (("uri" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("uri" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: uri - final String uriRaw = elementReader.getElementAsString(); + String uriRaw = elementReader.getElementText(); - final String uri; + String uri; try { uri = Adapters.collapsedStringAdapterAdapter.unmarshal(uriRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } tldTaglib.uri = uri; - } else if (("validator" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("validator" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: validator - final Validator validator = readValidator(elementReader, context); + Validator validator = readValidator(elementReader, context); tldTaglib.validator = validator; - } else if (("listener" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("listener" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: listener - final Listener listenerItem = readListener(elementReader, context); + Listener listenerItem = readListener(elementReader, context); if (listener == null) { listener = tldTaglib.listener; - if (listener != null) { + if (listener!= null) { listener.clear(); } else { - listener = new ArrayList(); + listener = new ArrayList<>(); } } listener.add(listenerItem); - } else if (("tag" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("tag" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: tag - final Tag tagItem = readTag(elementReader, context); + Tag tagItem = readTag(elementReader, context); if (tag == null) { tag = tldTaglib.tag; - if (tag != null) { + if (tag!= null) { tag.clear(); } else { - tag = new ArrayList(); + tag = new ArrayList<>(); } } tag.add(tagItem); - } else if (("tag-file" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("tag-file" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: tagFile - final TagFile tagFileItem = readTagFile(elementReader, context); + TagFile tagFileItem = readTagFile(elementReader, context); if (tagFile == null) { tagFile = tldTaglib.tagFile; - if (tagFile != null) { + if (tagFile!= null) { tagFile.clear(); } else { - tagFile = new ArrayList(); + tagFile = new ArrayList<>(); } } tagFile.add(tagFileItem); - } else if (("function" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("function" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: function - final Function functionItem = readFunction(elementReader, context); + Function functionItem = readFunction(elementReader, context); if (function == null) { function = tldTaglib.function; - if (function != null) { + if (function!= null) { function.clear(); } else { - function = new ArrayList(); + function = new ArrayList<>(); } } function.add(functionItem); - } else if (("taglib-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("taglib-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: taglibExtension - final TldExtension taglibExtensionItem = readTldExtension(elementReader, context); + TldExtension taglibExtensionItem = readTldExtension(elementReader, context); if (taglibExtension == null) { taglibExtension = tldTaglib.taglibExtension; - if (taglibExtension != null) { + if (taglibExtension!= null) { taglibExtension.clear(); } else { - taglibExtension = new ArrayList(); + taglibExtension = new ArrayList<>(); } } taglibExtension.add(taglibExtensionItem); - }/* else { // we are not the one responsible of the failure so don't fail + } 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", "tlib-version"), new QName("http://java.sun.com/xml/ns/javaee", "jsp-version"), new QName("http://java.sun.com/xml/ns/javaee", "short-name"), new QName("http://java.sun.com/xml/ns/javaee", "uri"), new QName("http://java.sun.com/xml/ns/javaee", "validator"), new QName("http://java.sun.com/xml/ns/javaee", "listener"), new QName("http://java.sun.com/xml/ns/javaee", "tag"), new QName("http://java.sun.com/xml/ns/javaee", "tag-file"), new QName("http://java.sun.com/xml/ns/javaee", "function"), new QName("http://java.sun.com/xml/ns/javaee", "taglib-extension")); - }*/ + } } - if (descriptions != null) { + if (descriptions!= null) { try { - tldTaglib.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + tldTaglib.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, TldTaglib.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - tldTaglib.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + tldTaglib.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, TldTaglib.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { tldTaglib.icon = icon; } - if (listener != null) { + if (listener!= null) { tldTaglib.listener = listener; } - if (tag != null) { + if (tag!= null) { tldTaglib.tag = tag; } - if (tagFile != null) { + if (tagFile!= null) { tldTaglib.tagFile = tagFile; } - if (function != null) { + if (function!= null) { tldTaglib.function = function; } - if (taglibExtension != null) { + if (taglibExtension!= null) { tldTaglib.taglibExtension = taglibExtension; } @@ -305,50 +311,52 @@ public final static TldTaglib _read(final XoXMLStreamReader reader, RuntimeConte return tldTaglib; } - public final TldTaglib read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final TldTaglib read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final TldTaglib tldTaglib, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, TldTaglib tldTaglib, RuntimeContext context) + throws Exception + { if (tldTaglib == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (TldTaglib.class != tldTaglib.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (TldTaglib.class!= tldTaglib.getClass()) { context.unexpectedSubclass(writer, tldTaglib, TldTaglib.class); - return; + return ; } context.beforeMarshal(tldTaglib, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = tldTaglib.id; - if (idRaw != null) { + String idRaw = tldTaglib.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldTaglib, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: version - final String versionRaw = tldTaglib.version; - if (versionRaw != null) { + String versionRaw = tldTaglib.version; + if (versionRaw!= null) { String version = null; try { version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldTaglib, "version", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "version", version); @@ -358,12 +366,12 @@ public final static void _write(final XoXMLStreamWriter writer, final TldTaglib Text[] descriptions = null; try { descriptions = tldTaglib.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(tldTaglib, "descriptions", TldTaglib.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -377,12 +385,12 @@ public final static void _write(final XoXMLStreamWriter writer, final TldTaglib Text[] displayNames = null; try { displayNames = tldTaglib.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(tldTaglib, "displayNames", TldTaglib.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -393,10 +401,10 @@ public final static void _write(final XoXMLStreamWriter writer, final TldTaglib } // ELEMENT: icon - final LocalCollection icon = tldTaglib.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = tldTaglib.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -407,14 +415,14 @@ public final static void _write(final XoXMLStreamWriter writer, final TldTaglib } // ELEMENT: tlibVersion - final String tlibVersionRaw = tldTaglib.tlibVersion; + String tlibVersionRaw = tldTaglib.tlibVersion; String tlibVersion = null; try { tlibVersion = Adapters.collapsedStringAdapterAdapter.marshal(tlibVersionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldTaglib, "tlibVersion", CollapsedStringAdapter.class, String.class, String.class, e); } - if (tlibVersion != null) { + if (tlibVersion!= null) { writer.writeStartElement(prefix, "tlib-version", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(tlibVersion); writer.writeEndElement(); @@ -423,28 +431,28 @@ public final static void _write(final XoXMLStreamWriter writer, final TldTaglib } // ELEMENT: jspVersion - final String jspVersionRaw = tldTaglib.jspVersion; + String jspVersionRaw = tldTaglib.jspVersion; String jspVersion = null; try { jspVersion = Adapters.collapsedStringAdapterAdapter.marshal(jspVersionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldTaglib, "jspVersion", CollapsedStringAdapter.class, String.class, String.class, e); } - if (jspVersion != null) { + if (jspVersion!= null) { writer.writeStartElement(prefix, "jsp-version", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(jspVersion); writer.writeEndElement(); } // ELEMENT: shortName - final String shortNameRaw = tldTaglib.shortName; + String shortNameRaw = tldTaglib.shortName; String shortName = null; try { shortName = Adapters.collapsedStringAdapterAdapter.marshal(shortNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldTaglib, "shortName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (shortName != null) { + if (shortName!= null) { writer.writeStartElement(prefix, "short-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(shortName); writer.writeEndElement(); @@ -453,33 +461,33 @@ public final static void _write(final XoXMLStreamWriter writer, final TldTaglib } // ELEMENT: uri - final String uriRaw = tldTaglib.uri; + String uriRaw = tldTaglib.uri; String uri = null; try { uri = Adapters.collapsedStringAdapterAdapter.marshal(uriRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(tldTaglib, "uri", CollapsedStringAdapter.class, String.class, String.class, e); } - if (uri != null) { + if (uri!= null) { writer.writeStartElement(prefix, "uri", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(uri); writer.writeEndElement(); } // ELEMENT: validator - final Validator validator = tldTaglib.validator; - if (validator != null) { + Validator validator = tldTaglib.validator; + if (validator!= null) { writer.writeStartElement(prefix, "validator", "http://java.sun.com/xml/ns/javaee"); writeValidator(writer, validator, context); writer.writeEndElement(); } // ELEMENT: listener - final List listener = tldTaglib.listener; - if (listener != null) { - for (final Listener listenerItem : listener) { + List listener = tldTaglib.listener; + if (listener!= null) { + for (Listener listenerItem: listener) { writer.writeStartElement(prefix, "listener", "http://java.sun.com/xml/ns/javaee"); - if (listenerItem != null) { + if (listenerItem!= null) { writeListener(writer, listenerItem, context); } else { writer.writeXsiNil(); @@ -489,11 +497,11 @@ public final static void _write(final XoXMLStreamWriter writer, final TldTaglib } // ELEMENT: tag - final List tag = tldTaglib.tag; - if (tag != null) { - for (final Tag tagItem : tag) { + List tag = tldTaglib.tag; + if (tag!= null) { + for (Tag tagItem: tag) { writer.writeStartElement(prefix, "tag", "http://java.sun.com/xml/ns/javaee"); - if (tagItem != null) { + if (tagItem!= null) { writeTag(writer, tagItem, context); } else { writer.writeXsiNil(); @@ -503,10 +511,10 @@ public final static void _write(final XoXMLStreamWriter writer, final TldTaglib } // ELEMENT: tagFile - final List tagFile = tldTaglib.tagFile; - if (tagFile != null) { - for (final TagFile tagFileItem : tagFile) { - if (tagFileItem != null) { + List tagFile = tldTaglib.tagFile; + if (tagFile!= null) { + for (TagFile tagFileItem: tagFile) { + if (tagFileItem!= null) { writer.writeStartElement(prefix, "tag-file", "http://java.sun.com/xml/ns/javaee"); writeTagFile(writer, tagFileItem, context); writer.writeEndElement(); @@ -515,11 +523,11 @@ public final static void _write(final XoXMLStreamWriter writer, final TldTaglib } // ELEMENT: function - final List function = tldTaglib.function; - if (function != null) { - for (final Function functionItem : function) { + List function = tldTaglib.function; + if (function!= null) { + for (Function functionItem: function) { writer.writeStartElement(prefix, "function", "http://java.sun.com/xml/ns/javaee"); - if (functionItem != null) { + if (functionItem!= null) { writeFunction(writer, functionItem, context); } else { writer.writeXsiNil(); @@ -529,10 +537,10 @@ public final static void _write(final XoXMLStreamWriter writer, final TldTaglib } // ELEMENT: taglibExtension - final List taglibExtension = tldTaglib.taglibExtension; - if (taglibExtension != null) { - for (final TldExtension taglibExtensionItem : taglibExtension) { - if (taglibExtensionItem != null) { + List taglibExtension = tldTaglib.taglibExtension; + if (taglibExtension!= null) { + for (TldExtension taglibExtensionItem: taglibExtension) { + if (taglibExtensionItem!= null) { writer.writeStartElement(prefix, "taglib-extension", "http://java.sun.com/xml/ns/javaee"); writeTldExtension(writer, taglibExtensionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TrackingMode$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TrackingMode$JAXB.java index 29dea83fd9d..760033bb0ef 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TrackingMode$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TrackingMode$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class TrackingMode$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public TrackingMode$JAXB() { super(TrackingMode.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "tracking-modeType".intern())); } - public TrackingMode parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public TrackingMode parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseTrackingMode(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final TrackingMode trackingMode) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, TrackingMode trackingMode) + throws Exception + { return toStringTrackingMode(bean, parameterName, context, trackingMode); } - public static TrackingMode parseTrackingMode(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static TrackingMode parseTrackingMode(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("COOKIE".equals(value)) { return TrackingMode.COOKIE; } else if ("URL".equals(value)) { @@ -54,8 +58,9 @@ public static TrackingMode parseTrackingMode(final XoXMLStreamReader reader, fin } } - public static String toStringTrackingMode(final Object bean, final String parameterName, final RuntimeContext context, final TrackingMode trackingMode) - throws Exception { + public static String toStringTrackingMode(Object bean, String parameterName, RuntimeContext context, TrackingMode trackingMode) + throws Exception + { if (TrackingMode.COOKIE == trackingMode) { return "COOKIE"; } else if (TrackingMode.URL == trackingMode) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransAttribute$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransAttribute$JAXB.java index 395bd091bb3..29364eada45 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransAttribute$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransAttribute$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class TransAttribute$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public TransAttribute$JAXB() { super(TransAttribute.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "transAttribute".intern())); } - public TransAttribute parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public TransAttribute parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseTransAttribute(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final TransAttribute transAttribute) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, TransAttribute transAttribute) + throws Exception + { return toStringTransAttribute(bean, parameterName, context, transAttribute); } - public static TransAttribute parseTransAttribute(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static TransAttribute parseTransAttribute(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("NotSupported".equals(value)) { return TransAttribute.NOT_SUPPORTED; } else if ("Supports".equals(value)) { @@ -60,8 +64,9 @@ public static TransAttribute parseTransAttribute(final XoXMLStreamReader reader, } } - public static String toStringTransAttribute(final Object bean, final String parameterName, final RuntimeContext context, final TransAttribute transAttribute) - throws Exception { + public static String toStringTransAttribute(Object bean, String parameterName, RuntimeContext context, TransAttribute transAttribute) + throws Exception + { if (TransAttribute.NOT_SUPPORTED == transAttribute) { return "NotSupported"; } else if (TransAttribute.SUPPORTS == transAttribute) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransactionSupportType$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransactionSupportType$JAXB.java index 1cfdb284be7..7fea0e8a105 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransactionSupportType$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransactionSupportType$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class TransactionSupportType$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public TransactionSupportType$JAXB() { super(TransactionSupportType.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "transactionSupportType".intern())); } - public TransactionSupportType parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public TransactionSupportType parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseTransactionSupportType(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final TransactionSupportType transactionSupportType) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, TransactionSupportType transactionSupportType) + throws Exception + { return toStringTransactionSupportType(bean, parameterName, context, transactionSupportType); } - public static TransactionSupportType parseTransactionSupportType(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static TransactionSupportType parseTransactionSupportType(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("NoTransaction".equals(value)) { return TransactionSupportType.NO_TRANSACTION; } else if ("LocalTransaction".equals(value)) { @@ -54,8 +58,9 @@ public static TransactionSupportType parseTransactionSupportType(final XoXMLStre } } - public static String toStringTransactionSupportType(final Object bean, final String parameterName, final RuntimeContext context, final TransactionSupportType transactionSupportType) - throws Exception { + public static String toStringTransactionSupportType(Object bean, String parameterName, RuntimeContext context, TransactionSupportType transactionSupportType) + throws Exception + { if (TransactionSupportType.NO_TRANSACTION == transactionSupportType) { return "NoTransaction"; } else if (TransactionSupportType.LOCAL_TRANSACTION == transactionSupportType) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransactionType$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransactionType$JAXB.java index b0de2145c2f..287f68f2554 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransactionType$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransactionType$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class TransactionType$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public TransactionType$JAXB() { super(TransactionType.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "transactionType".intern())); } - public TransactionType parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public TransactionType parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseTransactionType(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final TransactionType transactionType) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, TransactionType transactionType) + throws Exception + { return toStringTransactionType(bean, parameterName, context, transactionType); } - public static TransactionType parseTransactionType(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static TransactionType parseTransactionType(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("Bean".equals(value)) { return TransactionType.BEAN; } else if ("Container".equals(value)) { @@ -52,8 +56,9 @@ public static TransactionType parseTransactionType(final XoXMLStreamReader reade } } - public static String toStringTransactionType(final Object bean, final String parameterName, final RuntimeContext context, final TransactionType transactionType) - throws Exception { + public static String toStringTransactionType(Object bean, String parameterName, RuntimeContext context, TransactionType transactionType) + throws Exception + { if (TransactionType.BEAN == transactionType) { return "Bean"; } else if (TransactionType.CONTAINER == transactionType) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransportGuarantee$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransportGuarantee$JAXB.java index 7a37a5f5c45..3c93114a3b5 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransportGuarantee$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TransportGuarantee$JAXB.java @@ -1,47 +1,51 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; -import javax.xml.namespace.QName; - public class TransportGuarantee$JAXB - extends JAXBEnum { + extends JAXBEnum +{ public TransportGuarantee$JAXB() { super(TransportGuarantee.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "transport-guaranteeType".intern())); } - public TransportGuarantee parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public TransportGuarantee parse(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { return parseTransportGuarantee(reader, context, value); } - public String toString(final Object bean, final String parameterName, final RuntimeContext context, final TransportGuarantee transportGuarantee) - throws Exception { + public String toString(Object bean, String parameterName, RuntimeContext context, TransportGuarantee transportGuarantee) + throws Exception + { return toStringTransportGuarantee(bean, parameterName, context, transportGuarantee); } - public static TransportGuarantee parseTransportGuarantee(final XoXMLStreamReader reader, final RuntimeContext context, final String value) - throws Exception { + public static TransportGuarantee parseTransportGuarantee(XoXMLStreamReader reader, RuntimeContext context, String value) + throws Exception + { if ("NONE".equals(value)) { return TransportGuarantee.NONE; } else if ("INTEGRAL".equals(value)) { @@ -54,8 +58,9 @@ public static TransportGuarantee parseTransportGuarantee(final XoXMLStreamReader } } - public static String toStringTransportGuarantee(final Object bean, final String parameterName, final RuntimeContext context, final TransportGuarantee transportGuarantee) - throws Exception { + public static String toStringTransportGuarantee(Object bean, String parameterName, RuntimeContext context, TransportGuarantee transportGuarantee) + throws Exception + { if (TransportGuarantee.NONE == transportGuarantee) { return "NONE"; } else if (TransportGuarantee.INTEGRAL == transportGuarantee) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/UrlPattern$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/UrlPattern$JAXB.java new file mode 100644 index 00000000000..09ca3228d48 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/UrlPattern$JAXB.java @@ -0,0 +1,153 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class UrlPattern$JAXB + extends JAXBObject +{ + + + public UrlPattern$JAXB() { + super(UrlPattern.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "url-patternType".intern())); + } + + public static UrlPattern readUrlPattern(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeUrlPattern(XoXMLStreamWriter writer, UrlPattern urlPattern, RuntimeContext context) + throws Exception + { + _write(writer, urlPattern, context); + } + + public void write(XoXMLStreamWriter writer, UrlPattern urlPattern, RuntimeContext context) + throws Exception + { + _write(writer, urlPattern, context); + } + + public static final UrlPattern _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + UrlPattern urlPattern = new UrlPattern(); + context.beforeUnmarshal(urlPattern, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("url-patternType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, UrlPattern.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // VALUE: value + String valueRaw = reader.getElementText(); + + String value = null; + boolean valueConverted; + try { + value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); + valueConverted = true; + } catch (Exception e) { + context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); + valueConverted = false; + } + + if (valueConverted) { + urlPattern.value = value; + } + + context.afterUnmarshal(urlPattern, LifecycleCallback.NONE); + + return urlPattern; + } + + public final UrlPattern read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, UrlPattern urlPattern, RuntimeContext context) + throws Exception + { + if (urlPattern == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (UrlPattern.class!= urlPattern.getClass()) { + context.unexpectedSubclass(writer, urlPattern, UrlPattern.class); + return ; + } + + context.beforeMarshal(urlPattern, LifecycleCallback.NONE); + + + // VALUE: value + String valueRaw = urlPattern.value; + String value = null; + try { + value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); + } catch (Exception e) { + context.xmlAdapterError(urlPattern, "value", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeCharacters(value); + + context.afterMarshal(urlPattern, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/UserDataConstraint$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/UserDataConstraint$JAXB.java index b639f294bc1..a26e896bae7 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/UserDataConstraint$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/UserDataConstraint$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -37,30 +38,35 @@ "StringEquality" }) public class UserDataConstraint$JAXB - extends JAXBObject { + extends JAXBObject +{ public UserDataConstraint$JAXB() { super(UserDataConstraint.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "user-data-constraintType".intern()), Text$JAXB.class, TransportGuarantee$JAXB.class); } - public static UserDataConstraint readUserDataConstraint(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static UserDataConstraint readUserDataConstraint(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeUserDataConstraint(final XoXMLStreamWriter writer, final UserDataConstraint userDataConstraint, final RuntimeContext context) - throws Exception { + public static void writeUserDataConstraint(XoXMLStreamWriter writer, UserDataConstraint userDataConstraint, RuntimeContext context) + throws Exception + { _write(writer, userDataConstraint, context); } - public void write(final XoXMLStreamWriter writer, final UserDataConstraint userDataConstraint, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, UserDataConstraint userDataConstraint, RuntimeContext context) + throws Exception + { _write(writer, userDataConstraint, context); } - public final static UserDataConstraint _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final UserDataConstraint _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -71,54 +77,54 @@ public final static UserDataConstraint _read(final XoXMLStreamReader reader, Run context = new RuntimeContext(); } - final UserDataConstraint userDataConstraint = new UserDataConstraint(); + UserDataConstraint userDataConstraint = new UserDataConstraint(); context.beforeUnmarshal(userDataConstraint, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("user-data-constraintType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("user-data-constraintType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, UserDataConstraint.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, userDataConstraint); userDataConstraint.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("transport-guarantee" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("transport-guarantee" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: transportGuarantee - final TransportGuarantee transportGuarantee = parseTransportGuarantee(elementReader, context, elementReader.getElementAsString()); - if (transportGuarantee != null) { + TransportGuarantee transportGuarantee = parseTransportGuarantee(elementReader, context, elementReader.getElementText()); + if (transportGuarantee!= null) { userDataConstraint.transportGuarantee = transportGuarantee; } } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "transport-guarantee")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - userDataConstraint.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + userDataConstraint.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, UserDataConstraint.class, "setDescriptions", Text[].class, e); } } @@ -128,38 +134,40 @@ public final static UserDataConstraint _read(final XoXMLStreamReader reader, Run return userDataConstraint; } - public final UserDataConstraint read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final UserDataConstraint read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final UserDataConstraint userDataConstraint, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, UserDataConstraint userDataConstraint, RuntimeContext context) + throws Exception + { if (userDataConstraint == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (UserDataConstraint.class != userDataConstraint.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (UserDataConstraint.class!= userDataConstraint.getClass()) { context.unexpectedSubclass(writer, userDataConstraint, UserDataConstraint.class); - return; + return ; } context.beforeMarshal(userDataConstraint, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = userDataConstraint.id; - if (idRaw != null) { + String idRaw = userDataConstraint.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(userDataConstraint, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -169,12 +177,12 @@ public final static void _write(final XoXMLStreamWriter writer, final UserDataCo Text[] descriptions = null; try { descriptions = userDataConstraint.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(userDataConstraint, "descriptions", UserDataConstraint.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -185,8 +193,8 @@ public final static void _write(final XoXMLStreamWriter writer, final UserDataCo } // ELEMENT: transportGuarantee - final TransportGuarantee transportGuarantee = userDataConstraint.transportGuarantee; - if (transportGuarantee != null) { + TransportGuarantee transportGuarantee = userDataConstraint.transportGuarantee; + if (transportGuarantee!= null) { writer.writeStartElement(prefix, "transport-guarantee", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(toStringTransportGuarantee(userDataConstraint, null, context, transportGuarantee)); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Validator$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Validator$JAXB.java index 618b0868505..bf60433311a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Validator$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Validator$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.ParamValue$JAXB.readParamValue; import static org.apache.openejb.jee.ParamValue$JAXB.writeParamValue; @@ -38,30 +39,35 @@ "StringEquality" }) public class Validator$JAXB - extends JAXBObject { + extends JAXBObject +{ public Validator$JAXB() { super(Validator.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "validatorType".intern()), Text$JAXB.class, ParamValue$JAXB.class); } - public static Validator readValidator(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Validator readValidator(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeValidator(final XoXMLStreamWriter writer, final Validator validator, final RuntimeContext context) - throws Exception { + public static void writeValidator(XoXMLStreamWriter writer, Validator validator, RuntimeContext context) + throws Exception + { _write(writer, validator, context); } - public void write(final XoXMLStreamWriter writer, final Validator validator, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Validator validator, RuntimeContext context) + throws Exception + { _write(writer, validator, context); } - public final static Validator _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Validator _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -72,63 +78,63 @@ public final static Validator _read(final XoXMLStreamReader reader, RuntimeConte context = new RuntimeContext(); } - final Validator validator = new Validator(); + Validator validator = new Validator(); context.beforeUnmarshal(validator, LifecycleCallback.NONE); ArrayList descriptions = null; List initParam = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("validatorType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("validatorType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Validator.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, validator); validator.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("validator-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("validator-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: validatorClass - final String validatorClassRaw = elementReader.getElementAsString(); + String validatorClassRaw = elementReader.getElementText(); - final String validatorClass; + String validatorClass; try { validatorClass = Adapters.collapsedStringAdapterAdapter.unmarshal(validatorClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } validator.validatorClass = validatorClass; - } else if (("init-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("init-param" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: initParam - final ParamValue initParamItem = readParamValue(elementReader, context); + ParamValue initParamItem = readParamValue(elementReader, context); if (initParam == null) { initParam = validator.initParam; - if (initParam != null) { + if (initParam!= null) { initParam.clear(); } else { - initParam = new ArrayList(); + initParam = new ArrayList<>(); } } initParam.add(initParamItem); @@ -136,14 +142,14 @@ public final static Validator _read(final XoXMLStreamReader reader, RuntimeConte context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "validator-class"), new QName("http://java.sun.com/xml/ns/javaee", "init-param")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - validator.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + validator.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Validator.class, "setDescriptions", Text[].class, e); } } - if (initParam != null) { + if (initParam!= null) { validator.initParam = initParam; } @@ -152,38 +158,40 @@ public final static Validator _read(final XoXMLStreamReader reader, RuntimeConte return validator; } - public final Validator read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Validator read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Validator validator, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Validator validator, RuntimeContext context) + throws Exception + { if (validator == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Validator.class != validator.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Validator.class!= validator.getClass()) { context.unexpectedSubclass(writer, validator, Validator.class); - return; + return ; } context.beforeMarshal(validator, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = validator.id; - if (idRaw != null) { + String idRaw = validator.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(validator, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -193,12 +201,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Validator Text[] descriptions = null; try { descriptions = validator.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(validator, "descriptions", Validator.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -209,14 +217,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Validator } // ELEMENT: validatorClass - final String validatorClassRaw = validator.validatorClass; + String validatorClassRaw = validator.validatorClass; String validatorClass = null; try { validatorClass = Adapters.collapsedStringAdapterAdapter.marshal(validatorClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(validator, "validatorClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (validatorClass != null) { + if (validatorClass!= null) { writer.writeStartElement(prefix, "validator-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(validatorClass); writer.writeEndElement(); @@ -225,10 +233,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Validator } // ELEMENT: initParam - final List initParam = validator.initParam; - if (initParam != null) { - for (final ParamValue initParamItem : initParam) { - if (initParamItem != null) { + List initParam = validator.initParam; + if (initParam!= null) { + for (ParamValue initParamItem: initParam) { + if (initParamItem!= null) { writer.writeStartElement(prefix, "init-param", "http://java.sun.com/xml/ns/javaee"); writeParamValue(writer, initParamItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Variable$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Variable$JAXB.java index 1b0a09d5a5b..7a5c7303919 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Variable$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Variable$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -35,30 +36,35 @@ "StringEquality" }) public class Variable$JAXB - extends JAXBObject { + extends JAXBObject +{ public Variable$JAXB() { super(Variable.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "variableType".intern()), Text$JAXB.class); } - public static Variable readVariable(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Variable readVariable(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeVariable(final XoXMLStreamWriter writer, final Variable variable, final RuntimeContext context) - throws Exception { + public static void writeVariable(XoXMLStreamWriter writer, Variable variable, RuntimeContext context) + throws Exception + { _write(writer, variable, context); } - public void write(final XoXMLStreamWriter writer, final Variable variable, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Variable variable, RuntimeContext context) + throws Exception + { _write(writer, variable, context); } - public final static Variable _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Variable _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -69,100 +75,100 @@ public final static Variable _read(final XoXMLStreamReader reader, RuntimeContex context = new RuntimeContext(); } - final Variable variable = new Variable(); + Variable variable = new Variable(); context.beforeUnmarshal(variable, LifecycleCallback.NONE); ArrayList descriptions = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("variableType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("variableType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Variable.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, variable); variable.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("name-given" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("name-given" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: nameGiven - final String nameGivenRaw = elementReader.getElementAsString(); + String nameGivenRaw = elementReader.getElementText(); - final String nameGiven; + String nameGiven; try { nameGiven = Adapters.collapsedStringAdapterAdapter.unmarshal(nameGivenRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } variable.nameGiven = nameGiven; - } else if (("name-from-attribute" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("name-from-attribute" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: nameFromAttribute - final String nameFromAttributeRaw = elementReader.getElementAsString(); + String nameFromAttributeRaw = elementReader.getElementText(); - final String nameFromAttribute; + String nameFromAttribute; try { nameFromAttribute = Adapters.collapsedStringAdapterAdapter.unmarshal(nameFromAttributeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } variable.nameFromAttribute = nameFromAttribute; - } else if (("variable-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("variable-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: variableClass - final String variableClassRaw = elementReader.getElementAsString(); + String variableClassRaw = elementReader.getElementText(); - final String variableClass; + String variableClass; try { variableClass = Adapters.collapsedStringAdapterAdapter.unmarshal(variableClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } variable.variableClass = variableClass; - } else if (("declare" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("declare" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: declare - final String declareRaw = elementReader.getElementAsString(); + String declareRaw = elementReader.getElementText(); - final String declare; + String declare; try { declare = Adapters.collapsedStringAdapterAdapter.unmarshal(declareRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } variable.declare = declare; - } else if (("scope" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("scope" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: scope - final String scopeRaw = elementReader.getElementAsString(); + String scopeRaw = elementReader.getElementText(); - final String scope; + String scope; try { scope = Adapters.collapsedStringAdapterAdapter.unmarshal(scopeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -172,10 +178,10 @@ public final static Variable _read(final XoXMLStreamReader reader, RuntimeContex context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "name-given"), new QName("http://java.sun.com/xml/ns/javaee", "name-from-attribute"), new QName("http://java.sun.com/xml/ns/javaee", "variable-class"), new QName("http://java.sun.com/xml/ns/javaee", "declare"), new QName("http://java.sun.com/xml/ns/javaee", "scope")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - variable.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + variable.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Variable.class, "setDescriptions", Text[].class, e); } } @@ -185,38 +191,40 @@ public final static Variable _read(final XoXMLStreamReader reader, RuntimeContex return variable; } - public final Variable read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Variable read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Variable variable, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Variable variable, RuntimeContext context) + throws Exception + { if (variable == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Variable.class != variable.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Variable.class!= variable.getClass()) { context.unexpectedSubclass(writer, variable, Variable.class); - return; + return ; } context.beforeMarshal(variable, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = variable.id; - if (idRaw != null) { + String idRaw = variable.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(variable, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); @@ -226,12 +234,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Variable v Text[] descriptions = null; try { descriptions = variable.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(variable, "descriptions", Variable.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -242,70 +250,70 @@ public final static void _write(final XoXMLStreamWriter writer, final Variable v } // ELEMENT: nameGiven - final String nameGivenRaw = variable.nameGiven; + String nameGivenRaw = variable.nameGiven; String nameGiven = null; try { nameGiven = Adapters.collapsedStringAdapterAdapter.marshal(nameGivenRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(variable, "nameGiven", CollapsedStringAdapter.class, String.class, String.class, e); } - if (nameGiven != null) { + if (nameGiven!= null) { writer.writeStartElement(prefix, "name-given", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(nameGiven); writer.writeEndElement(); } // ELEMENT: nameFromAttribute - final String nameFromAttributeRaw = variable.nameFromAttribute; + String nameFromAttributeRaw = variable.nameFromAttribute; String nameFromAttribute = null; try { nameFromAttribute = Adapters.collapsedStringAdapterAdapter.marshal(nameFromAttributeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(variable, "nameFromAttribute", CollapsedStringAdapter.class, String.class, String.class, e); } - if (nameFromAttribute != null) { + if (nameFromAttribute!= null) { writer.writeStartElement(prefix, "name-from-attribute", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(nameFromAttribute); writer.writeEndElement(); } // ELEMENT: variableClass - final String variableClassRaw = variable.variableClass; + String variableClassRaw = variable.variableClass; String variableClass = null; try { variableClass = Adapters.collapsedStringAdapterAdapter.marshal(variableClassRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(variable, "variableClass", CollapsedStringAdapter.class, String.class, String.class, e); } - if (variableClass != null) { + if (variableClass!= null) { writer.writeStartElement(prefix, "variable-class", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(variableClass); writer.writeEndElement(); } // ELEMENT: declare - final String declareRaw = variable.declare; + String declareRaw = variable.declare; String declare = null; try { declare = Adapters.collapsedStringAdapterAdapter.marshal(declareRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(variable, "declare", CollapsedStringAdapter.class, String.class, String.class, e); } - if (declare != null) { + if (declare!= null) { writer.writeStartElement(prefix, "declare", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(declare); writer.writeEndElement(); } // ELEMENT: scope - final String scopeRaw = variable.scope; + String scopeRaw = variable.scope; String scope = null; try { scope = Adapters.collapsedStringAdapterAdapter.marshal(scopeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(variable, "scope", CollapsedStringAdapter.class, String.class, String.class, e); } - if (scope != null) { + if (scope!= null) { writer.writeStartElement(prefix, "scope", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(scope); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/VariableMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/VariableMapping$JAXB.java index 41d5fc822d2..4d086ab957f 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/VariableMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/VariableMapping$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -24,38 +28,39 @@ import org.metatype.sxc.util.XoXMLStreamWriter; import org.w3c.dom.Element; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class VariableMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public VariableMapping$JAXB() { super(VariableMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "variable-mappingType".intern())); } - public static VariableMapping readVariableMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static VariableMapping readVariableMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeVariableMapping(final XoXMLStreamWriter writer, final VariableMapping variableMapping, final RuntimeContext context) - throws Exception { + public static void writeVariableMapping(XoXMLStreamWriter writer, VariableMapping variableMapping, RuntimeContext context) + throws Exception + { _write(writer, variableMapping, context); } - public void write(final XoXMLStreamWriter writer, final VariableMapping variableMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, VariableMapping variableMapping, RuntimeContext context) + throws Exception + { _write(writer, variableMapping, context); } - public final static VariableMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final VariableMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -66,78 +71,78 @@ public final static VariableMapping _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final VariableMapping variableMapping = new VariableMapping(); + VariableMapping variableMapping = new VariableMapping(); context.beforeUnmarshal(variableMapping, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("variable-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("variable-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, VariableMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, variableMapping); variableMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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-variable-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("java-variable-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: javaVariableName - final String javaVariableNameRaw = elementReader.getElementAsString(); + String javaVariableNameRaw = elementReader.getElementText(); - final String javaVariableName; + String javaVariableName; try { javaVariableName = Adapters.collapsedStringAdapterAdapter.unmarshal(javaVariableNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } variableMapping.javaVariableName = javaVariableName; - } else if (("data-member" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("data-member" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dataMember - final Element dataMember = elementReader.getElementAsDomElement(); + Element dataMember = elementReader.getElementAsDomElement(); variableMapping.dataMember = dataMember; - } else if (("xml-attribute-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("xml-attribute-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: xmlAttributeName - final String xmlAttributeNameRaw = elementReader.getElementAsString(); + String xmlAttributeNameRaw = elementReader.getElementText(); - final String xmlAttributeName; + String xmlAttributeName; try { xmlAttributeName = Adapters.collapsedStringAdapterAdapter.unmarshal(xmlAttributeNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } variableMapping.xmlAttributeName = xmlAttributeName; - } else if (("xml-element-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("xml-element-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: xmlElementName - final String xmlElementNameRaw = elementReader.getElementAsString(); + String xmlElementNameRaw = elementReader.getElementText(); - final String xmlElementName; + String xmlElementName; try { xmlElementName = Adapters.collapsedStringAdapterAdapter.unmarshal(xmlElementNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } variableMapping.xmlElementName = xmlElementName; - } else if (("xml-wildcard" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("xml-wildcard" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: xmlWildcard - final Element xmlWildcard = elementReader.getElementAsDomElement(); + Element xmlWildcard = elementReader.getElementAsDomElement(); variableMapping.xmlWildcard = xmlWildcard; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "java-variable-name"), new QName("http://java.sun.com/xml/ns/javaee", "data-member"), new QName("http://java.sun.com/xml/ns/javaee", "xml-attribute-name"), new QName("http://java.sun.com/xml/ns/javaee", "xml-element-name"), new QName("http://java.sun.com/xml/ns/javaee", "xml-wildcard")); @@ -149,52 +154,54 @@ public final static VariableMapping _read(final XoXMLStreamReader reader, Runtim return variableMapping; } - public final VariableMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final VariableMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final VariableMapping variableMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, VariableMapping variableMapping, RuntimeContext context) + throws Exception + { if (variableMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (VariableMapping.class != variableMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (VariableMapping.class!= variableMapping.getClass()) { context.unexpectedSubclass(writer, variableMapping, VariableMapping.class); - return; + return ; } context.beforeMarshal(variableMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = variableMapping.id; - if (idRaw != null) { + String idRaw = variableMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(variableMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: javaVariableName - final String javaVariableNameRaw = variableMapping.javaVariableName; + String javaVariableNameRaw = variableMapping.javaVariableName; String javaVariableName = null; try { javaVariableName = Adapters.collapsedStringAdapterAdapter.marshal(javaVariableNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(variableMapping, "javaVariableName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (javaVariableName != null) { + if (javaVariableName!= null) { writer.writeStartElement(prefix, "java-variable-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(javaVariableName); writer.writeEndElement(); @@ -203,44 +210,44 @@ public final static void _write(final XoXMLStreamWriter writer, final VariableMa } // ELEMENT: dataMember - final Object dataMember = variableMapping.dataMember; - if (dataMember != null) { + Object dataMember = variableMapping.dataMember; + if (dataMember!= null) { writer.writeStartElement(prefix, "data-member", "http://java.sun.com/xml/ns/javaee"); writer.writeDomElement(((Element) dataMember), false); writer.writeEndElement(); } // ELEMENT: xmlAttributeName - final String xmlAttributeNameRaw = variableMapping.xmlAttributeName; + String xmlAttributeNameRaw = variableMapping.xmlAttributeName; String xmlAttributeName = null; try { xmlAttributeName = Adapters.collapsedStringAdapterAdapter.marshal(xmlAttributeNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(variableMapping, "xmlAttributeName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (xmlAttributeName != null) { + if (xmlAttributeName!= null) { writer.writeStartElement(prefix, "xml-attribute-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(xmlAttributeName); writer.writeEndElement(); } // ELEMENT: xmlElementName - final String xmlElementNameRaw = variableMapping.xmlElementName; + String xmlElementNameRaw = variableMapping.xmlElementName; String xmlElementName = null; try { xmlElementName = Adapters.collapsedStringAdapterAdapter.marshal(xmlElementNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(variableMapping, "xmlElementName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (xmlElementName != null) { + if (xmlElementName!= null) { writer.writeStartElement(prefix, "xml-element-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(xmlElementName); writer.writeEndElement(); } // ELEMENT: xmlWildcard - final Object xmlWildcard = variableMapping.xmlWildcard; - if (xmlWildcard != null) { + Object xmlWildcard = variableMapping.xmlWildcard; + if (xmlWildcard!= null) { writer.writeStartElement(prefix, "xml-wildcard", "http://java.sun.com/xml/ns/javaee"); writer.writeDomElement(((Element) xmlWildcard), false); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Web$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Web$JAXB.java index cee535fa22c..676f6e40cea 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Web$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Web$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class Web$JAXB - extends JAXBObject { + extends JAXBObject +{ public Web$JAXB() { super(Web.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "webType".intern())); } - public static Web readWeb(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Web readWeb(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeWeb(final XoXMLStreamWriter writer, final Web web, final RuntimeContext context) - throws Exception { + public static void writeWeb(XoXMLStreamWriter writer, Web web, RuntimeContext context) + throws Exception + { _write(writer, web, context); } - public void write(final XoXMLStreamWriter writer, final Web web, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Web web, RuntimeContext context) + throws Exception + { _write(writer, web, context); } - public final static Web _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Web _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,53 +70,53 @@ public final static Web _read(final XoXMLStreamReader reader, RuntimeContext con context = new RuntimeContext(); } - final Web web = new Web(); + Web web = new Web(); context.beforeUnmarshal(web, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("webType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("webType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Web.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, web); web.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("web-uri" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("web-uri" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: webUri - final String webUriRaw = elementReader.getElementAsString(); + String webUriRaw = elementReader.getElementText(); - final String webUri; + String webUri; try { webUri = Adapters.collapsedStringAdapterAdapter.unmarshal(webUriRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } web.webUri = webUri; - } else if (("context-root" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("context-root" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: contextRoot - final String contextRootRaw = elementReader.getElementAsString(); + String contextRootRaw = elementReader.getElementText(); - final String contextRoot; + String contextRoot; try { contextRoot = Adapters.collapsedStringAdapterAdapter.unmarshal(contextRootRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -127,52 +132,54 @@ public final static Web _read(final XoXMLStreamReader reader, RuntimeContext con return web; } - public final Web read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Web read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Web web, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Web web, RuntimeContext context) + throws Exception + { if (web == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Web.class != web.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Web.class!= web.getClass()) { context.unexpectedSubclass(writer, web, Web.class); - return; + return ; } context.beforeMarshal(web, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = web.id; - if (idRaw != null) { + String idRaw = web.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(web, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: webUri - final String webUriRaw = web.webUri; + String webUriRaw = web.webUri; String webUri = null; try { webUri = Adapters.collapsedStringAdapterAdapter.marshal(webUriRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(web, "webUri", CollapsedStringAdapter.class, String.class, String.class, e); } - if (webUri != null) { + if (webUri!= null) { writer.writeStartElement(prefix, "web-uri", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(webUri); writer.writeEndElement(); @@ -181,14 +188,14 @@ public final static void _write(final XoXMLStreamWriter writer, final Web web, R } // ELEMENT: contextRoot - final String contextRootRaw = web.contextRoot; + String contextRootRaw = web.contextRoot; String contextRoot = null; try { contextRoot = Adapters.collapsedStringAdapterAdapter.marshal(contextRootRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(web, "contextRoot", CollapsedStringAdapter.class, String.class, String.class, e); } - if (contextRoot != null) { + if (contextRoot!= null) { writer.writeStartElement(prefix, "context-root", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(contextRoot); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java index c2e3ad3af31..316a07fecdd 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java @@ -1,35 +1,39 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.AbsoluteOrdering$JAXB.readAbsoluteOrdering; import static org.apache.openejb.jee.AbsoluteOrdering$JAXB.writeAbsoluteOrdering; +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; @@ -49,6 +53,9 @@ import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; import static org.apache.openejb.jee.JspConfig$JAXB.readJspConfig; import static org.apache.openejb.jee.JspConfig$JAXB.writeJspConfig; import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; @@ -98,30 +105,36 @@ "StringEquality" }) public class WebApp$JAXB - extends JAXBObject { + extends JAXBObject +{ + private static final FieldAccessor> webAppContextService = new FieldAccessor<>(WebApp.class, "contextService"); public WebApp$JAXB() { - super(WebApp.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-app".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-appType".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, ParamValue$JAXB.class, Filter$JAXB.class, FilterMapping$JAXB.class, Listener$JAXB.class, Servlet$JAXB.class, ServletMapping$JAXB.class, SessionConfig$JAXB.class, MimeMapping$JAXB.class, WelcomeFileList$JAXB.class, ErrorPage$JAXB.class, Taglib$JAXB.class, JspConfig$JAXB.class, SecurityConstraint$JAXB.class, LoginConfig$JAXB.class, SecurityRole$JAXB.class, LocaleEncodingMappingList$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, MessageDestination$JAXB.class, AbsoluteOrdering$JAXB.class, DataSource$JAXB.class); + super(WebApp.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-app".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-appType".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, ParamValue$JAXB.class, Filter$JAXB.class, FilterMapping$JAXB.class, Listener$JAXB.class, Servlet$JAXB.class, ServletMapping$JAXB.class, SessionConfig$JAXB.class, MimeMapping$JAXB.class, WelcomeFileList$JAXB.class, ErrorPage$JAXB.class, Taglib$JAXB.class, JspConfig$JAXB.class, SecurityConstraint$JAXB.class, LoginConfig$JAXB.class, SecurityRole$JAXB.class, LocaleEncodingMappingList$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, MessageDestination$JAXB.class, AbsoluteOrdering$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, ContextService$JAXB.class); } - public static WebApp readWebApp(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static WebApp readWebApp(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeWebApp(final XoXMLStreamWriter writer, final WebApp webApp, final RuntimeContext context) - throws Exception { + public static void writeWebApp(XoXMLStreamWriter writer, WebApp webApp, RuntimeContext context) + throws Exception + { _write(writer, webApp, context); } - public void write(final XoXMLStreamWriter writer, final WebApp webApp, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, WebApp webApp, RuntimeContext context) + throws Exception + { _write(writer, webApp, context); } - public final static WebApp _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final WebApp _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -132,7 +145,7 @@ public final static WebApp _read(final XoXMLStreamReader reader, RuntimeContext context = new RuntimeContext(); } - final WebApp webApp = new WebApp(); + WebApp webApp = new WebApp(); context.beforeUnmarshal(webApp, org.metatype.sxc.jaxb.LifecycleCallback.NONE); ArrayList descriptions = null; @@ -168,624 +181,661 @@ public final static WebApp _read(final XoXMLStreamReader reader, RuntimeContext List messageDestination = null; KeyedCollection dataSource = null; KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; + KeyedCollection contextService = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("web-appType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("web-appType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, WebApp.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, webApp); webApp.id = id; - } else if (("metadata-complete" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("metadata-complete" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: metadataComplete - final Boolean metadataComplete = ("1".equals(attribute.getValue()) || "true".equals(attribute.getValue())); + Boolean metadataComplete = ("1".equals(attribute.getValue())||"true".equals(attribute.getValue())); webApp.metadataComplete = metadataComplete; - } else if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("version" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: version webApp.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "metadata-complete"), new QName("", "version")); } } // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = webApp.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("distributable" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("distributable" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: distributable - final Empty distributableItem = readEmpty(elementReader, context); + Empty distributableItem = readEmpty(elementReader, context); if (distributable == null) { distributable = webApp.distributable; - if (distributable != null) { + if (distributable!= null) { distributable.clear(); } else { - distributable = new ArrayList(); + distributable = new ArrayList<>(); } } distributable.add(distributableItem); - } else if (("context-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("context-param" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: contextParam - final ParamValue contextParamItem = readParamValue(elementReader, context); + ParamValue contextParamItem = readParamValue(elementReader, context); if (contextParam == null) { contextParam = webApp.contextParam; - if (contextParam != null) { + if (contextParam!= null) { contextParam.clear(); } else { - contextParam = new ArrayList(); + contextParam = new ArrayList<>(); } } contextParam.add(contextParamItem); - } else if (("filter" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("filter" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: filter - final Filter filterItem = readFilter(elementReader, context); + Filter filterItem = readFilter(elementReader, context); if (filter == null) { filter = webApp.filter; - if (filter != null) { + if (filter!= null) { filter.clear(); } else { - filter = new ArrayList(); + filter = new ArrayList<>(); } } filter.add(filterItem); - } else if (("filter-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("filter-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: filterMapping - final FilterMapping filterMappingItem = readFilterMapping(elementReader, context); + FilterMapping filterMappingItem = readFilterMapping(elementReader, context); if (filterMapping == null) { filterMapping = webApp.filterMapping; - if (filterMapping != null) { + if (filterMapping!= null) { filterMapping.clear(); } else { - filterMapping = new ArrayList(); + filterMapping = new ArrayList<>(); } } filterMapping.add(filterMappingItem); - } else if (("listener" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("listener" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: listener - final Listener listenerItem = readListener(elementReader, context); + Listener listenerItem = readListener(elementReader, context); if (listener == null) { listener = webApp.listener; - if (listener != null) { + if (listener!= null) { listener.clear(); } else { - listener = new ArrayList(); + listener = new ArrayList<>(); } } listener.add(listenerItem); - } else if (("servlet" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("servlet" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: servlet - final Servlet servletItem = readServlet(elementReader, context); + Servlet servletItem = readServlet(elementReader, context); if (servlet == null) { servlet = webApp.servlet; - if (servlet != null) { + if (servlet!= null) { servlet.clear(); } else { - servlet = new ArrayList(); + servlet = new ArrayList<>(); } } servlet.add(servletItem); - } else if (("servlet-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("servlet-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: servletMapping - final ServletMapping servletMappingItem = readServletMapping(elementReader, context); + ServletMapping servletMappingItem = readServletMapping(elementReader, context); if (servletMapping == null) { servletMapping = webApp.servletMapping; - if (servletMapping != null) { + if (servletMapping!= null) { servletMapping.clear(); } else { - servletMapping = new ArrayList(); + servletMapping = new ArrayList<>(); } } servletMapping.add(servletMappingItem); - } else if (("session-config" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("default-context-path" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: defaultContextPath + String defaultContextPathRaw = elementReader.getElementText(); + + String defaultContextPath; + try { + defaultContextPath = Adapters.collapsedStringAdapterAdapter.unmarshal(defaultContextPathRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + webApp.defaultContextPath = defaultContextPath; + } else if (("session-config" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: sessionConfig - final SessionConfig sessionConfigItem = readSessionConfig(elementReader, context); + SessionConfig sessionConfigItem = readSessionConfig(elementReader, context); if (sessionConfig == null) { sessionConfig = webApp.sessionConfig; - if (sessionConfig != null) { + if (sessionConfig!= null) { sessionConfig.clear(); } else { - sessionConfig = new ArrayList(); + sessionConfig = new ArrayList<>(); } } sessionConfig.add(sessionConfigItem); - } else if (("mime-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("mime-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: mimeMapping - final MimeMapping mimeMappingItem = readMimeMapping(elementReader, context); + MimeMapping mimeMappingItem = readMimeMapping(elementReader, context); if (mimeMapping == null) { mimeMapping = webApp.mimeMapping; - if (mimeMapping != null) { + if (mimeMapping!= null) { mimeMapping.clear(); } else { - mimeMapping = new ArrayList(); + mimeMapping = new ArrayList<>(); } } mimeMapping.add(mimeMappingItem); - } else if (("welcome-file-list" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("welcome-file-list" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: welcomeFileList - final WelcomeFileList welcomeFileListItem = readWelcomeFileList(elementReader, context); + WelcomeFileList welcomeFileListItem = readWelcomeFileList(elementReader, context); if (welcomeFileList == null) { welcomeFileList = webApp.welcomeFileList; - if (welcomeFileList != null) { + if (welcomeFileList!= null) { welcomeFileList.clear(); } else { - welcomeFileList = new ArrayList(); + welcomeFileList = new ArrayList<>(); } } welcomeFileList.add(welcomeFileListItem); - } else if (("error-page" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("error-page" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: errorPage - final ErrorPage errorPageItem = readErrorPage(elementReader, context); + ErrorPage errorPageItem = readErrorPage(elementReader, context); if (errorPage == null) { errorPage = webApp.errorPage; - if (errorPage != null) { + if (errorPage!= null) { errorPage.clear(); } else { - errorPage = new ArrayList(); + errorPage = new ArrayList<>(); } } errorPage.add(errorPageItem); - } else if (("taglib" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("taglib" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: taglib - final Taglib taglib = readTaglib(elementReader, context); + Taglib taglib = readTaglib(elementReader, context); try { webApp.setTaglib(taglib); - } catch (final Exception e) { + } catch (Exception e) { context.setterError(reader, WebApp.class, "setTaglib", Taglib.class, e); } - } else if (("jsp-config" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("jsp-config" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: jspConfig - final JspConfig jspConfigItem = readJspConfig(elementReader, context); + JspConfig jspConfigItem = readJspConfig(elementReader, context); if (jspConfig == null) { jspConfig = webApp.jspConfig; - if (jspConfig != null) { + if (jspConfig!= null) { jspConfig.clear(); } else { - jspConfig = new ArrayList(); + jspConfig = new ArrayList<>(); } } jspConfig.add(jspConfigItem); - } else if (("security-constraint" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("security-constraint" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityConstraint - final SecurityConstraint securityConstraintItem = readSecurityConstraint(elementReader, context); + SecurityConstraint securityConstraintItem = readSecurityConstraint(elementReader, context); if (securityConstraint == null) { securityConstraint = webApp.securityConstraint; - if (securityConstraint != null) { + if (securityConstraint!= null) { securityConstraint.clear(); } else { - securityConstraint = new ArrayList(); + securityConstraint = new ArrayList<>(); } } securityConstraint.add(securityConstraintItem); - } else if (("login-config" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("login-config" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: loginConfig - final LoginConfig loginConfigItem = readLoginConfig(elementReader, context); + LoginConfig loginConfigItem = readLoginConfig(elementReader, context); if (loginConfig == null) { loginConfig = webApp.loginConfig; - if (loginConfig != null) { + if (loginConfig!= null) { loginConfig.clear(); } else { - loginConfig = new ArrayList(); + loginConfig = new ArrayList<>(); } } loginConfig.add(loginConfigItem); - } else if (("security-role" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("security-role" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: securityRole - final SecurityRole securityRoleItem = readSecurityRole(elementReader, context); + SecurityRole securityRoleItem = readSecurityRole(elementReader, context); if (securityRole == null) { securityRole = webApp.securityRole; - if (securityRole != null) { + if (securityRole!= null) { securityRole.clear(); } else { - securityRole = new ArrayList(); + securityRole = new ArrayList<>(); } } securityRole.add(securityRoleItem); - } else if (("locale-encoding-mapping-list" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("locale-encoding-mapping-list" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: localeEncodingMappingList - final LocaleEncodingMappingList localeEncodingMappingListItem = readLocaleEncodingMappingList(elementReader, context); + LocaleEncodingMappingList localeEncodingMappingListItem = readLocaleEncodingMappingList(elementReader, context); if (localeEncodingMappingList == null) { localeEncodingMappingList = webApp.localeEncodingMappingList; - if (localeEncodingMappingList != null) { + if (localeEncodingMappingList!= null) { localeEncodingMappingList.clear(); } else { - localeEncodingMappingList = new ArrayList(); + localeEncodingMappingList = new ArrayList<>(); } } localeEncodingMappingList.add(localeEncodingMappingListItem); - } else if (("env-entry" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: envEntry - final EnvEntry envEntryItem = readEnvEntry(elementReader, context); + EnvEntry envEntryItem = readEnvEntry(elementReader, context); if (envEntry == null) { envEntry = webApp.envEntry; - if (envEntry != null) { + if (envEntry!= null) { envEntry.clear(); } else { - envEntry = new KeyedCollection(); + envEntry = new KeyedCollection<>(); } } envEntry.add(envEntryItem); - } else if (("ejb-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbRef - final EjbRef ejbRefItem = readEjbRef(elementReader, context); + EjbRef ejbRefItem = readEjbRef(elementReader, context); if (ejbRef == null) { ejbRef = webApp.ejbRef; - if (ejbRef != null) { + if (ejbRef!= null) { ejbRef.clear(); } else { - ejbRef = new KeyedCollection(); + ejbRef = new KeyedCollection<>(); } } ejbRef.add(ejbRefItem); - } else if (("ejb-local-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: ejbLocalRef - final EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); if (ejbLocalRef == null) { ejbLocalRef = webApp.ejbLocalRef; - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { ejbLocalRef.clear(); } else { - ejbLocalRef = new KeyedCollection(); + ejbLocalRef = new KeyedCollection<>(); } } ejbLocalRef.add(ejbLocalRefItem); - } else if (("service-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: serviceRef - final ServiceRef serviceRefItem = readServiceRef(elementReader, context); + ServiceRef serviceRefItem = readServiceRef(elementReader, context); if (serviceRef == null) { serviceRef = webApp.serviceRef; - if (serviceRef != null) { + if (serviceRef!= null) { serviceRef.clear(); } else { - serviceRef = new KeyedCollection(); + serviceRef = new KeyedCollection<>(); } } serviceRef.add(serviceRefItem); - } else if (("resource-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceRef - final ResourceRef resourceRefItem = readResourceRef(elementReader, context); + ResourceRef resourceRefItem = readResourceRef(elementReader, context); if (resourceRef == null) { resourceRef = webApp.resourceRef; - if (resourceRef != null) { + if (resourceRef!= null) { resourceRef.clear(); } else { - resourceRef = new KeyedCollection(); + resourceRef = new KeyedCollection<>(); } } resourceRef.add(resourceRefItem); - } else if (("resource-env-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: resourceEnvRef - final ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); if (resourceEnvRef == null) { resourceEnvRef = webApp.resourceEnvRef; - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { resourceEnvRef.clear(); } else { - resourceEnvRef = new KeyedCollection(); + resourceEnvRef = new KeyedCollection<>(); } } resourceEnvRef.add(resourceEnvRefItem); - } else if (("message-destination-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestinationRef - final MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); if (messageDestinationRef == null) { messageDestinationRef = webApp.messageDestinationRef; - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { messageDestinationRef.clear(); } else { - messageDestinationRef = new KeyedCollection(); + messageDestinationRef = new KeyedCollection<>(); } } messageDestinationRef.add(messageDestinationRefItem); - } else if (("persistence-context-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceContextRef - final PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); if (persistenceContextRef == null) { persistenceContextRef = webApp.persistenceContextRef; - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { persistenceContextRef.clear(); } else { - persistenceContextRef = new KeyedCollection(); + persistenceContextRef = new KeyedCollection<>(); } } persistenceContextRef.add(persistenceContextRefItem); - } else if (("persistence-unit-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistenceUnitRef - final PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); if (persistenceUnitRef == null) { persistenceUnitRef = webApp.persistenceUnitRef; - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { persistenceUnitRef.clear(); } else { - persistenceUnitRef = new KeyedCollection(); + persistenceUnitRef = new KeyedCollection<>(); } } persistenceUnitRef.add(persistenceUnitRefItem); - } else if (("post-construct" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("post-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: postConstruct - final org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); if (postConstruct == null) { postConstruct = webApp.postConstruct; - if (postConstruct != null) { + if (postConstruct!= null) { postConstruct.clear(); } else { - postConstruct = new ArrayList(); + postConstruct = new ArrayList<>(); } } postConstruct.add(postConstructItem); - } else if (("pre-destroy" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("pre-destroy" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: preDestroy - final org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); + org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); if (preDestroy == null) { preDestroy = webApp.preDestroy; - if (preDestroy != null) { + if (preDestroy!= null) { preDestroy.clear(); } else { - preDestroy = new ArrayList(); + preDestroy = new ArrayList<>(); } } preDestroy.add(preDestroyItem); - } else if (("message-destination" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("message-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: messageDestination - final MessageDestination messageDestinationItem = readMessageDestination(elementReader, context); + MessageDestination messageDestinationItem = readMessageDestination(elementReader, context); if (messageDestination == null) { messageDestination = webApp.messageDestination; - if (messageDestination != null) { + if (messageDestination!= null) { messageDestination.clear(); } else { - messageDestination = new ArrayList(); + messageDestination = new ArrayList<>(); } } messageDestination.add(messageDestinationItem); - } else if (("absolute-ordering" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("absolute-ordering" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: absoluteOrdering - final AbsoluteOrdering absoluteOrdering = readAbsoluteOrdering(elementReader, context); + AbsoluteOrdering absoluteOrdering = readAbsoluteOrdering(elementReader, context); webApp.absoluteOrdering = absoluteOrdering; - } else if (("data-source" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: dataSource - final DataSource dataSourceItem = readDataSource(elementReader, context); + DataSource dataSourceItem = readDataSource(elementReader, context); if (dataSource == null) { dataSource = webApp.dataSource; - if (dataSource != null) { + if (dataSource!= null) { dataSource.clear(); } else { - dataSource = new KeyedCollection(); + dataSource = new KeyedCollection<>(); } } dataSource.add(dataSourceItem); - } else if (("jms-connection-factory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - // ELEMENT: dataSource - final JMSConnectionFactory connectionFactory = readJMSConnectionFactory(elementReader, context); + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); if (jmsConnectionFactories == null) { jmsConnectionFactories = webApp.jmsConnectionFactories; - if (jmsConnectionFactories != null) { + if (jmsConnectionFactories!= null) { jmsConnectionFactories.clear(); } else { jmsConnectionFactories = new KeyedCollection<>(); } } - jmsConnectionFactories.add(connectionFactory); - } else if (("module-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = webApp.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("module-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: moduleName - final String moduleNameRaw = elementReader.getElementAsString(); + String moduleNameRaw = elementReader.getElementText(); - final String moduleName; + String moduleName; try { moduleName = Adapters.collapsedStringAdapterAdapter.unmarshal(moduleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } webApp.moduleName = moduleName; - } else if (("default-context-path" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { - // ELEMENT: defaultContextPath - final String defaultContextPathRaw = elementReader.getElementAsString(); - - final String defaultContextPath; - try { - defaultContextPath = Adapters.collapsedStringAdapterAdapter.unmarshal(defaultContextPathRaw); - } catch (final Exception e) { - context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); - continue; + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = webAppContextService.getObject(reader, context, webApp); + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } } - - webApp.defaultContextPath = defaultContextPath; - } /* - else not yet used so ignored, here will come servlet 3.1 elements we don't parse cause don't need yet - */ + contextService.add(contextServiceItem); + } 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", "distributable"), new QName("http://java.sun.com/xml/ns/javaee", "context-param"), new QName("http://java.sun.com/xml/ns/javaee", "filter"), new QName("http://java.sun.com/xml/ns/javaee", "filter-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "listener"), new QName("http://java.sun.com/xml/ns/javaee", "servlet"), new QName("http://java.sun.com/xml/ns/javaee", "servlet-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "default-context-path"), new QName("http://java.sun.com/xml/ns/javaee", "session-config"), new QName("http://java.sun.com/xml/ns/javaee", "mime-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "welcome-file-list"), new QName("http://java.sun.com/xml/ns/javaee", "error-page"), new QName("http://java.sun.com/xml/ns/javaee", "taglib"), new QName("http://java.sun.com/xml/ns/javaee", "jsp-config"), new QName("http://java.sun.com/xml/ns/javaee", "security-constraint"), new QName("http://java.sun.com/xml/ns/javaee", "login-config"), new QName("http://java.sun.com/xml/ns/javaee", "security-role"), new QName("http://java.sun.com/xml/ns/javaee", "locale-encoding-mapping-list"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination"), new QName("http://java.sun.com/xml/ns/javaee", "absolute-ordering"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "module-name"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); + } } - if (descriptions != null) { + if (descriptions!= null) { try { - webApp.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + webApp.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, WebApp.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - webApp.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + webApp.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, WebApp.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { webApp.icon = icon; } - if (distributable != null) { + if (distributable!= null) { webApp.distributable = distributable; } - if (contextParam != null) { + if (contextParam!= null) { webApp.contextParam = contextParam; } - if (filter != null) { + if (filter!= null) { webApp.filter = filter; } - if (filterMapping != null) { + if (filterMapping!= null) { webApp.filterMapping = filterMapping; } - if (listener != null) { + if (listener!= null) { webApp.listener = listener; } - if (servlet != null) { + if (servlet!= null) { webApp.servlet = servlet; } - if (servletMapping != null) { + if (servletMapping!= null) { webApp.servletMapping = servletMapping; } - if (sessionConfig != null) { + if (sessionConfig!= null) { webApp.sessionConfig = sessionConfig; } - if (mimeMapping != null) { + if (mimeMapping!= null) { webApp.mimeMapping = mimeMapping; } - if (welcomeFileList != null) { + if (welcomeFileList!= null) { webApp.welcomeFileList = welcomeFileList; } - if (errorPage != null) { + if (errorPage!= null) { webApp.errorPage = errorPage; } - if (jspConfig != null) { + if (jspConfig!= null) { webApp.jspConfig = jspConfig; } - if (securityConstraint != null) { + if (securityConstraint!= null) { webApp.securityConstraint = securityConstraint; } - if (loginConfig != null) { + if (loginConfig!= null) { webApp.loginConfig = loginConfig; } - if (securityRole != null) { + if (securityRole!= null) { webApp.securityRole = securityRole; } - if (localeEncodingMappingList != null) { + if (localeEncodingMappingList!= null) { webApp.localeEncodingMappingList = localeEncodingMappingList; } - if (envEntry != null) { + if (envEntry!= null) { webApp.envEntry = envEntry; } - if (ejbRef != null) { + if (ejbRef!= null) { webApp.ejbRef = ejbRef; } - if (ejbLocalRef != null) { + if (ejbLocalRef!= null) { webApp.ejbLocalRef = ejbLocalRef; } - if (serviceRef != null) { + if (serviceRef!= null) { webApp.serviceRef = serviceRef; } - if (resourceRef != null) { + if (resourceRef!= null) { webApp.resourceRef = resourceRef; } - if (resourceEnvRef != null) { + if (resourceEnvRef!= null) { webApp.resourceEnvRef = resourceEnvRef; } - if (messageDestinationRef != null) { + if (messageDestinationRef!= null) { webApp.messageDestinationRef = messageDestinationRef; } - if (persistenceContextRef != null) { + if (persistenceContextRef!= null) { webApp.persistenceContextRef = persistenceContextRef; } - if (persistenceUnitRef != null) { + if (persistenceUnitRef!= null) { webApp.persistenceUnitRef = persistenceUnitRef; } - if (postConstruct != null) { + if (postConstruct!= null) { webApp.postConstruct = postConstruct; } - if (preDestroy != null) { + if (preDestroy!= null) { webApp.preDestroy = preDestroy; } - if (messageDestination != null) { + if (messageDestination!= null) { webApp.messageDestination = messageDestination; } - if (dataSource != null) { + if (dataSource!= null) { webApp.dataSource = dataSource; } + if (jmsConnectionFactories!= null) { + webApp.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + webApp.jmsDestinations = jmsDestinations; + } + if (contextService!= null) { + webAppContextService.setObject(reader, context, webApp, contextService); + } context.afterUnmarshal(webApp, org.metatype.sxc.jaxb.LifecycleCallback.NONE); return webApp; } - public final WebApp read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final WebApp read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final WebApp webApp, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, WebApp webApp, RuntimeContext context) + throws Exception + { if (webApp == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (WebApp.class != webApp.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (WebApp.class!= webApp.getClass()) { context.unexpectedSubclass(writer, webApp, WebApp.class); - return; + return ; } context.beforeMarshal(webApp, org.metatype.sxc.jaxb.LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = webApp.id; - if (idRaw != null) { + String idRaw = webApp.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webApp, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: metadataComplete - final Boolean metadataComplete = webApp.metadataComplete; - if (metadataComplete != null) { + Boolean metadataComplete = webApp.metadataComplete; + if (metadataComplete!= null) { writer.writeAttribute("", "", "metadata-complete", Boolean.toString(metadataComplete)); } // ATTRIBUTE: version - final String versionRaw = webApp.version; - if (versionRaw != null) { + String versionRaw = webApp.version; + if (versionRaw!= null) { String version = null; try { version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webApp, "version", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "version", version); @@ -795,12 +845,12 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web Text[] descriptions = null; try { descriptions = webApp.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(webApp, "descriptions", WebApp.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -814,12 +864,12 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web Text[] displayNames = null; try { displayNames = webApp.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(webApp, "displayNames", WebApp.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -830,10 +880,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: icon - final LocalCollection icon = webApp.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = webApp.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -844,11 +894,11 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: distributable - final List distributable = webApp.distributable; - if (distributable != null) { - for (final Empty distributableItem : distributable) { + List distributable = webApp.distributable; + if (distributable!= null) { + for (Empty distributableItem: distributable) { writer.writeStartElement(prefix, "distributable", "http://java.sun.com/xml/ns/javaee"); - if (distributableItem != null) { + if (distributableItem!= null) { writeEmpty(writer, distributableItem, context); } else { writer.writeXsiNil(); @@ -858,10 +908,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: contextParam - final List contextParam = webApp.contextParam; - if (contextParam != null) { - for (final ParamValue contextParamItem : contextParam) { - if (contextParamItem != null) { + List contextParam = webApp.contextParam; + if (contextParam!= null) { + for (ParamValue contextParamItem: contextParam) { + if (contextParamItem!= null) { writer.writeStartElement(prefix, "context-param", "http://java.sun.com/xml/ns/javaee"); writeParamValue(writer, contextParamItem, context); writer.writeEndElement(); @@ -870,11 +920,11 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: filter - final List filter = webApp.filter; - if (filter != null) { - for (final Filter filterItem : filter) { + List filter = webApp.filter; + if (filter!= null) { + for (Filter filterItem: filter) { writer.writeStartElement(prefix, "filter", "http://java.sun.com/xml/ns/javaee"); - if (filterItem != null) { + if (filterItem!= null) { writeFilter(writer, filterItem, context); } else { writer.writeXsiNil(); @@ -884,10 +934,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: filterMapping - final List filterMapping = webApp.filterMapping; - if (filterMapping != null) { - for (final FilterMapping filterMappingItem : filterMapping) { - if (filterMappingItem != null) { + List filterMapping = webApp.filterMapping; + if (filterMapping!= null) { + for (FilterMapping filterMappingItem: filterMapping) { + if (filterMappingItem!= null) { writer.writeStartElement(prefix, "filter-mapping", "http://java.sun.com/xml/ns/javaee"); writeFilterMapping(writer, filterMappingItem, context); writer.writeEndElement(); @@ -896,11 +946,11 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: listener - final List listener = webApp.listener; - if (listener != null) { - for (final Listener listenerItem : listener) { + List listener = webApp.listener; + if (listener!= null) { + for (Listener listenerItem: listener) { writer.writeStartElement(prefix, "listener", "http://java.sun.com/xml/ns/javaee"); - if (listenerItem != null) { + if (listenerItem!= null) { writeListener(writer, listenerItem, context); } else { writer.writeXsiNil(); @@ -910,11 +960,11 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: servlet - final List servlet = webApp.servlet; - if (servlet != null) { - for (final Servlet servletItem : servlet) { + List servlet = webApp.servlet; + if (servlet!= null) { + for (Servlet servletItem: servlet) { writer.writeStartElement(prefix, "servlet", "http://java.sun.com/xml/ns/javaee"); - if (servletItem != null) { + if (servletItem!= null) { writeServlet(writer, servletItem, context); } else { writer.writeXsiNil(); @@ -924,10 +974,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: servletMapping - final List servletMapping = webApp.servletMapping; - if (servletMapping != null) { - for (final ServletMapping servletMappingItem : servletMapping) { - if (servletMappingItem != null) { + List servletMapping = webApp.servletMapping; + if (servletMapping!= null) { + for (ServletMapping servletMappingItem: servletMapping) { + if (servletMappingItem!= null) { writer.writeStartElement(prefix, "servlet-mapping", "http://java.sun.com/xml/ns/javaee"); writeServletMapping(writer, servletMappingItem, context); writer.writeEndElement(); @@ -935,11 +985,25 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } } + // ELEMENT: defaultContextPath + String defaultContextPathRaw = webApp.defaultContextPath; + String defaultContextPath = null; + try { + defaultContextPath = Adapters.collapsedStringAdapterAdapter.marshal(defaultContextPathRaw); + } catch (Exception e) { + context.xmlAdapterError(webApp, "defaultContextPath", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (defaultContextPath!= null) { + writer.writeStartElement(prefix, "default-context-path", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(defaultContextPath); + writer.writeEndElement(); + } + // ELEMENT: sessionConfig - final List sessionConfig = webApp.sessionConfig; - if (sessionConfig != null) { - for (final SessionConfig sessionConfigItem : sessionConfig) { - if (sessionConfigItem != null) { + List sessionConfig = webApp.sessionConfig; + if (sessionConfig!= null) { + for (SessionConfig sessionConfigItem: sessionConfig) { + if (sessionConfigItem!= null) { writer.writeStartElement(prefix, "session-config", "http://java.sun.com/xml/ns/javaee"); writeSessionConfig(writer, sessionConfigItem, context); writer.writeEndElement(); @@ -948,10 +1012,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: mimeMapping - final List mimeMapping = webApp.mimeMapping; - if (mimeMapping != null) { - for (final MimeMapping mimeMappingItem : mimeMapping) { - if (mimeMappingItem != null) { + List mimeMapping = webApp.mimeMapping; + if (mimeMapping!= null) { + for (MimeMapping mimeMappingItem: mimeMapping) { + if (mimeMappingItem!= null) { writer.writeStartElement(prefix, "mime-mapping", "http://java.sun.com/xml/ns/javaee"); writeMimeMapping(writer, mimeMappingItem, context); writer.writeEndElement(); @@ -960,10 +1024,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: welcomeFileList - final List welcomeFileList = webApp.welcomeFileList; - if (welcomeFileList != null) { - for (final WelcomeFileList welcomeFileListItem : welcomeFileList) { - if (welcomeFileListItem != null) { + List welcomeFileList = webApp.welcomeFileList; + if (welcomeFileList!= null) { + for (WelcomeFileList welcomeFileListItem: welcomeFileList) { + if (welcomeFileListItem!= null) { writer.writeStartElement(prefix, "welcome-file-list", "http://java.sun.com/xml/ns/javaee"); writeWelcomeFileList(writer, welcomeFileListItem, context); writer.writeEndElement(); @@ -972,10 +1036,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: errorPage - final List errorPage = webApp.errorPage; - if (errorPage != null) { - for (final ErrorPage errorPageItem : errorPage) { - if (errorPageItem != null) { + List errorPage = webApp.errorPage; + if (errorPage!= null) { + for (ErrorPage errorPageItem: errorPage) { + if (errorPageItem!= null) { writer.writeStartElement(prefix, "error-page", "http://java.sun.com/xml/ns/javaee"); writeErrorPage(writer, errorPageItem, context); writer.writeEndElement(); @@ -987,20 +1051,20 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web Taglib taglib = null; try { taglib = webApp.getTaglib(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(webApp, "taglib", WebApp.class, "getTaglib", e); } - if (taglib != null) { + if (taglib!= null) { writer.writeStartElement(prefix, "taglib", "http://java.sun.com/xml/ns/javaee"); writeTaglib(writer, taglib, context); writer.writeEndElement(); } // ELEMENT: jspConfig - final List jspConfig = webApp.jspConfig; - if (jspConfig != null) { - for (final JspConfig jspConfigItem : jspConfig) { - if (jspConfigItem != null) { + List jspConfig = webApp.jspConfig; + if (jspConfig!= null) { + for (JspConfig jspConfigItem: jspConfig) { + if (jspConfigItem!= null) { writer.writeStartElement(prefix, "jsp-config", "http://java.sun.com/xml/ns/javaee"); writeJspConfig(writer, jspConfigItem, context); writer.writeEndElement(); @@ -1009,10 +1073,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: securityConstraint - final List securityConstraint = webApp.securityConstraint; - if (securityConstraint != null) { - for (final SecurityConstraint securityConstraintItem : securityConstraint) { - if (securityConstraintItem != null) { + List securityConstraint = webApp.securityConstraint; + if (securityConstraint!= null) { + for (SecurityConstraint securityConstraintItem: securityConstraint) { + if (securityConstraintItem!= null) { writer.writeStartElement(prefix, "security-constraint", "http://java.sun.com/xml/ns/javaee"); writeSecurityConstraint(writer, securityConstraintItem, context); writer.writeEndElement(); @@ -1021,10 +1085,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: loginConfig - final List loginConfig = webApp.loginConfig; - if (loginConfig != null) { - for (final LoginConfig loginConfigItem : loginConfig) { - if (loginConfigItem != null) { + List loginConfig = webApp.loginConfig; + if (loginConfig!= null) { + for (LoginConfig loginConfigItem: loginConfig) { + if (loginConfigItem!= null) { writer.writeStartElement(prefix, "login-config", "http://java.sun.com/xml/ns/javaee"); writeLoginConfig(writer, loginConfigItem, context); writer.writeEndElement(); @@ -1033,10 +1097,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: securityRole - final List securityRole = webApp.securityRole; - if (securityRole != null) { - for (final SecurityRole securityRoleItem : securityRole) { - if (securityRoleItem != null) { + List securityRole = webApp.securityRole; + if (securityRole!= null) { + for (SecurityRole securityRoleItem: securityRole) { + if (securityRoleItem!= null) { writer.writeStartElement(prefix, "security-role", "http://java.sun.com/xml/ns/javaee"); writeSecurityRole(writer, securityRoleItem, context); writer.writeEndElement(); @@ -1045,10 +1109,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: localeEncodingMappingList - final List localeEncodingMappingList = webApp.localeEncodingMappingList; - if (localeEncodingMappingList != null) { - for (final LocaleEncodingMappingList localeEncodingMappingListItem : localeEncodingMappingList) { - if (localeEncodingMappingListItem != null) { + List localeEncodingMappingList = webApp.localeEncodingMappingList; + if (localeEncodingMappingList!= null) { + for (LocaleEncodingMappingList localeEncodingMappingListItem: localeEncodingMappingList) { + if (localeEncodingMappingListItem!= null) { writer.writeStartElement(prefix, "locale-encoding-mapping-list", "http://java.sun.com/xml/ns/javaee"); writeLocaleEncodingMappingList(writer, localeEncodingMappingListItem, context); writer.writeEndElement(); @@ -1057,10 +1121,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: envEntry - final KeyedCollection envEntry = webApp.envEntry; - if (envEntry != null) { - for (final EnvEntry envEntryItem : envEntry) { - if (envEntryItem != null) { + KeyedCollection envEntry = webApp.envEntry; + if (envEntry!= null) { + for (EnvEntry envEntryItem: envEntry) { + if (envEntryItem!= null) { writer.writeStartElement(prefix, "env-entry", "http://java.sun.com/xml/ns/javaee"); writeEnvEntry(writer, envEntryItem, context); writer.writeEndElement(); @@ -1071,10 +1135,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: ejbRef - final KeyedCollection ejbRef = webApp.ejbRef; - if (ejbRef != null) { - for (final EjbRef ejbRefItem : ejbRef) { - if (ejbRefItem != null) { + KeyedCollection ejbRef = webApp.ejbRef; + if (ejbRef!= null) { + for (EjbRef ejbRefItem: ejbRef) { + if (ejbRefItem!= null) { writer.writeStartElement(prefix, "ejb-ref", "http://java.sun.com/xml/ns/javaee"); writeEjbRef(writer, ejbRefItem, context); writer.writeEndElement(); @@ -1085,10 +1149,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: ejbLocalRef - final KeyedCollection ejbLocalRef = webApp.ejbLocalRef; - if (ejbLocalRef != null) { - for (final EjbLocalRef ejbLocalRefItem : ejbLocalRef) { - if (ejbLocalRefItem != null) { + KeyedCollection ejbLocalRef = webApp.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(); @@ -1099,10 +1163,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: serviceRef - final KeyedCollection serviceRef = webApp.serviceRef; - if (serviceRef != null) { - for (final ServiceRef serviceRefItem : serviceRef) { - if (serviceRefItem != null) { + KeyedCollection serviceRef = webApp.serviceRef; + if (serviceRef!= null) { + for (ServiceRef serviceRefItem: serviceRef) { + if (serviceRefItem!= null) { writer.writeStartElement(prefix, "service-ref", "http://java.sun.com/xml/ns/javaee"); writeServiceRef(writer, serviceRefItem, context); writer.writeEndElement(); @@ -1113,10 +1177,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: resourceRef - final KeyedCollection resourceRef = webApp.resourceRef; - if (resourceRef != null) { - for (final ResourceRef resourceRefItem : resourceRef) { - if (resourceRefItem != null) { + KeyedCollection resourceRef = webApp.resourceRef; + if (resourceRef!= null) { + for (ResourceRef resourceRefItem: resourceRef) { + if (resourceRefItem!= null) { writer.writeStartElement(prefix, "resource-ref", "http://java.sun.com/xml/ns/javaee"); writeResourceRef(writer, resourceRefItem, context); writer.writeEndElement(); @@ -1127,10 +1191,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: resourceEnvRef - final KeyedCollection resourceEnvRef = webApp.resourceEnvRef; - if (resourceEnvRef != null) { - for (final ResourceEnvRef resourceEnvRefItem : resourceEnvRef) { - if (resourceEnvRefItem != null) { + KeyedCollection resourceEnvRef = webApp.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(); @@ -1141,10 +1205,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: messageDestinationRef - final KeyedCollection messageDestinationRef = webApp.messageDestinationRef; - if (messageDestinationRef != null) { - for (final MessageDestinationRef messageDestinationRefItem : messageDestinationRef) { - if (messageDestinationRefItem != null) { + KeyedCollection messageDestinationRef = webApp.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(); @@ -1155,10 +1219,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: persistenceContextRef - final KeyedCollection persistenceContextRef = webApp.persistenceContextRef; - if (persistenceContextRef != null) { - for (final PersistenceContextRef persistenceContextRefItem : persistenceContextRef) { - if (persistenceContextRefItem != null) { + KeyedCollection persistenceContextRef = webApp.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(); @@ -1169,10 +1233,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: persistenceUnitRef - final KeyedCollection persistenceUnitRef = webApp.persistenceUnitRef; - if (persistenceUnitRef != null) { - for (final PersistenceUnitRef persistenceUnitRefItem : persistenceUnitRef) { - if (persistenceUnitRefItem != null) { + KeyedCollection persistenceUnitRef = webApp.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(); @@ -1183,10 +1247,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: postConstruct - final List postConstruct = webApp.postConstruct; - if (postConstruct != null) { - for (final org.apache.openejb.jee.LifecycleCallback postConstructItem : postConstruct) { - if (postConstructItem != null) { + List postConstruct = webApp.postConstruct; + if (postConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback postConstructItem: postConstruct) { + if (postConstructItem!= null) { writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, postConstructItem, context); writer.writeEndElement(); @@ -1197,10 +1261,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: preDestroy - final List preDestroy = webApp.preDestroy; - if (preDestroy != null) { - for (final org.apache.openejb.jee.LifecycleCallback preDestroyItem : preDestroy) { - if (preDestroyItem != null) { + List preDestroy = webApp.preDestroy; + if (preDestroy!= null) { + for (org.apache.openejb.jee.LifecycleCallback preDestroyItem: preDestroy) { + if (preDestroyItem!= null) { writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee"); writeLifecycleCallback(writer, preDestroyItem, context); writer.writeEndElement(); @@ -1211,10 +1275,10 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: messageDestination - final List messageDestination = webApp.messageDestination; - if (messageDestination != null) { - for (final MessageDestination messageDestinationItem : messageDestination) { - if (messageDestinationItem != null) { + List messageDestination = webApp.messageDestination; + if (messageDestination!= null) { + for (MessageDestination messageDestinationItem: messageDestination) { + if (messageDestinationItem!= null) { writer.writeStartElement(prefix, "message-destination", "http://java.sun.com/xml/ns/javaee"); writeMessageDestination(writer, messageDestinationItem, context); writer.writeEndElement(); @@ -1225,18 +1289,18 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } // ELEMENT: absoluteOrdering - final AbsoluteOrdering absoluteOrdering = webApp.absoluteOrdering; - if (absoluteOrdering != null) { + AbsoluteOrdering absoluteOrdering = webApp.absoluteOrdering; + if (absoluteOrdering!= null) { writer.writeStartElement(prefix, "absolute-ordering", "http://java.sun.com/xml/ns/javaee"); writeAbsoluteOrdering(writer, absoluteOrdering, context); writer.writeEndElement(); } // ELEMENT: dataSource - final KeyedCollection dataSource = webApp.dataSource; - if (dataSource != null) { - for (final DataSource dataSourceItem : dataSource) { - if (dataSourceItem != null) { + KeyedCollection dataSource = webApp.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); writeDataSource(writer, dataSourceItem, context); writer.writeEndElement(); @@ -1246,20 +1310,58 @@ public final static void _write(final XoXMLStreamWriter writer, final WebApp web } } + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = webApp.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(webApp, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = webApp.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + // ELEMENT: moduleName - final String moduleNameRaw = webApp.moduleName; + String moduleNameRaw = webApp.moduleName; String moduleName = null; try { moduleName = Adapters.collapsedStringAdapterAdapter.marshal(moduleNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webApp, "moduleName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (moduleName != null) { + if (moduleName!= null) { writer.writeStartElement(prefix, "module-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(moduleName); writer.writeEndElement(); } + // ELEMENT: contextService + KeyedCollection contextService = webAppContextService.getObject(webApp, context, webApp); + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + context.afterMarshal(webApp, org.metatype.sxc.jaxb.LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebFragment$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebFragment$JAXB.java new file mode 100644 index 00000000000..9db7f0ce880 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebFragment$JAXB.java @@ -0,0 +1,1318 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.FieldAccessor; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; +import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; +import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; +import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; +import static org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef; +import static org.apache.openejb.jee.EjbRef$JAXB.readEjbRef; +import static org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef; +import static org.apache.openejb.jee.Empty$JAXB.readEmpty; +import static org.apache.openejb.jee.Empty$JAXB.writeEmpty; +import static org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry; +import static org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry; +import static org.apache.openejb.jee.ErrorPage$JAXB.readErrorPage; +import static org.apache.openejb.jee.ErrorPage$JAXB.writeErrorPage; +import static org.apache.openejb.jee.Filter$JAXB.readFilter; +import static org.apache.openejb.jee.Filter$JAXB.writeFilter; +import static org.apache.openejb.jee.FilterMapping$JAXB.readFilterMapping; +import static org.apache.openejb.jee.FilterMapping$JAXB.writeFilterMapping; +import static org.apache.openejb.jee.Icon$JAXB.readIcon; +import static org.apache.openejb.jee.Icon$JAXB.writeIcon; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; +import static org.apache.openejb.jee.JspConfig$JAXB.readJspConfig; +import static org.apache.openejb.jee.JspConfig$JAXB.writeJspConfig; +import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; +import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback; +import static org.apache.openejb.jee.Listener$JAXB.readListener; +import static org.apache.openejb.jee.Listener$JAXB.writeListener; +import static org.apache.openejb.jee.LocaleEncodingMappingList$JAXB.readLocaleEncodingMappingList; +import static org.apache.openejb.jee.LocaleEncodingMappingList$JAXB.writeLocaleEncodingMappingList; +import static org.apache.openejb.jee.LoginConfig$JAXB.readLoginConfig; +import static org.apache.openejb.jee.LoginConfig$JAXB.writeLoginConfig; +import static org.apache.openejb.jee.MessageDestination$JAXB.readMessageDestination; +import static org.apache.openejb.jee.MessageDestination$JAXB.writeMessageDestination; +import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef; +import static org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef; +import static org.apache.openejb.jee.MimeMapping$JAXB.readMimeMapping; +import static org.apache.openejb.jee.MimeMapping$JAXB.writeMimeMapping; +import static org.apache.openejb.jee.Ordering$JAXB.readOrdering; +import static org.apache.openejb.jee.Ordering$JAXB.writeOrdering; +import static org.apache.openejb.jee.ParamValue$JAXB.readParamValue; +import static org.apache.openejb.jee.ParamValue$JAXB.writeParamValue; +import static org.apache.openejb.jee.PersistenceContextRef$JAXB.readPersistenceContextRef; +import static org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef; +import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.readPersistenceUnitRef; +import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.writePersistenceUnitRef; +import static org.apache.openejb.jee.ResourceEnvRef$JAXB.readResourceEnvRef; +import static org.apache.openejb.jee.ResourceEnvRef$JAXB.writeResourceEnvRef; +import static org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef; +import static org.apache.openejb.jee.ResourceRef$JAXB.writeResourceRef; +import static org.apache.openejb.jee.SecurityConstraint$JAXB.readSecurityConstraint; +import static org.apache.openejb.jee.SecurityConstraint$JAXB.writeSecurityConstraint; +import static org.apache.openejb.jee.SecurityRole$JAXB.readSecurityRole; +import static org.apache.openejb.jee.SecurityRole$JAXB.writeSecurityRole; +import static org.apache.openejb.jee.ServiceRef$JAXB.readServiceRef; +import static org.apache.openejb.jee.ServiceRef$JAXB.writeServiceRef; +import static org.apache.openejb.jee.Servlet$JAXB.readServlet; +import static org.apache.openejb.jee.Servlet$JAXB.writeServlet; +import static org.apache.openejb.jee.ServletMapping$JAXB.readServletMapping; +import static org.apache.openejb.jee.ServletMapping$JAXB.writeServletMapping; +import static org.apache.openejb.jee.SessionConfig$JAXB.readSessionConfig; +import static org.apache.openejb.jee.SessionConfig$JAXB.writeSessionConfig; +import static org.apache.openejb.jee.Text$JAXB.readText; +import static org.apache.openejb.jee.Text$JAXB.writeText; +import static org.apache.openejb.jee.WelcomeFileList$JAXB.readWelcomeFileList; +import static org.apache.openejb.jee.WelcomeFileList$JAXB.writeWelcomeFileList; + +@SuppressWarnings({ + "StringEquality" +}) +public class WebFragment$JAXB + extends JAXBObject +{ + + private static final FieldAccessor> webFragmentContextService = new FieldAccessor<>(WebFragment.class, "contextService"); + + public WebFragment$JAXB() { + super(WebFragment.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-fragment".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-fragmentType".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, ParamValue$JAXB.class, Filter$JAXB.class, FilterMapping$JAXB.class, Listener$JAXB.class, Servlet$JAXB.class, ServletMapping$JAXB.class, SessionConfig$JAXB.class, MimeMapping$JAXB.class, WelcomeFileList$JAXB.class, ErrorPage$JAXB.class, JspConfig$JAXB.class, SecurityConstraint$JAXB.class, LoginConfig$JAXB.class, SecurityRole$JAXB.class, LocaleEncodingMappingList$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, MessageDestination$JAXB.class, Ordering$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, ContextService$JAXB.class); + } + + public static WebFragment readWebFragment(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeWebFragment(XoXMLStreamWriter writer, WebFragment webFragment, RuntimeContext context) + throws Exception + { + _write(writer, webFragment, context); + } + + public void write(XoXMLStreamWriter writer, WebFragment webFragment, RuntimeContext context) + throws Exception + { + _write(writer, webFragment, context); + } + + public static final WebFragment _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + WebFragment webFragment = new WebFragment(); + context.beforeUnmarshal(webFragment, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + ArrayList descriptions = null; + ArrayList displayNames = null; + LocalCollection icon = null; + List distributable = null; + List contextParam = null; + List filter = null; + List filterMapping = null; + List listener = null; + List servlet = null; + List servletMapping = null; + List sessionConfig = null; + List mimeMapping = null; + List welcomeFileList = null; + List errorPage = null; + List jspConfig = null; + List securityConstraint = null; + List loginConfig = null; + List securityRole = null; + List localeEncodingMappingList = null; + KeyedCollection envEntry = null; + KeyedCollection ejbRef = null; + KeyedCollection ejbLocalRef = null; + KeyedCollection serviceRef = null; + KeyedCollection resourceRef = null; + KeyedCollection resourceEnvRef = null; + KeyedCollection messageDestinationRef = null; + KeyedCollection persistenceContextRef = null; + KeyedCollection persistenceUnitRef = null; + List postConstruct = null; + List preDestroy = null; + List messageDestination = null; + KeyedCollection dataSource = null; + KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; + KeyedCollection contextService = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("web-fragmentType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, WebFragment.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, webFragment); + webFragment.id = id; + } else if (("metadata-complete" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: metadataComplete + Boolean metadataComplete = ("1".equals(attribute.getValue())||"true".equals(attribute.getValue())); + webFragment.metadataComplete = metadataComplete; + } else if (("version" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: version + webFragment.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "metadata-complete"), new QName("", "version")); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: descriptions + Text descriptionsItem = readText(elementReader, context); + if (descriptions == null) { + descriptions = new ArrayList<>(); + } + descriptions.add(descriptionsItem); + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: displayNames + Text displayNamesItem = readText(elementReader, context); + if (displayNames == null) { + displayNames = new ArrayList<>(); + } + displayNames.add(displayNamesItem); + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: icon + Icon iconItem = readIcon(elementReader, context); + if (icon == null) { + icon = webFragment.icon; + if (icon!= null) { + icon.clear(); + } else { + icon = new LocalCollection<>(); + } + } + icon.add(iconItem); + } else if (("distributable" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: distributable + Empty distributableItem = readEmpty(elementReader, context); + if (distributable == null) { + distributable = webFragment.distributable; + if (distributable!= null) { + distributable.clear(); + } else { + distributable = new ArrayList<>(); + } + } + distributable.add(distributableItem); + } else if (("context-param" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextParam + ParamValue contextParamItem = readParamValue(elementReader, context); + if (contextParam == null) { + contextParam = webFragment.contextParam; + if (contextParam!= null) { + contextParam.clear(); + } else { + contextParam = new ArrayList<>(); + } + } + contextParam.add(contextParamItem); + } else if (("filter" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: filter + Filter filterItem = readFilter(elementReader, context); + if (filter == null) { + filter = webFragment.filter; + if (filter!= null) { + filter.clear(); + } else { + filter = new ArrayList<>(); + } + } + filter.add(filterItem); + } else if (("filter-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: filterMapping + FilterMapping filterMappingItem = readFilterMapping(elementReader, context); + if (filterMapping == null) { + filterMapping = webFragment.filterMapping; + if (filterMapping!= null) { + filterMapping.clear(); + } else { + filterMapping = new ArrayList<>(); + } + } + filterMapping.add(filterMappingItem); + } else if (("listener" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: listener + Listener listenerItem = readListener(elementReader, context); + if (listener == null) { + listener = webFragment.listener; + if (listener!= null) { + listener.clear(); + } else { + listener = new ArrayList<>(); + } + } + listener.add(listenerItem); + } else if (("servlet" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: servlet + Servlet servletItem = readServlet(elementReader, context); + if (servlet == null) { + servlet = webFragment.servlet; + if (servlet!= null) { + servlet.clear(); + } else { + servlet = new ArrayList<>(); + } + } + servlet.add(servletItem); + } else if (("servlet-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: servletMapping + ServletMapping servletMappingItem = readServletMapping(elementReader, context); + if (servletMapping == null) { + servletMapping = webFragment.servletMapping; + if (servletMapping!= null) { + servletMapping.clear(); + } else { + servletMapping = new ArrayList<>(); + } + } + servletMapping.add(servletMappingItem); + } else if (("session-config" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: sessionConfig + SessionConfig sessionConfigItem = readSessionConfig(elementReader, context); + if (sessionConfig == null) { + sessionConfig = webFragment.sessionConfig; + if (sessionConfig!= null) { + sessionConfig.clear(); + } else { + sessionConfig = new ArrayList<>(); + } + } + sessionConfig.add(sessionConfigItem); + } else if (("mime-mapping" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: mimeMapping + MimeMapping mimeMappingItem = readMimeMapping(elementReader, context); + if (mimeMapping == null) { + mimeMapping = webFragment.mimeMapping; + if (mimeMapping!= null) { + mimeMapping.clear(); + } else { + mimeMapping = new ArrayList<>(); + } + } + mimeMapping.add(mimeMappingItem); + } else if (("welcome-file-list" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: welcomeFileList + WelcomeFileList welcomeFileListItem = readWelcomeFileList(elementReader, context); + if (welcomeFileList == null) { + welcomeFileList = webFragment.welcomeFileList; + if (welcomeFileList!= null) { + welcomeFileList.clear(); + } else { + welcomeFileList = new ArrayList<>(); + } + } + welcomeFileList.add(welcomeFileListItem); + } else if (("error-page" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: errorPage + ErrorPage errorPageItem = readErrorPage(elementReader, context); + if (errorPage == null) { + errorPage = webFragment.errorPage; + if (errorPage!= null) { + errorPage.clear(); + } else { + errorPage = new ArrayList<>(); + } + } + errorPage.add(errorPageItem); + } else if (("jsp-config" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jspConfig + JspConfig jspConfigItem = readJspConfig(elementReader, context); + if (jspConfig == null) { + jspConfig = webFragment.jspConfig; + if (jspConfig!= null) { + jspConfig.clear(); + } else { + jspConfig = new ArrayList<>(); + } + } + jspConfig.add(jspConfigItem); + } else if (("security-constraint" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: securityConstraint + SecurityConstraint securityConstraintItem = readSecurityConstraint(elementReader, context); + if (securityConstraint == null) { + securityConstraint = webFragment.securityConstraint; + if (securityConstraint!= null) { + securityConstraint.clear(); + } else { + securityConstraint = new ArrayList<>(); + } + } + securityConstraint.add(securityConstraintItem); + } else if (("login-config" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: loginConfig + LoginConfig loginConfigItem = readLoginConfig(elementReader, context); + if (loginConfig == null) { + loginConfig = webFragment.loginConfig; + if (loginConfig!= null) { + loginConfig.clear(); + } else { + loginConfig = new ArrayList<>(); + } + } + loginConfig.add(loginConfigItem); + } else if (("security-role" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: securityRole + SecurityRole securityRoleItem = readSecurityRole(elementReader, context); + if (securityRole == null) { + securityRole = webFragment.securityRole; + if (securityRole!= null) { + securityRole.clear(); + } else { + securityRole = new ArrayList<>(); + } + } + securityRole.add(securityRoleItem); + } else if (("locale-encoding-mapping-list" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: localeEncodingMappingList + LocaleEncodingMappingList localeEncodingMappingListItem = readLocaleEncodingMappingList(elementReader, context); + if (localeEncodingMappingList == null) { + localeEncodingMappingList = webFragment.localeEncodingMappingList; + if (localeEncodingMappingList!= null) { + localeEncodingMappingList.clear(); + } else { + localeEncodingMappingList = new ArrayList<>(); + } + } + localeEncodingMappingList.add(localeEncodingMappingListItem); + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: envEntry + EnvEntry envEntryItem = readEnvEntry(elementReader, context); + if (envEntry == null) { + envEntry = webFragment.envEntry; + if (envEntry!= null) { + envEntry.clear(); + } else { + envEntry = new KeyedCollection<>(); + } + } + envEntry.add(envEntryItem); + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbRef + EjbRef ejbRefItem = readEjbRef(elementReader, context); + if (ejbRef == null) { + ejbRef = webFragment.ejbRef; + if (ejbRef!= null) { + ejbRef.clear(); + } else { + ejbRef = new KeyedCollection<>(); + } + } + ejbRef.add(ejbRefItem); + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbLocalRef + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + if (ejbLocalRef == null) { + ejbLocalRef = webFragment.ejbLocalRef; + if (ejbLocalRef!= null) { + ejbLocalRef.clear(); + } else { + ejbLocalRef = new KeyedCollection<>(); + } + } + ejbLocalRef.add(ejbLocalRefItem); + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: serviceRef + ServiceRef serviceRefItem = readServiceRef(elementReader, context); + if (serviceRef == null) { + serviceRef = webFragment.serviceRef; + if (serviceRef!= null) { + serviceRef.clear(); + } else { + serviceRef = new KeyedCollection<>(); + } + } + serviceRef.add(serviceRefItem); + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceRef + ResourceRef resourceRefItem = readResourceRef(elementReader, context); + if (resourceRef == null) { + resourceRef = webFragment.resourceRef; + if (resourceRef!= null) { + resourceRef.clear(); + } else { + resourceRef = new KeyedCollection<>(); + } + } + resourceRef.add(resourceRefItem); + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceEnvRef + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + if (resourceEnvRef == null) { + resourceEnvRef = webFragment.resourceEnvRef; + if (resourceEnvRef!= null) { + resourceEnvRef.clear(); + } else { + resourceEnvRef = new KeyedCollection<>(); + } + } + resourceEnvRef.add(resourceEnvRefItem); + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: messageDestinationRef + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + if (messageDestinationRef == null) { + messageDestinationRef = webFragment.messageDestinationRef; + if (messageDestinationRef!= null) { + messageDestinationRef.clear(); + } else { + messageDestinationRef = new KeyedCollection<>(); + } + } + messageDestinationRef.add(messageDestinationRefItem); + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: persistenceContextRef + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + if (persistenceContextRef == null) { + persistenceContextRef = webFragment.persistenceContextRef; + if (persistenceContextRef!= null) { + persistenceContextRef.clear(); + } else { + persistenceContextRef = new KeyedCollection<>(); + } + } + persistenceContextRef.add(persistenceContextRefItem); + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: persistenceUnitRef + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + if (persistenceUnitRef == null) { + persistenceUnitRef = webFragment.persistenceUnitRef; + if (persistenceUnitRef!= null) { + persistenceUnitRef.clear(); + } else { + persistenceUnitRef = new KeyedCollection<>(); + } + } + persistenceUnitRef.add(persistenceUnitRefItem); + } else if (("post-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: postConstruct + org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); + if (postConstruct == null) { + postConstruct = webFragment.postConstruct; + if (postConstruct!= null) { + postConstruct.clear(); + } else { + postConstruct = new ArrayList<>(); + } + } + postConstruct.add(postConstructItem); + } else if (("pre-destroy" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: preDestroy + org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); + if (preDestroy == null) { + preDestroy = webFragment.preDestroy; + if (preDestroy!= null) { + preDestroy.clear(); + } else { + preDestroy = new ArrayList<>(); + } + } + preDestroy.add(preDestroyItem); + } else if (("message-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: messageDestination + MessageDestination messageDestinationItem = readMessageDestination(elementReader, context); + if (messageDestination == null) { + messageDestination = webFragment.messageDestination; + if (messageDestination!= null) { + messageDestination.clear(); + } else { + messageDestination = new ArrayList<>(); + } + } + messageDestination.add(messageDestinationItem); + } else if (("ordering" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ordering + Ordering ordering = readOrdering(elementReader, context); + webFragment.ordering = ordering; + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: dataSource + DataSource dataSourceItem = readDataSource(elementReader, context); + if (dataSource == null) { + dataSource = webFragment.dataSource; + if (dataSource!= null) { + dataSource.clear(); + } else { + dataSource = new KeyedCollection<>(); + } + } + dataSource.add(dataSourceItem); + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); + if (jmsConnectionFactories == null) { + jmsConnectionFactories = webFragment.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + jmsConnectionFactories.clear(); + } else { + jmsConnectionFactories = new KeyedCollection<>(); + } + } + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = webFragment.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: name + String nameRaw = elementReader.getElementText(); + + String name; + try { + name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + webFragment.name = name; + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = webFragmentContextService.getObject(reader, context, webFragment); + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } + } + contextService.add(contextServiceItem); + } 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", "distributable"), new QName("http://java.sun.com/xml/ns/javaee", "context-param"), new QName("http://java.sun.com/xml/ns/javaee", "filter"), new QName("http://java.sun.com/xml/ns/javaee", "filter-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "listener"), new QName("http://java.sun.com/xml/ns/javaee", "servlet"), new QName("http://java.sun.com/xml/ns/javaee", "servlet-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "session-config"), new QName("http://java.sun.com/xml/ns/javaee", "mime-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "welcome-file-list"), new QName("http://java.sun.com/xml/ns/javaee", "error-page"), new QName("http://java.sun.com/xml/ns/javaee", "jsp-config"), new QName("http://java.sun.com/xml/ns/javaee", "security-constraint"), new QName("http://java.sun.com/xml/ns/javaee", "login-config"), new QName("http://java.sun.com/xml/ns/javaee", "security-role"), new QName("http://java.sun.com/xml/ns/javaee", "locale-encoding-mapping-list"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination"), new QName("http://java.sun.com/xml/ns/javaee", "ordering"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); + } + } + if (descriptions!= null) { + try { + webFragment.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { + context.setterError(reader, WebFragment.class, "setDescriptions", Text[].class, e); + } + } + if (displayNames!= null) { + try { + webFragment.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { + context.setterError(reader, WebFragment.class, "setDisplayNames", Text[].class, e); + } + } + if (icon!= null) { + webFragment.icon = icon; + } + if (distributable!= null) { + webFragment.distributable = distributable; + } + if (contextParam!= null) { + webFragment.contextParam = contextParam; + } + if (filter!= null) { + webFragment.filter = filter; + } + if (filterMapping!= null) { + webFragment.filterMapping = filterMapping; + } + if (listener!= null) { + webFragment.listener = listener; + } + if (servlet!= null) { + webFragment.servlet = servlet; + } + if (servletMapping!= null) { + webFragment.servletMapping = servletMapping; + } + if (sessionConfig!= null) { + webFragment.sessionConfig = sessionConfig; + } + if (mimeMapping!= null) { + webFragment.mimeMapping = mimeMapping; + } + if (welcomeFileList!= null) { + webFragment.welcomeFileList = welcomeFileList; + } + if (errorPage!= null) { + webFragment.errorPage = errorPage; + } + if (jspConfig!= null) { + webFragment.jspConfig = jspConfig; + } + if (securityConstraint!= null) { + webFragment.securityConstraint = securityConstraint; + } + if (loginConfig!= null) { + webFragment.loginConfig = loginConfig; + } + if (securityRole!= null) { + webFragment.securityRole = securityRole; + } + if (localeEncodingMappingList!= null) { + webFragment.localeEncodingMappingList = localeEncodingMappingList; + } + if (envEntry!= null) { + webFragment.envEntry = envEntry; + } + if (ejbRef!= null) { + webFragment.ejbRef = ejbRef; + } + if (ejbLocalRef!= null) { + webFragment.ejbLocalRef = ejbLocalRef; + } + if (serviceRef!= null) { + webFragment.serviceRef = serviceRef; + } + if (resourceRef!= null) { + webFragment.resourceRef = resourceRef; + } + if (resourceEnvRef!= null) { + webFragment.resourceEnvRef = resourceEnvRef; + } + if (messageDestinationRef!= null) { + webFragment.messageDestinationRef = messageDestinationRef; + } + if (persistenceContextRef!= null) { + webFragment.persistenceContextRef = persistenceContextRef; + } + if (persistenceUnitRef!= null) { + webFragment.persistenceUnitRef = persistenceUnitRef; + } + if (postConstruct!= null) { + webFragment.postConstruct = postConstruct; + } + if (preDestroy!= null) { + webFragment.preDestroy = preDestroy; + } + if (messageDestination!= null) { + webFragment.messageDestination = messageDestination; + } + if (dataSource!= null) { + webFragment.dataSource = dataSource; + } + if (jmsConnectionFactories!= null) { + webFragment.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + webFragment.jmsDestinations = jmsDestinations; + } + if (contextService!= null) { + webFragmentContextService.setObject(reader, context, webFragment, contextService); + } + + context.afterUnmarshal(webFragment, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + return webFragment; + } + + public final WebFragment read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, WebFragment webFragment, RuntimeContext context) + throws Exception + { + if (webFragment == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (WebFragment.class!= webFragment.getClass()) { + context.unexpectedSubclass(writer, webFragment, WebFragment.class); + return ; + } + + context.beforeMarshal(webFragment, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = webFragment.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(webFragment, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ATTRIBUTE: metadataComplete + Boolean metadataComplete = webFragment.metadataComplete; + if (metadataComplete!= null) { + writer.writeAttribute("", "", "metadata-complete", Boolean.toString(metadataComplete)); + } + + // ATTRIBUTE: version + String versionRaw = webFragment.version; + if (versionRaw!= null) { + String version = null; + try { + version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw); + } catch (Exception e) { + context.xmlAdapterError(webFragment, "version", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "version", version); + } + + // ELEMENT: descriptions + Text[] descriptions = null; + try { + descriptions = webFragment.getDescriptions(); + } catch (Exception e) { + context.getterError(webFragment, "descriptions", WebFragment.class, "getDescriptions", e); + } + if (descriptions!= null) { + for (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(webFragment, "descriptions"); + } + } + } + + // ELEMENT: displayNames + Text[] displayNames = null; + try { + displayNames = webFragment.getDisplayNames(); + } catch (Exception e) { + context.getterError(webFragment, "displayNames", WebFragment.class, "getDisplayNames", e); + } + if (displayNames!= null) { + for (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(webFragment, "displayNames"); + } + } + } + + // ELEMENT: icon + LocalCollection icon = webFragment.icon; + if (icon!= null) { + for (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(webFragment, "icon"); + } + } + } + + // ELEMENT: distributable + List distributable = webFragment.distributable; + if (distributable!= null) { + for (Empty distributableItem: distributable) { + writer.writeStartElement(prefix, "distributable", "http://java.sun.com/xml/ns/javaee"); + if (distributableItem!= null) { + writeEmpty(writer, distributableItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + // ELEMENT: contextParam + List contextParam = webFragment.contextParam; + if (contextParam!= null) { + for (ParamValue contextParamItem: contextParam) { + if (contextParamItem!= null) { + writer.writeStartElement(prefix, "context-param", "http://java.sun.com/xml/ns/javaee"); + writeParamValue(writer, contextParamItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: filter + List filter = webFragment.filter; + if (filter!= null) { + for (Filter filterItem: filter) { + writer.writeStartElement(prefix, "filter", "http://java.sun.com/xml/ns/javaee"); + if (filterItem!= null) { + writeFilter(writer, filterItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + // ELEMENT: filterMapping + List filterMapping = webFragment.filterMapping; + if (filterMapping!= null) { + for (FilterMapping filterMappingItem: filterMapping) { + if (filterMappingItem!= null) { + writer.writeStartElement(prefix, "filter-mapping", "http://java.sun.com/xml/ns/javaee"); + writeFilterMapping(writer, filterMappingItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: listener + List listener = webFragment.listener; + if (listener!= null) { + for (Listener listenerItem: listener) { + writer.writeStartElement(prefix, "listener", "http://java.sun.com/xml/ns/javaee"); + if (listenerItem!= null) { + writeListener(writer, listenerItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + // ELEMENT: servlet + List servlet = webFragment.servlet; + if (servlet!= null) { + for (Servlet servletItem: servlet) { + writer.writeStartElement(prefix, "servlet", "http://java.sun.com/xml/ns/javaee"); + if (servletItem!= null) { + writeServlet(writer, servletItem, context); + } else { + writer.writeXsiNil(); + } + writer.writeEndElement(); + } + } + + // ELEMENT: servletMapping + List servletMapping = webFragment.servletMapping; + if (servletMapping!= null) { + for (ServletMapping servletMappingItem: servletMapping) { + if (servletMappingItem!= null) { + writer.writeStartElement(prefix, "servlet-mapping", "http://java.sun.com/xml/ns/javaee"); + writeServletMapping(writer, servletMappingItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: sessionConfig + List sessionConfig = webFragment.sessionConfig; + if (sessionConfig!= null) { + for (SessionConfig sessionConfigItem: sessionConfig) { + if (sessionConfigItem!= null) { + writer.writeStartElement(prefix, "session-config", "http://java.sun.com/xml/ns/javaee"); + writeSessionConfig(writer, sessionConfigItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: mimeMapping + List mimeMapping = webFragment.mimeMapping; + if (mimeMapping!= null) { + for (MimeMapping mimeMappingItem: mimeMapping) { + if (mimeMappingItem!= null) { + writer.writeStartElement(prefix, "mime-mapping", "http://java.sun.com/xml/ns/javaee"); + writeMimeMapping(writer, mimeMappingItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: welcomeFileList + List welcomeFileList = webFragment.welcomeFileList; + if (welcomeFileList!= null) { + for (WelcomeFileList welcomeFileListItem: welcomeFileList) { + if (welcomeFileListItem!= null) { + writer.writeStartElement(prefix, "welcome-file-list", "http://java.sun.com/xml/ns/javaee"); + writeWelcomeFileList(writer, welcomeFileListItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: errorPage + List errorPage = webFragment.errorPage; + if (errorPage!= null) { + for (ErrorPage errorPageItem: errorPage) { + if (errorPageItem!= null) { + writer.writeStartElement(prefix, "error-page", "http://java.sun.com/xml/ns/javaee"); + writeErrorPage(writer, errorPageItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: jspConfig + List jspConfig = webFragment.jspConfig; + if (jspConfig!= null) { + for (JspConfig jspConfigItem: jspConfig) { + if (jspConfigItem!= null) { + writer.writeStartElement(prefix, "jsp-config", "http://java.sun.com/xml/ns/javaee"); + writeJspConfig(writer, jspConfigItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: securityConstraint + List securityConstraint = webFragment.securityConstraint; + if (securityConstraint!= null) { + for (SecurityConstraint securityConstraintItem: securityConstraint) { + if (securityConstraintItem!= null) { + writer.writeStartElement(prefix, "security-constraint", "http://java.sun.com/xml/ns/javaee"); + writeSecurityConstraint(writer, securityConstraintItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: loginConfig + List loginConfig = webFragment.loginConfig; + if (loginConfig!= null) { + for (LoginConfig loginConfigItem: loginConfig) { + if (loginConfigItem!= null) { + writer.writeStartElement(prefix, "login-config", "http://java.sun.com/xml/ns/javaee"); + writeLoginConfig(writer, loginConfigItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: securityRole + List securityRole = webFragment.securityRole; + if (securityRole!= null) { + for (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: localeEncodingMappingList + List localeEncodingMappingList = webFragment.localeEncodingMappingList; + if (localeEncodingMappingList!= null) { + for (LocaleEncodingMappingList localeEncodingMappingListItem: localeEncodingMappingList) { + if (localeEncodingMappingListItem!= null) { + writer.writeStartElement(prefix, "locale-encoding-mapping-list", "http://java.sun.com/xml/ns/javaee"); + writeLocaleEncodingMappingList(writer, localeEncodingMappingListItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: envEntry + KeyedCollection envEntry = webFragment.envEntry; + if (envEntry!= null) { + for (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(webFragment, "envEntry"); + } + } + } + + // ELEMENT: ejbRef + KeyedCollection ejbRef = webFragment.ejbRef; + if (ejbRef!= null) { + for (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(webFragment, "ejbRef"); + } + } + } + + // ELEMENT: ejbLocalRef + KeyedCollection ejbLocalRef = webFragment.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(webFragment, "ejbLocalRef"); + } + } + } + + // ELEMENT: serviceRef + KeyedCollection serviceRef = webFragment.serviceRef; + if (serviceRef!= null) { + for (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(webFragment, "serviceRef"); + } + } + } + + // ELEMENT: resourceRef + KeyedCollection resourceRef = webFragment.resourceRef; + if (resourceRef!= null) { + for (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(webFragment, "resourceRef"); + } + } + } + + // ELEMENT: resourceEnvRef + KeyedCollection resourceEnvRef = webFragment.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(webFragment, "resourceEnvRef"); + } + } + } + + // ELEMENT: messageDestinationRef + KeyedCollection messageDestinationRef = webFragment.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(webFragment, "messageDestinationRef"); + } + } + } + + // ELEMENT: persistenceContextRef + KeyedCollection persistenceContextRef = webFragment.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(webFragment, "persistenceContextRef"); + } + } + } + + // ELEMENT: persistenceUnitRef + KeyedCollection persistenceUnitRef = webFragment.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(webFragment, "persistenceUnitRef"); + } + } + } + + // ELEMENT: postConstruct + List postConstruct = webFragment.postConstruct; + if (postConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback postConstructItem: postConstruct) { + if (postConstructItem!= null) { + writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, postConstructItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(webFragment, "postConstruct"); + } + } + } + + // ELEMENT: preDestroy + List preDestroy = webFragment.preDestroy; + if (preDestroy!= null) { + for (org.apache.openejb.jee.LifecycleCallback preDestroyItem: preDestroy) { + if (preDestroyItem!= null) { + writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, preDestroyItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(webFragment, "preDestroy"); + } + } + } + + // ELEMENT: messageDestination + List messageDestination = webFragment.messageDestination; + if (messageDestination!= null) { + for (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(webFragment, "messageDestination"); + } + } + } + + // ELEMENT: ordering + Ordering ordering = webFragment.ordering; + if (ordering!= null) { + writer.writeStartElement(prefix, "ordering", "http://java.sun.com/xml/ns/javaee"); + writeOrdering(writer, ordering, context); + writer.writeEndElement(); + } + + // ELEMENT: dataSource + KeyedCollection dataSource = webFragment.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { + writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); + writeDataSource(writer, dataSourceItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(webFragment, "dataSource"); + } + } + } + + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = webFragment.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(webFragment, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = webFragment.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: name + String nameRaw = webFragment.name; + String name = null; + try { + name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); + } catch (Exception e) { + context.xmlAdapterError(webFragment, "name", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (name!= null) { + writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(name); + writer.writeEndElement(); + } + + // ELEMENT: contextService + KeyedCollection contextService = webFragmentContextService.getObject(webFragment, context, webFragment); + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + + context.afterMarshal(webFragment, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebResourceCollection$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebResourceCollection$JAXB.java index 12aa647b66d..13429a0513c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebResourceCollection$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebResourceCollection$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,11 +29,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; @@ -36,30 +37,35 @@ "StringEquality" }) public class WebResourceCollection$JAXB - extends JAXBObject { + extends JAXBObject +{ public WebResourceCollection$JAXB() { super(WebResourceCollection.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-resource-collectionType".intern()), Text$JAXB.class); } - public static WebResourceCollection readWebResourceCollection(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static WebResourceCollection readWebResourceCollection(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeWebResourceCollection(final XoXMLStreamWriter writer, final WebResourceCollection webResourceCollection, final RuntimeContext context) - throws Exception { + public static void writeWebResourceCollection(XoXMLStreamWriter writer, WebResourceCollection webResourceCollection, RuntimeContext context) + throws Exception + { _write(writer, webResourceCollection, context); } - public void write(final XoXMLStreamWriter writer, final WebResourceCollection webResourceCollection, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, WebResourceCollection webResourceCollection, RuntimeContext context) + throws Exception + { _write(writer, webResourceCollection, context); } - public final static WebResourceCollection _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final WebResourceCollection _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,7 +76,7 @@ public final static WebResourceCollection _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final WebResourceCollection webResourceCollection = new WebResourceCollection(); + WebResourceCollection webResourceCollection = new WebResourceCollection(); context.beforeUnmarshal(webResourceCollection, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -79,107 +85,107 @@ public final static WebResourceCollection _read(final XoXMLStreamReader reader, List httpMethodOmission = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("web-resource-collectionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("web-resource-collectionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, WebResourceCollection.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, webResourceCollection); webResourceCollection.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("web-resource-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("web-resource-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: webResourceName - final String webResourceNameRaw = elementReader.getElementAsString(); + String webResourceNameRaw = elementReader.getElementText(); - final String webResourceName; + String webResourceName; try { webResourceName = Adapters.collapsedStringAdapterAdapter.unmarshal(webResourceNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } webResourceCollection.webResourceName = webResourceName; - } else if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: descriptions - final Text descriptionsItem = readText(elementReader, context); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("url-pattern" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("url-pattern" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: urlPattern - final String urlPatternItemRaw = elementReader.getElementAsString(); + String urlPatternItemRaw = elementReader.getElementText(); - final String urlPatternItem; + String urlPatternItem; try { urlPatternItem = Adapters.trimStringAdapterAdapter.unmarshal(urlPatternItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, TrimStringAdapter.class, String.class, String.class, e); continue; } if (urlPattern == null) { urlPattern = webResourceCollection.urlPattern; - if (urlPattern != null) { + if (urlPattern!= null) { urlPattern.clear(); } else { - urlPattern = new ArrayList(); + urlPattern = new ArrayList<>(); } } urlPattern.add(urlPatternItem); - } else if (("http-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("http-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: httpMethod - final String httpMethodItemRaw = elementReader.getElementAsString(); + String httpMethodItemRaw = elementReader.getElementText(); - final String httpMethodItem; + String httpMethodItem; try { httpMethodItem = Adapters.collapsedStringAdapterAdapter.unmarshal(httpMethodItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (httpMethod == null) { httpMethod = webResourceCollection.httpMethod; - if (httpMethod != null) { + if (httpMethod!= null) { httpMethod.clear(); } else { - httpMethod = new ArrayList(); + httpMethod = new ArrayList<>(); } } httpMethod.add(httpMethodItem); - } else if (("http-method-omission" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("http-method-omission" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: httpMethodOmission - final String httpMethodOmissionItemRaw = elementReader.getElementAsString(); + String httpMethodOmissionItemRaw = elementReader.getElementText(); - final String httpMethodOmissionItem; + String httpMethodOmissionItem; try { httpMethodOmissionItem = Adapters.collapsedStringAdapterAdapter.unmarshal(httpMethodOmissionItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (httpMethodOmission == null) { httpMethodOmission = webResourceCollection.httpMethodOmission; - if (httpMethodOmission != null) { + if (httpMethodOmission!= null) { httpMethodOmission.clear(); } else { - httpMethodOmission = new ArrayList(); + httpMethodOmission = new ArrayList<>(); } } httpMethodOmission.add(httpMethodOmissionItem); @@ -187,20 +193,20 @@ public final static WebResourceCollection _read(final XoXMLStreamReader reader, context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "web-resource-name"), new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "url-pattern"), new QName("http://java.sun.com/xml/ns/javaee", "http-method"), new QName("http://java.sun.com/xml/ns/javaee", "http-method-omission")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - webResourceCollection.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + webResourceCollection.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, WebResourceCollection.class, "setDescriptions", Text[].class, e); } } - if (urlPattern != null) { + if (urlPattern!= null) { webResourceCollection.urlPattern = urlPattern; } - if (httpMethod != null) { + if (httpMethod!= null) { webResourceCollection.httpMethod = httpMethod; } - if (httpMethodOmission != null) { + if (httpMethodOmission!= null) { webResourceCollection.httpMethodOmission = httpMethodOmission; } @@ -209,52 +215,54 @@ public final static WebResourceCollection _read(final XoXMLStreamReader reader, return webResourceCollection; } - public final WebResourceCollection read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final WebResourceCollection read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final WebResourceCollection webResourceCollection, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, WebResourceCollection webResourceCollection, RuntimeContext context) + throws Exception + { if (webResourceCollection == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (WebResourceCollection.class != webResourceCollection.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (WebResourceCollection.class!= webResourceCollection.getClass()) { context.unexpectedSubclass(writer, webResourceCollection, WebResourceCollection.class); - return; + return ; } context.beforeMarshal(webResourceCollection, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = webResourceCollection.id; - if (idRaw != null) { + String idRaw = webResourceCollection.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webResourceCollection, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: webResourceName - final String webResourceNameRaw = webResourceCollection.webResourceName; + String webResourceNameRaw = webResourceCollection.webResourceName; String webResourceName = null; try { webResourceName = Adapters.collapsedStringAdapterAdapter.marshal(webResourceNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webResourceCollection, "webResourceName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (webResourceName != null) { + if (webResourceName!= null) { writer.writeStartElement(prefix, "web-resource-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(webResourceName); writer.writeEndElement(); @@ -266,12 +274,12 @@ public final static void _write(final XoXMLStreamWriter writer, final WebResourc Text[] descriptions = null; try { descriptions = webResourceCollection.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(webResourceCollection, "descriptions", WebResourceCollection.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -282,16 +290,16 @@ public final static void _write(final XoXMLStreamWriter writer, final WebResourc } // ELEMENT: urlPattern - final List urlPatternRaw = webResourceCollection.urlPattern; - if (urlPatternRaw != null) { - for (final String urlPatternItem : urlPatternRaw) { + List urlPatternRaw = webResourceCollection.urlPattern; + if (urlPatternRaw!= null) { + for (String urlPatternItem: urlPatternRaw) { String urlPattern = null; try { urlPattern = Adapters.trimStringAdapterAdapter.marshal(urlPatternItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webResourceCollection, "urlPattern", TrimStringAdapter.class, List.class, List.class, e); } - if (urlPattern != null) { + if (urlPattern!= null) { writer.writeStartElement(prefix, "url-pattern", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(urlPattern); writer.writeEndElement(); @@ -302,16 +310,16 @@ public final static void _write(final XoXMLStreamWriter writer, final WebResourc } // ELEMENT: httpMethod - final List httpMethodRaw = webResourceCollection.httpMethod; - if (httpMethodRaw != null) { - for (final String httpMethodItem : httpMethodRaw) { + List httpMethodRaw = webResourceCollection.httpMethod; + if (httpMethodRaw!= null) { + for (String httpMethodItem: httpMethodRaw) { String httpMethod = null; try { httpMethod = Adapters.collapsedStringAdapterAdapter.marshal(httpMethodItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webResourceCollection, "httpMethod", CollapsedStringAdapter.class, List.class, List.class, e); } - if (httpMethod != null) { + if (httpMethod!= null) { writer.writeStartElement(prefix, "http-method", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(httpMethod); writer.writeEndElement(); @@ -320,16 +328,16 @@ public final static void _write(final XoXMLStreamWriter writer, final WebResourc } // ELEMENT: httpMethodOmission - final List httpMethodOmissionRaw = webResourceCollection.httpMethodOmission; - if (httpMethodOmissionRaw != null) { - for (final String httpMethodOmissionItem : httpMethodOmissionRaw) { + List httpMethodOmissionRaw = webResourceCollection.httpMethodOmission; + if (httpMethodOmissionRaw!= null) { + for (String httpMethodOmissionItem: httpMethodOmissionRaw) { String httpMethodOmission = null; try { httpMethodOmission = Adapters.collapsedStringAdapterAdapter.marshal(httpMethodOmissionItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webResourceCollection, "httpMethodOmission", CollapsedStringAdapter.class, List.class, List.class, e); } - if (httpMethodOmission != null) { + if (httpMethodOmission!= null) { writer.writeStartElement(prefix, "http-method-omission", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(httpMethodOmission); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebserviceDescription$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebserviceDescription$JAXB.java index 6fb86384ab0..91627e7f6a2 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebserviceDescription$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebserviceDescription$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,9 +27,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -36,30 +37,35 @@ "StringEquality" }) public class WebserviceDescription$JAXB - extends JAXBObject { + extends JAXBObject +{ public WebserviceDescription$JAXB() { super(WebserviceDescription.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "webservice-descriptionType".intern()), Icon$JAXB.class, PortComponent$JAXB.class); } - public static WebserviceDescription readWebserviceDescription(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static WebserviceDescription readWebserviceDescription(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeWebserviceDescription(final XoXMLStreamWriter writer, final WebserviceDescription webserviceDescription, final RuntimeContext context) - throws Exception { + public static void writeWebserviceDescription(XoXMLStreamWriter writer, WebserviceDescription webserviceDescription, RuntimeContext context) + throws Exception + { _write(writer, webserviceDescription, context); } - public void write(final XoXMLStreamWriter writer, final WebserviceDescription webserviceDescription, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, WebserviceDescription webserviceDescription, RuntimeContext context) + throws Exception + { _write(writer, webserviceDescription, context); } - public final static WebserviceDescription _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final WebserviceDescription _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -70,111 +76,111 @@ public final static WebserviceDescription _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final WebserviceDescription webserviceDescription = new WebserviceDescription(); + WebserviceDescription webserviceDescription = new WebserviceDescription(); context.beforeUnmarshal(webserviceDescription, LifecycleCallback.NONE); KeyedCollection portComponent = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("webservice-descriptionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("webservice-descriptionType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, WebserviceDescription.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, webserviceDescription); webserviceDescription.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: description - final String descriptionRaw = elementReader.getElementAsString(); + String descriptionRaw = elementReader.getElementText(); - final String description; + String description; try { description = Adapters.collapsedStringAdapterAdapter.unmarshal(descriptionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } webserviceDescription.description = description; - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayName - final String displayNameRaw = elementReader.getElementAsString(); + String displayNameRaw = elementReader.getElementText(); - final String displayName; + String displayName; try { displayName = Adapters.collapsedStringAdapterAdapter.unmarshal(displayNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } webserviceDescription.displayName = displayName; - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon icon = readIcon(elementReader, context); + Icon icon = readIcon(elementReader, context); webserviceDescription.icon = icon; - } else if (("webservice-description-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("webservice-description-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: webserviceDescriptionName - final String webserviceDescriptionNameRaw = elementReader.getElementAsString(); + String webserviceDescriptionNameRaw = elementReader.getElementText(); - final String webserviceDescriptionName; + String webserviceDescriptionName; try { webserviceDescriptionName = Adapters.collapsedStringAdapterAdapter.unmarshal(webserviceDescriptionNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } webserviceDescription.webserviceDescriptionName = webserviceDescriptionName; - } else if (("wsdl-file" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-file" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlFile - final String wsdlFileRaw = elementReader.getElementAsString(); + String wsdlFileRaw = elementReader.getElementText(); - final String wsdlFile; + String wsdlFile; try { wsdlFile = Adapters.collapsedStringAdapterAdapter.unmarshal(wsdlFileRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } webserviceDescription.wsdlFile = wsdlFile; - } else if (("jaxrpc-mapping-file" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("jaxrpc-mapping-file" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: jaxrpcMappingFile - final String jaxrpcMappingFileRaw = elementReader.getElementAsString(); + String jaxrpcMappingFileRaw = elementReader.getElementText(); - final String jaxrpcMappingFile; + String jaxrpcMappingFile; try { jaxrpcMappingFile = Adapters.collapsedStringAdapterAdapter.unmarshal(jaxrpcMappingFileRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } webserviceDescription.jaxrpcMappingFile = jaxrpcMappingFile; - } else if (("port-component" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("port-component" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: portComponent - final PortComponent portComponentItem = readPortComponent(elementReader, context); + PortComponent portComponentItem = readPortComponent(elementReader, context); if (portComponent == null) { portComponent = webserviceDescription.portComponent; - if (portComponent != null) { + if (portComponent!= null) { portComponent.clear(); } else { - portComponent = new KeyedCollection(); + portComponent = new KeyedCollection<>(); } } portComponent.add(portComponentItem); @@ -182,7 +188,7 @@ public final static WebserviceDescription _read(final XoXMLStreamReader reader, 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", "webservice-description-name"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-file"), new QName("http://java.sun.com/xml/ns/javaee", "jaxrpc-mapping-file"), new QName("http://java.sun.com/xml/ns/javaee", "port-component")); } } - if (portComponent != null) { + if (portComponent!= null) { webserviceDescription.portComponent = portComponent; } @@ -191,88 +197,90 @@ public final static WebserviceDescription _read(final XoXMLStreamReader reader, return webserviceDescription; } - public final WebserviceDescription read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final WebserviceDescription read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final WebserviceDescription webserviceDescription, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, WebserviceDescription webserviceDescription, RuntimeContext context) + throws Exception + { if (webserviceDescription == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (WebserviceDescription.class != webserviceDescription.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (WebserviceDescription.class!= webserviceDescription.getClass()) { context.unexpectedSubclass(writer, webserviceDescription, WebserviceDescription.class); - return; + return ; } context.beforeMarshal(webserviceDescription, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = webserviceDescription.id; - if (idRaw != null) { + String idRaw = webserviceDescription.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webserviceDescription, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: description - final String descriptionRaw = webserviceDescription.description; + String descriptionRaw = webserviceDescription.description; String description = null; try { description = Adapters.collapsedStringAdapterAdapter.marshal(descriptionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webserviceDescription, "description", CollapsedStringAdapter.class, String.class, String.class, e); } - if (description != null) { + if (description!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(description); writer.writeEndElement(); } // ELEMENT: displayName - final String displayNameRaw = webserviceDescription.displayName; + String displayNameRaw = webserviceDescription.displayName; String displayName = null; try { displayName = Adapters.collapsedStringAdapterAdapter.marshal(displayNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webserviceDescription, "displayName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (displayName != null) { + if (displayName!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(displayName); writer.writeEndElement(); } // ELEMENT: icon - final Icon icon = webserviceDescription.icon; - if (icon != null) { + Icon icon = webserviceDescription.icon; + if (icon!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, icon, context); writer.writeEndElement(); } // ELEMENT: webserviceDescriptionName - final String webserviceDescriptionNameRaw = webserviceDescription.webserviceDescriptionName; + String webserviceDescriptionNameRaw = webserviceDescription.webserviceDescriptionName; String webserviceDescriptionName = null; try { webserviceDescriptionName = Adapters.collapsedStringAdapterAdapter.marshal(webserviceDescriptionNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webserviceDescription, "webserviceDescriptionName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (webserviceDescriptionName != null) { + if (webserviceDescriptionName!= null) { writer.writeStartElement(prefix, "webservice-description-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(webserviceDescriptionName); writer.writeEndElement(); @@ -281,38 +289,38 @@ public final static void _write(final XoXMLStreamWriter writer, final Webservice } // ELEMENT: wsdlFile - final String wsdlFileRaw = webserviceDescription.wsdlFile; + String wsdlFileRaw = webserviceDescription.wsdlFile; String wsdlFile = null; try { wsdlFile = Adapters.collapsedStringAdapterAdapter.marshal(wsdlFileRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webserviceDescription, "wsdlFile", CollapsedStringAdapter.class, String.class, String.class, e); } - if (wsdlFile != null) { + 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 = webserviceDescription.jaxrpcMappingFile; + String jaxrpcMappingFileRaw = webserviceDescription.jaxrpcMappingFile; String jaxrpcMappingFile = null; try { jaxrpcMappingFile = Adapters.collapsedStringAdapterAdapter.marshal(jaxrpcMappingFileRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webserviceDescription, "jaxrpcMappingFile", CollapsedStringAdapter.class, String.class, String.class, e); } - if (jaxrpcMappingFile != null) { + if (jaxrpcMappingFile!= null) { writer.writeStartElement(prefix, "jaxrpc-mapping-file", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(jaxrpcMappingFile); writer.writeEndElement(); } // ELEMENT: portComponent - final KeyedCollection portComponent = webserviceDescription.portComponent; - if (portComponent != null) { - for (final PortComponent portComponentItem : portComponent) { - if (portComponentItem != null) { + KeyedCollection portComponent = webserviceDescription.portComponent; + if (portComponent!= null) { + for (PortComponent portComponentItem: portComponent) { + if (portComponentItem!= null) { writer.writeStartElement(prefix, "port-component", "http://java.sun.com/xml/ns/javaee"); writePortComponent(writer, portComponentItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Webservices$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Webservices$JAXB.java index 06660ce1d4e..5493b4f80e5 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Webservices$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Webservices$JAXB.java @@ -1,21 +1,26 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,10 +28,6 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; import static org.apache.openejb.jee.Icon$JAXB.readIcon; import static org.apache.openejb.jee.Icon$JAXB.writeIcon; @@ -39,30 +40,35 @@ "StringEquality" }) public class Webservices$JAXB - extends JAXBObject { + extends JAXBObject +{ public Webservices$JAXB() { super(Webservices.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "webservices".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "webservicesType".intern()), Text$JAXB.class, Icon$JAXB.class, WebserviceDescription$JAXB.class); } - public static Webservices readWebservices(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static Webservices readWebservices(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeWebservices(final XoXMLStreamWriter writer, final Webservices webservices, final RuntimeContext context) - throws Exception { + public static void writeWebservices(XoXMLStreamWriter writer, Webservices webservices, RuntimeContext context) + throws Exception + { _write(writer, webservices, context); } - public void write(final XoXMLStreamWriter writer, final Webservices webservices, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, Webservices webservices, RuntimeContext context) + throws Exception + { _write(writer, webservices, context); } - public final static Webservices _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final Webservices _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -73,7 +79,7 @@ public final static Webservices _read(final XoXMLStreamReader reader, RuntimeCon context = new RuntimeContext(); } - final Webservices webservices = new Webservices(); + Webservices webservices = new Webservices(); context.beforeUnmarshal(webservices, LifecycleCallback.NONE); ArrayList descriptions = null; @@ -82,65 +88,65 @@ public final static Webservices _read(final XoXMLStreamReader reader, RuntimeCon KeyedCollection webserviceDescription = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("webservicesType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("webservicesType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Webservices.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, webservices); webservices.id = id; - } else if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + } else if (("version" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: version webservices.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "version")); } } // Read elements - for (final XoXMLStreamReader elementReader : reader.getChildElements()) { - if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (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); + Text descriptionsItem = readText(elementReader, context); if (descriptions == null) { - descriptions = new ArrayList(); + descriptions = new ArrayList<>(); } descriptions.add(descriptionsItem); - } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: displayNames - final Text displayNamesItem = readText(elementReader, context); + Text displayNamesItem = readText(elementReader, context); if (displayNames == null) { - displayNames = new ArrayList(); + displayNames = new ArrayList<>(); } displayNames.add(displayNamesItem); - } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: icon - final Icon iconItem = readIcon(elementReader, context); + Icon iconItem = readIcon(elementReader, context); if (icon == null) { icon = webservices.icon; - if (icon != null) { + if (icon!= null) { icon.clear(); } else { - icon = new LocalCollection(); + icon = new LocalCollection<>(); } } icon.add(iconItem); - } else if (("webservice-description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("webservice-description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: webserviceDescription - final WebserviceDescription webserviceDescriptionItem = readWebserviceDescription(elementReader, context); + WebserviceDescription webserviceDescriptionItem = readWebserviceDescription(elementReader, context); if (webserviceDescription == null) { webserviceDescription = webservices.webserviceDescription; - if (webserviceDescription != null) { + if (webserviceDescription!= null) { webserviceDescription.clear(); } else { - webserviceDescription = new KeyedCollection(); + webserviceDescription = new KeyedCollection<>(); } } webserviceDescription.add(webserviceDescriptionItem); @@ -148,24 +154,24 @@ public final static Webservices _read(final XoXMLStreamReader reader, RuntimeCon 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", "webservice-description")); } } - if (descriptions != null) { + if (descriptions!= null) { try { - webservices.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); - } catch (final Exception e) { + webservices.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { context.setterError(reader, Webservices.class, "setDescriptions", Text[].class, e); } } - if (displayNames != null) { + if (displayNames!= null) { try { - webservices.setDisplayNames(displayNames.toArray(new Text[displayNames.size()])); - } catch (final Exception e) { + webservices.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { context.setterError(reader, Webservices.class, "setDisplayNames", Text[].class, e); } } - if (icon != null) { + if (icon!= null) { webservices.icon = icon; } - if (webserviceDescription != null) { + if (webserviceDescription!= null) { webservices.webserviceDescription = webserviceDescription; } @@ -174,50 +180,52 @@ public final static Webservices _read(final XoXMLStreamReader reader, RuntimeCon return webservices; } - public final Webservices read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final Webservices read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final Webservices webservices, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, Webservices webservices, RuntimeContext context) + throws Exception + { if (webservices == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (Webservices.class != webservices.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (Webservices.class!= webservices.getClass()) { context.unexpectedSubclass(writer, webservices, Webservices.class); - return; + return ; } context.beforeMarshal(webservices, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = webservices.id; - if (idRaw != null) { + String idRaw = webservices.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webservices, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ATTRIBUTE: version - final String versionRaw = webservices.version; - if (versionRaw != null) { + String versionRaw = webservices.version; + if (versionRaw!= null) { String version = null; try { version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(webservices, "version", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "version", version); @@ -227,12 +235,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Webservice Text[] descriptions = null; try { descriptions = webservices.getDescriptions(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(webservices, "descriptions", Webservices.class, "getDescriptions", e); } - if (descriptions != null) { - for (final Text descriptionsItem : descriptions) { - if (descriptionsItem != null) { + if (descriptions!= null) { + for (Text descriptionsItem: descriptions) { + if (descriptionsItem!= null) { writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee"); writeText(writer, descriptionsItem, context); writer.writeEndElement(); @@ -246,12 +254,12 @@ public final static void _write(final XoXMLStreamWriter writer, final Webservice Text[] displayNames = null; try { displayNames = webservices.getDisplayNames(); - } catch (final Exception e) { + } catch (Exception e) { context.getterError(webservices, "displayNames", Webservices.class, "getDisplayNames", e); } - if (displayNames != null) { - for (final Text displayNamesItem : displayNames) { - if (displayNamesItem != null) { + if (displayNames!= null) { + for (Text displayNamesItem: displayNames) { + if (displayNamesItem!= null) { writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee"); writeText(writer, displayNamesItem, context); writer.writeEndElement(); @@ -262,10 +270,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Webservice } // ELEMENT: icon - final LocalCollection icon = webservices.icon; - if (icon != null) { - for (final Icon iconItem : icon) { - if (iconItem != null) { + LocalCollection icon = webservices.icon; + if (icon!= null) { + for (Icon iconItem: icon) { + if (iconItem!= null) { writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee"); writeIcon(writer, iconItem, context); writer.writeEndElement(); @@ -276,10 +284,10 @@ public final static void _write(final XoXMLStreamWriter writer, final Webservice } // ELEMENT: webserviceDescription - final KeyedCollection webserviceDescription = webservices.webserviceDescription; - if (webserviceDescription != null) { - for (final WebserviceDescription webserviceDescriptionItem : webserviceDescription) { - if (webserviceDescriptionItem != null) { + KeyedCollection webserviceDescription = webservices.webserviceDescription; + if (webserviceDescription!= null) { + for (WebserviceDescription webserviceDescriptionItem: webserviceDescription) { + if (webserviceDescriptionItem!= null) { writer.writeStartElement(prefix, "webservice-description", "http://java.sun.com/xml/ns/javaee"); writeWebserviceDescription(writer, webserviceDescriptionItem, context); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WelcomeFileList$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WelcomeFileList$JAXB.java index 9af80bc74a0..752837e43ba 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WelcomeFileList$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WelcomeFileList$JAXB.java @@ -1,21 +1,27 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,40 +29,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings({ "StringEquality" }) public class WelcomeFileList$JAXB - extends JAXBObject { + extends JAXBObject +{ public WelcomeFileList$JAXB() { super(WelcomeFileList.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "welcome-file-listType".intern())); } - public static WelcomeFileList readWelcomeFileList(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static WelcomeFileList readWelcomeFileList(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeWelcomeFileList(final XoXMLStreamWriter writer, final WelcomeFileList welcomeFileList, final RuntimeContext context) - throws Exception { + public static void writeWelcomeFileList(XoXMLStreamWriter writer, WelcomeFileList welcomeFileList, RuntimeContext context) + throws Exception + { _write(writer, welcomeFileList, context); } - public void write(final XoXMLStreamWriter writer, final WelcomeFileList welcomeFileList, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, WelcomeFileList welcomeFileList, RuntimeContext context) + throws Exception + { _write(writer, welcomeFileList, context); } - public final static WelcomeFileList _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final WelcomeFileList _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -67,51 +72,51 @@ public final static WelcomeFileList _read(final XoXMLStreamReader reader, Runtim context = new RuntimeContext(); } - final WelcomeFileList welcomeFileList = new WelcomeFileList(); + WelcomeFileList welcomeFileList = new WelcomeFileList(); context.beforeUnmarshal(welcomeFileList, LifecycleCallback.NONE); List welcomeFile = null; // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("welcome-file-listType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("welcome-file-listType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, WelcomeFileList.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, welcomeFileList); welcomeFileList.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("welcome-file" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("welcome-file" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: welcomeFile - final String welcomeFileItemRaw = elementReader.getElementAsString(); + String welcomeFileItemRaw = elementReader.getElementText(); - final String welcomeFileItem; + String welcomeFileItem; try { welcomeFileItem = Adapters.collapsedStringAdapterAdapter.unmarshal(welcomeFileItemRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } if (welcomeFile == null) { welcomeFile = welcomeFileList.welcomeFile; - if (welcomeFile != null) { + if (welcomeFile!= null) { welcomeFile.clear(); } else { - welcomeFile = new ArrayList(); + welcomeFile = new ArrayList<>(); } } welcomeFile.add(welcomeFileItem); @@ -119,7 +124,7 @@ public final static WelcomeFileList _read(final XoXMLStreamReader reader, Runtim context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "welcome-file")); } } - if (welcomeFile != null) { + if (welcomeFile!= null) { welcomeFileList.welcomeFile = welcomeFile; } @@ -128,53 +133,55 @@ public final static WelcomeFileList _read(final XoXMLStreamReader reader, Runtim return welcomeFileList; } - public final WelcomeFileList read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final WelcomeFileList read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final WelcomeFileList welcomeFileList, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, WelcomeFileList welcomeFileList, RuntimeContext context) + throws Exception + { if (welcomeFileList == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - if (WelcomeFileList.class != welcomeFileList.getClass()) { + if (WelcomeFileList.class!= welcomeFileList.getClass()) { context.unexpectedSubclass(writer, welcomeFileList, WelcomeFileList.class); - return; + return ; } context.beforeMarshal(welcomeFileList, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = welcomeFileList.id; - if (idRaw != null) { + String idRaw = welcomeFileList.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(welcomeFileList, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: welcomeFile - final List welcomeFileRaw = welcomeFileList.welcomeFile; - if (welcomeFileRaw != null) { - for (final String welcomeFileItem : welcomeFileRaw) { + List welcomeFileRaw = welcomeFileList.welcomeFile; + if (welcomeFileRaw!= null) { + for (String welcomeFileItem: welcomeFileRaw) { String welcomeFile = null; try { welcomeFile = Adapters.collapsedStringAdapterAdapter.marshal(welcomeFileItem); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(welcomeFileList, "welcomeFile", CollapsedStringAdapter.class, List.class, List.class, e); } - if (welcomeFile != null) { + if (welcomeFile!= null) { writer.writeStartElementWithAutoPrefix("http://java.sun.com/xml/ns/javaee", "welcome-file"); writer.writeCharacters(welcomeFile); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WsdlMessageMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WsdlMessageMapping$JAXB.java index 08a2b9baf4f..94831428110 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WsdlMessageMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WsdlMessageMapping$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -24,38 +28,39 @@ import org.metatype.sxc.util.XoXMLStreamWriter; import org.w3c.dom.Element; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class WsdlMessageMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public WsdlMessageMapping$JAXB() { super(WsdlMessageMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "wsdl-message-mappingType".intern())); } - public static WsdlMessageMapping readWsdlMessageMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static WsdlMessageMapping readWsdlMessageMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeWsdlMessageMapping(final XoXMLStreamWriter writer, final WsdlMessageMapping wsdlMessageMapping, final RuntimeContext context) - throws Exception { + public static void writeWsdlMessageMapping(XoXMLStreamWriter writer, WsdlMessageMapping wsdlMessageMapping, RuntimeContext context) + throws Exception + { _write(writer, wsdlMessageMapping, context); } - public void write(final XoXMLStreamWriter writer, final WsdlMessageMapping wsdlMessageMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, WsdlMessageMapping wsdlMessageMapping, RuntimeContext context) + throws Exception + { _write(writer, wsdlMessageMapping, context); } - public final static WsdlMessageMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final WsdlMessageMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -66,65 +71,65 @@ public final static WsdlMessageMapping _read(final XoXMLStreamReader reader, Run context = new RuntimeContext(); } - final WsdlMessageMapping wsdlMessageMapping = new WsdlMessageMapping(); + WsdlMessageMapping wsdlMessageMapping = new WsdlMessageMapping(); context.beforeUnmarshal(wsdlMessageMapping, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("wsdl-message-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("wsdl-message-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, WsdlMessageMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, wsdlMessageMapping); wsdlMessageMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("wsdl-message" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("wsdl-message" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlMessage - final QName wsdlMessage = elementReader.getElementAsQName(); + QName wsdlMessage = elementReader.getElementAsQName(); wsdlMessageMapping.wsdlMessage = wsdlMessage; - } else if (("wsdl-message-part-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-message-part-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlMessagePartName - final String wsdlMessagePartNameRaw = elementReader.getElementAsString(); + String wsdlMessagePartNameRaw = elementReader.getElementText(); - final String wsdlMessagePartName; + String wsdlMessagePartName; try { wsdlMessagePartName = Adapters.collapsedStringAdapterAdapter.unmarshal(wsdlMessagePartNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } wsdlMessageMapping.wsdlMessagePartName = wsdlMessagePartName; - } else if (("parameter-mode" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("parameter-mode" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: parameterMode - final String parameterModeRaw = elementReader.getElementAsString(); + String parameterModeRaw = elementReader.getElementText(); - final String parameterMode; + String parameterMode; try { parameterMode = Adapters.collapsedStringAdapterAdapter.unmarshal(parameterModeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } wsdlMessageMapping.parameterMode = parameterMode; - } else if (("soap-header" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("soap-header" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: soapHeader - final Element soapHeader = elementReader.getElementAsDomElement(); + Element soapHeader = elementReader.getElementAsDomElement(); wsdlMessageMapping.soapHeader = soapHeader; } else { context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "wsdl-message"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-message-part-name"), new QName("http://java.sun.com/xml/ns/javaee", "parameter-mode"), new QName("http://java.sun.com/xml/ns/javaee", "soap-header")); @@ -136,46 +141,48 @@ public final static WsdlMessageMapping _read(final XoXMLStreamReader reader, Run return wsdlMessageMapping; } - public final WsdlMessageMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final WsdlMessageMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final WsdlMessageMapping wsdlMessageMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, WsdlMessageMapping wsdlMessageMapping, RuntimeContext context) + throws Exception + { if (wsdlMessageMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (WsdlMessageMapping.class != wsdlMessageMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (WsdlMessageMapping.class!= wsdlMessageMapping.getClass()) { context.unexpectedSubclass(writer, wsdlMessageMapping, WsdlMessageMapping.class); - return; + return ; } context.beforeMarshal(wsdlMessageMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = wsdlMessageMapping.id; - if (idRaw != null) { + String idRaw = wsdlMessageMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(wsdlMessageMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: wsdlMessage - final QName wsdlMessage = wsdlMessageMapping.wsdlMessage; - if (wsdlMessage != null) { + QName wsdlMessage = wsdlMessageMapping.wsdlMessage; + if (wsdlMessage!= null) { writer.writeStartElement(prefix, "wsdl-message", "http://java.sun.com/xml/ns/javaee"); writer.writeQName(wsdlMessage); writer.writeEndElement(); @@ -184,14 +191,14 @@ public final static void _write(final XoXMLStreamWriter writer, final WsdlMessag } // ELEMENT: wsdlMessagePartName - final String wsdlMessagePartNameRaw = wsdlMessageMapping.wsdlMessagePartName; + String wsdlMessagePartNameRaw = wsdlMessageMapping.wsdlMessagePartName; String wsdlMessagePartName = null; try { wsdlMessagePartName = Adapters.collapsedStringAdapterAdapter.marshal(wsdlMessagePartNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(wsdlMessageMapping, "wsdlMessagePartName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (wsdlMessagePartName != null) { + if (wsdlMessagePartName!= null) { writer.writeStartElement(prefix, "wsdl-message-part-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(wsdlMessagePartName); writer.writeEndElement(); @@ -200,14 +207,14 @@ public final static void _write(final XoXMLStreamWriter writer, final WsdlMessag } // ELEMENT: parameterMode - final String parameterModeRaw = wsdlMessageMapping.parameterMode; + String parameterModeRaw = wsdlMessageMapping.parameterMode; String parameterMode = null; try { parameterMode = Adapters.collapsedStringAdapterAdapter.marshal(parameterModeRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(wsdlMessageMapping, "parameterMode", CollapsedStringAdapter.class, String.class, String.class, e); } - if (parameterMode != null) { + if (parameterMode!= null) { writer.writeStartElement(prefix, "parameter-mode", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(parameterMode); writer.writeEndElement(); @@ -216,8 +223,8 @@ public final static void _write(final XoXMLStreamWriter writer, final WsdlMessag } // ELEMENT: soapHeader - final Object soapHeader = wsdlMessageMapping.soapHeader; - if (soapHeader != null) { + Object soapHeader = wsdlMessageMapping.soapHeader; + if (soapHeader!= null) { writer.writeStartElement(prefix, "soap-header", "http://java.sun.com/xml/ns/javaee"); writer.writeDomElement(((Element) soapHeader), false); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WsdlReturnValueMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WsdlReturnValueMapping$JAXB.java index 2a452a0437e..b20c4897f51 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WsdlReturnValueMapping$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WsdlReturnValueMapping$JAXB.java @@ -1,21 +1,25 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.openejb.jee; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.LifecycleCallback; import org.metatype.sxc.jaxb.RuntimeContext; @@ -23,38 +27,39 @@ import org.metatype.sxc.util.XoXMLStreamReader; import org.metatype.sxc.util.XoXMLStreamWriter; -import javax.xml.XMLConstants; -import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.namespace.QName; - @SuppressWarnings({ "StringEquality" }) public class WsdlReturnValueMapping$JAXB - extends JAXBObject { + extends JAXBObject +{ public WsdlReturnValueMapping$JAXB() { super(WsdlReturnValueMapping.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "wsdl-return-value-mappingType".intern())); } - public static WsdlReturnValueMapping readWsdlReturnValueMapping(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public static WsdlReturnValueMapping readWsdlReturnValueMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public static void writeWsdlReturnValueMapping(final XoXMLStreamWriter writer, final WsdlReturnValueMapping wsdlReturnValueMapping, final RuntimeContext context) - throws Exception { + public static void writeWsdlReturnValueMapping(XoXMLStreamWriter writer, WsdlReturnValueMapping wsdlReturnValueMapping, RuntimeContext context) + throws Exception + { _write(writer, wsdlReturnValueMapping, context); } - public void write(final XoXMLStreamWriter writer, final WsdlReturnValueMapping wsdlReturnValueMapping, final RuntimeContext context) - throws Exception { + public void write(XoXMLStreamWriter writer, WsdlReturnValueMapping wsdlReturnValueMapping, RuntimeContext context) + throws Exception + { _write(writer, wsdlReturnValueMapping, context); } - public final static WsdlReturnValueMapping _read(final XoXMLStreamReader reader, RuntimeContext context) - throws Exception { + public static final WsdlReturnValueMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { // Check for xsi:nil if (reader.isXsiNil()) { @@ -65,57 +70,57 @@ public final static WsdlReturnValueMapping _read(final XoXMLStreamReader reader, context = new RuntimeContext(); } - final WsdlReturnValueMapping wsdlReturnValueMapping = new WsdlReturnValueMapping(); + WsdlReturnValueMapping wsdlReturnValueMapping = new WsdlReturnValueMapping(); context.beforeUnmarshal(wsdlReturnValueMapping, LifecycleCallback.NONE); // Check xsi:type - final QName xsiType = reader.getXsiType(); - if (xsiType != null) { - if (("wsdl-return-value-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("wsdl-return-value-mappingType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, WsdlReturnValueMapping.class); } } // Read attributes - for (final Attribute attribute : reader.getAttributes()) { - if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) { + for (Attribute attribute: reader.getAttributes()) { + if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { // ATTRIBUTE: id - final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); context.addXmlId(reader, id, wsdlReturnValueMapping); wsdlReturnValueMapping.id = id; - } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) { + } 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 (("method-return-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("method-return-value" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: methodReturnValue - final String methodReturnValueRaw = elementReader.getElementAsString(); + String methodReturnValueRaw = elementReader.getElementText(); - final String methodReturnValue; + String methodReturnValue; try { methodReturnValue = Adapters.collapsedStringAdapterAdapter.unmarshal(methodReturnValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } wsdlReturnValueMapping.methodReturnValue = methodReturnValue; - } else if (("wsdl-message" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-message" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlMessage - final QName wsdlMessage = elementReader.getElementAsQName(); + QName wsdlMessage = elementReader.getElementAsQName(); wsdlReturnValueMapping.wsdlMessage = wsdlMessage; - } else if (("wsdl-message-part-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + } else if (("wsdl-message-part-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: wsdlMessagePartName - final String wsdlMessagePartNameRaw = elementReader.getElementAsString(); + String wsdlMessagePartNameRaw = elementReader.getElementText(); - final String wsdlMessagePartName; + String wsdlMessagePartName; try { wsdlMessagePartName = Adapters.collapsedStringAdapterAdapter.unmarshal(wsdlMessagePartNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } @@ -131,52 +136,54 @@ public final static WsdlReturnValueMapping _read(final XoXMLStreamReader reader, return wsdlReturnValueMapping; } - public final WsdlReturnValueMapping read(final XoXMLStreamReader reader, final RuntimeContext context) - throws Exception { + public final WsdlReturnValueMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { return _read(reader, context); } - public final static void _write(final XoXMLStreamWriter writer, final WsdlReturnValueMapping wsdlReturnValueMapping, RuntimeContext context) - throws Exception { + public static final void _write(XoXMLStreamWriter writer, WsdlReturnValueMapping wsdlReturnValueMapping, RuntimeContext context) + throws Exception + { if (wsdlReturnValueMapping == null) { writer.writeXsiNil(); - return; + return ; } if (context == null) { context = new RuntimeContext(); } - final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (WsdlReturnValueMapping.class != wsdlReturnValueMapping.getClass()) { + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (WsdlReturnValueMapping.class!= wsdlReturnValueMapping.getClass()) { context.unexpectedSubclass(writer, wsdlReturnValueMapping, WsdlReturnValueMapping.class); - return; + return ; } context.beforeMarshal(wsdlReturnValueMapping, LifecycleCallback.NONE); // ATTRIBUTE: id - final String idRaw = wsdlReturnValueMapping.id; - if (idRaw != null) { + String idRaw = wsdlReturnValueMapping.id; + if (idRaw!= null) { String id = null; try { id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(wsdlReturnValueMapping, "id", CollapsedStringAdapter.class, String.class, String.class, e); } writer.writeAttribute("", "", "id", id); } // ELEMENT: methodReturnValue - final String methodReturnValueRaw = wsdlReturnValueMapping.methodReturnValue; + String methodReturnValueRaw = wsdlReturnValueMapping.methodReturnValue; String methodReturnValue = null; try { methodReturnValue = Adapters.collapsedStringAdapterAdapter.marshal(methodReturnValueRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(wsdlReturnValueMapping, "methodReturnValue", CollapsedStringAdapter.class, String.class, String.class, e); } - if (methodReturnValue != null) { + if (methodReturnValue!= null) { writer.writeStartElement(prefix, "method-return-value", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(methodReturnValue); writer.writeEndElement(); @@ -185,8 +192,8 @@ public final static void _write(final XoXMLStreamWriter writer, final WsdlReturn } // ELEMENT: wsdlMessage - final QName wsdlMessage = wsdlReturnValueMapping.wsdlMessage; - if (wsdlMessage != null) { + QName wsdlMessage = wsdlReturnValueMapping.wsdlMessage; + if (wsdlMessage!= null) { writer.writeStartElement(prefix, "wsdl-message", "http://java.sun.com/xml/ns/javaee"); writer.writeQName(wsdlMessage); writer.writeEndElement(); @@ -195,14 +202,14 @@ public final static void _write(final XoXMLStreamWriter writer, final WsdlReturn } // ELEMENT: wsdlMessagePartName - final String wsdlMessagePartNameRaw = wsdlReturnValueMapping.wsdlMessagePartName; + String wsdlMessagePartNameRaw = wsdlReturnValueMapping.wsdlMessagePartName; String wsdlMessagePartName = null; try { wsdlMessagePartName = Adapters.collapsedStringAdapterAdapter.marshal(wsdlMessagePartNameRaw); - } catch (final Exception e) { + } catch (Exception e) { context.xmlAdapterError(wsdlReturnValueMapping, "wsdlMessagePartName", CollapsedStringAdapter.class, String.class, String.class, e); } - if (wsdlMessagePartName != null) { + if (wsdlMessagePartName!= null) { writer.writeStartElement(prefix, "wsdl-message-part-name", "http://java.sun.com/xml/ns/javaee"); writer.writeCharacters(wsdlMessagePartName); writer.writeEndElement(); diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/XmlString$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/XmlString$JAXB.java new file mode 100644 index 00000000000..f3220c8c0e7 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/XmlString$JAXB.java @@ -0,0 +1,192 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.DisplayName$JAXB.readDisplayName; +import static org.apache.openejb.jee.DisplayName$JAXB.writeDisplayName; +import static org.apache.openejb.jee.JavaIdentifier$JAXB.readJavaIdentifier; +import static org.apache.openejb.jee.JavaIdentifier$JAXB.writeJavaIdentifier; + +@SuppressWarnings({ + "StringEquality" +}) +public class XmlString$JAXB + extends JAXBObject +{ + + + public XmlString$JAXB() { + super(XmlString.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "xml-string".intern()), DisplayName$JAXB.class, JavaIdentifier$JAXB.class); + } + + public static XmlString readXmlString(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeXmlString(XoXMLStreamWriter writer, XmlString xmlString, RuntimeContext context) + throws Exception + { + _write(writer, xmlString, context); + } + + public void write(XoXMLStreamWriter writer, XmlString xmlString, RuntimeContext context) + throws Exception + { + _write(writer, xmlString, context); + } + + public static final XmlString _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + XmlString xmlString = new XmlString(); + context.beforeUnmarshal(xmlString, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("display-nameType" == xsiType.getLocalPart())&&("http://java.sun.com/xml/ns/javaee" == xsiType.getNamespaceURI())) { + return readDisplayName(reader, context); + } else if (("java-identifierType" == xsiType.getLocalPart())&&("http://java.sun.com/xml/ns/javaee" == xsiType.getNamespaceURI())) { + return readJavaIdentifier(reader, context); + } else if (("xml-string"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, XmlString.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, xmlString); + xmlString.id = id; + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "id")); + } + } + + // VALUE: value + String valueRaw = reader.getElementText(); + + String value = null; + boolean valueConverted; + try { + value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); + valueConverted = true; + } catch (Exception e) { + context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); + valueConverted = false; + } + + if (valueConverted) { + xmlString.value = value; + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + } + + context.afterUnmarshal(xmlString, LifecycleCallback.NONE); + + return xmlString; + } + + public final XmlString read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, XmlString xmlString, RuntimeContext context) + throws Exception + { + if (xmlString == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (JavaIdentifier.class == xmlString.getClass()) { + writer.writeXsiType("http://java.sun.com/xml/ns/javaee", "java-identifierType"); + writeJavaIdentifier(writer, ((JavaIdentifier) xmlString), context); + return ; + } else if (DisplayName.class == xmlString.getClass()) { + writer.writeXsiType("http://java.sun.com/xml/ns/javaee", "display-nameType"); + writeDisplayName(writer, ((DisplayName) xmlString), context); + return ; + } else if (XmlString.class!= xmlString.getClass()) { + context.unexpectedSubclass(writer, xmlString, XmlString.class, JavaIdentifier.class, DisplayName.class); + return ; + } + + context.beforeMarshal(xmlString, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = xmlString.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(xmlString, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // VALUE: value + String valueRaw = xmlString.value; + String value = null; + try { + value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); + } catch (Exception e) { + context.xmlAdapterError(xmlString, "value", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeCharacters(value); + + context.afterMarshal(xmlString, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/XsdString$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/XsdString$JAXB.java new file mode 100644 index 00000000000..1a27dcc7147 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/XsdString$JAXB.java @@ -0,0 +1,184 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.Description$JAXB.readDescription; +import static org.apache.openejb.jee.Description$JAXB.writeDescription; + +@SuppressWarnings({ + "StringEquality" +}) +public class XsdString$JAXB + extends JAXBObject +{ + + + public XsdString$JAXB() { + super(XsdString.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "xsdStringType".intern()), Description$JAXB.class); + } + + public static XsdString readXsdString(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeXsdString(XoXMLStreamWriter writer, XsdString xsdString, RuntimeContext context) + throws Exception + { + _write(writer, xsdString, context); + } + + public void write(XoXMLStreamWriter writer, XsdString xsdString, RuntimeContext context) + throws Exception + { + _write(writer, xsdString, context); + } + + public static final XsdString _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + XsdString xsdString = new XsdString(); + context.beforeUnmarshal(xsdString, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("descriptionType" == xsiType.getLocalPart())&&("http://java.sun.com/xml/ns/javaee" == xsiType.getNamespaceURI())) { + return readDescription(reader, context); + } else if (("xsdStringType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, XsdString.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, xsdString); + xsdString.id = id; + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "id")); + } + } + + // VALUE: value + String valueRaw = reader.getElementText(); + + String value = null; + boolean valueConverted; + try { + value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw); + valueConverted = true; + } catch (Exception e) { + context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e); + valueConverted = false; + } + + if (valueConverted) { + xsdString.value = value; + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + } + + context.afterUnmarshal(xsdString, LifecycleCallback.NONE); + + return xsdString; + } + + public final XsdString read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, XsdString xsdString, RuntimeContext context) + throws Exception + { + if (xsdString == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (Description.class == xsdString.getClass()) { + writer.writeXsiType("http://java.sun.com/xml/ns/javaee", "descriptionType"); + writeDescription(writer, ((Description) xsdString), context); + return ; + } else if (XsdString.class!= xsdString.getClass()) { + context.unexpectedSubclass(writer, xsdString, XsdString.class, Description.class); + return ; + } + + context.beforeMarshal(xsdString, LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = xsdString.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(xsdString, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // VALUE: value + String valueRaw = xsdString.value; + String value = null; + try { + value = Adapters.collapsedStringAdapterAdapter.marshal(valueRaw); + } catch (Exception e) { + context.xmlAdapterError(xsdString, "value", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeCharacters(value); + + context.afterMarshal(xsdString, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/jba/JndiName$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/jba/JndiName$JAXB.java new file mode 100644 index 00000000000..d35f899a6e5 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/jba/JndiName$JAXB.java @@ -0,0 +1,130 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.jba; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class JndiName$JAXB + extends JAXBObject +{ + + + public JndiName$JAXB() { + super(JndiName.class, new QName("".intern(), "jndi-name".intern()), null); + } + + public static JndiName readJndiName(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeJndiName(XoXMLStreamWriter writer, JndiName jndiName, RuntimeContext context) + throws Exception + { + _write(writer, jndiName, context); + } + + public void write(XoXMLStreamWriter writer, JndiName jndiName, RuntimeContext context) + throws Exception + { + _write(writer, jndiName, context); + } + + public static final JndiName _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + JndiName jndiName = new JndiName(); + context.beforeUnmarshal(jndiName, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + return context.unexpectedXsiType(reader, JndiName.class); + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // VALUE: value + jndiName.value = reader.getElementText(); + + context.afterUnmarshal(jndiName, LifecycleCallback.NONE); + + return jndiName; + } + + public final JndiName read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, JndiName jndiName, RuntimeContext context) + throws Exception + { + if (jndiName == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (JndiName.class!= jndiName.getClass()) { + context.unexpectedSubclass(writer, jndiName, JndiName.class); + return ; + } + + context.beforeMarshal(jndiName, LifecycleCallback.NONE); + + + // VALUE: value + String value = jndiName.value; + writer.writeCharacters(value); + + context.afterMarshal(jndiName, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Adapters.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Adapters.java new file mode 100644 index 00000000000..b665c83f8db --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Adapters.java @@ -0,0 +1,27 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; + +public class Adapters { + + public static final PropertiesAdapter propertiesAdapterAdapter = new PropertiesAdapter(); + public static final CollapsedStringAdapter collapsedStringAdapterAdapter = new CollapsedStringAdapter(); + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/EjbDeployment$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/EjbDeployment$JAXB.java new file mode 100644 index 00000000000..6371bfa5b9e --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/EjbDeployment$JAXB.java @@ -0,0 +1,371 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.oejb3.EjbLink$JAXB.readEjbLink; +import static org.apache.openejb.jee.oejb3.EjbLink$JAXB.writeEjbLink; +import static org.apache.openejb.jee.oejb3.Jndi$JAXB.readJndi; +import static org.apache.openejb.jee.oejb3.Jndi$JAXB.writeJndi; +import static org.apache.openejb.jee.oejb3.Query$JAXB.readQuery; +import static org.apache.openejb.jee.oejb3.Query$JAXB.writeQuery; +import static org.apache.openejb.jee.oejb3.ResourceLink$JAXB.readResourceLink; +import static org.apache.openejb.jee.oejb3.ResourceLink$JAXB.writeResourceLink; +import static org.apache.openejb.jee.oejb3.RoleMapping$JAXB.readRoleMapping; +import static org.apache.openejb.jee.oejb3.RoleMapping$JAXB.writeRoleMapping; + +@SuppressWarnings({ + "StringEquality" +}) +public class EjbDeployment$JAXB + extends JAXBObject +{ + + + public EjbDeployment$JAXB() { + super(EjbDeployment.class, new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "ejb-deployment".intern()), new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "ejbDeployment".intern()), Jndi$JAXB.class, EjbLink$JAXB.class, ResourceLink$JAXB.class, Query$JAXB.class, RoleMapping$JAXB.class); + } + + public static EjbDeployment readEjbDeployment(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeEjbDeployment(XoXMLStreamWriter writer, EjbDeployment ejbDeployment, RuntimeContext context) + throws Exception + { + _write(writer, ejbDeployment, context); + } + + public void write(XoXMLStreamWriter writer, EjbDeployment ejbDeployment, RuntimeContext context) + throws Exception + { + _write(writer, ejbDeployment, context); + } + + public static final EjbDeployment _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + EjbDeployment ejbDeployment = new EjbDeployment(); + context.beforeUnmarshal(ejbDeployment, LifecycleCallback.NONE); + + List jndi = null; + List ejbLink = null; + List resourceLink = null; + List query = null; + List roleMapping = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("ejbDeployment"!= xsiType.getLocalPart())||("http://www.openejb.org/openejb-jar/1.1"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, EjbDeployment.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (("container-id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: containerId + ejbDeployment.containerId = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + } else if (("deployment-id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: deploymentId + String deploymentId = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + context.addXmlId(reader, deploymentId, ejbDeployment); + ejbDeployment.deploymentId = deploymentId; + } else if (("ejb-name" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: ejbName + ejbDeployment.ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "container-id"), new QName("", "deployment-id"), new QName("", "ejb-name")); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("jndi" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: jndi + Jndi jndiItem = readJndi(elementReader, context); + if (jndi == null) { + jndi = ejbDeployment.jndi; + if (jndi!= null) { + jndi.clear(); + } else { + jndi = new ArrayList<>(); + } + } + jndi.add(jndiItem); + } else if (("ejb-link" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbLink + EjbLink ejbLinkItem = readEjbLink(elementReader, context); + if (ejbLink == null) { + ejbLink = ejbDeployment.ejbLink; + if (ejbLink!= null) { + ejbLink.clear(); + } else { + ejbLink = new ArrayList<>(); + } + } + ejbLink.add(ejbLinkItem); + } else if (("resource-link" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceLink + ResourceLink resourceLinkItem = readResourceLink(elementReader, context); + if (resourceLink == null) { + resourceLink = ejbDeployment.resourceLink; + if (resourceLink!= null) { + resourceLink.clear(); + } else { + resourceLink = new ArrayList<>(); + } + } + resourceLink.add(resourceLinkItem); + } else if (("query" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: query + Query queryItem = readQuery(elementReader, context); + if (query == null) { + query = ejbDeployment.query; + if (query!= null) { + query.clear(); + } else { + query = new ArrayList<>(); + } + } + query.add(queryItem); + } else if (("role-mapping" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: roleMapping + RoleMapping roleMappingItem = readRoleMapping(elementReader, context); + if (roleMapping == null) { + roleMapping = ejbDeployment.roleMapping; + if (roleMapping!= null) { + roleMapping.clear(); + } else { + roleMapping = new ArrayList<>(); + } + } + roleMapping.add(roleMappingItem); + } else if (("properties" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: properties + String propertiesRaw = elementReader.getElementText(); + + Properties properties; + try { + properties = Adapters.propertiesAdapterAdapter.unmarshal(propertiesRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, PropertiesAdapter.class, Properties.class, Properties.class, e); + continue; + } + + ejbDeployment.properties = properties; + } else { + context.unexpectedElement(elementReader, new QName("http://www.openejb.org/openejb-jar/1.1", "jndi"), new QName("http://www.openejb.org/openejb-jar/1.1", "ejb-link"), new QName("http://www.openejb.org/openejb-jar/1.1", "resource-link"), new QName("http://www.openejb.org/openejb-jar/1.1", "query"), new QName("http://www.openejb.org/openejb-jar/1.1", "role-mapping"), new QName("http://www.openejb.org/openejb-jar/1.1", "properties")); + } + } + if (jndi!= null) { + ejbDeployment.jndi = jndi; + } + if (ejbLink!= null) { + ejbDeployment.ejbLink = ejbLink; + } + if (resourceLink!= null) { + ejbDeployment.resourceLink = resourceLink; + } + if (query!= null) { + ejbDeployment.query = query; + } + if (roleMapping!= null) { + ejbDeployment.roleMapping = roleMapping; + } + + context.afterUnmarshal(ejbDeployment, LifecycleCallback.NONE); + + return ejbDeployment; + } + + public final EjbDeployment read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, EjbDeployment ejbDeployment, RuntimeContext context) + throws Exception + { + if (ejbDeployment == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://www.openejb.org/openejb-jar/1.1"); + if (EjbDeployment.class!= ejbDeployment.getClass()) { + context.unexpectedSubclass(writer, ejbDeployment, EjbDeployment.class); + return ; + } + + context.beforeMarshal(ejbDeployment, LifecycleCallback.NONE); + + + // ATTRIBUTE: containerId + String containerIdRaw = ejbDeployment.containerId; + if (containerIdRaw!= null) { + String containerId = null; + try { + containerId = Adapters.collapsedStringAdapterAdapter.marshal(containerIdRaw); + } catch (Exception e) { + context.xmlAdapterError(ejbDeployment, "containerId", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "container-id", containerId); + } + + // ATTRIBUTE: deploymentId + String deploymentIdRaw = ejbDeployment.deploymentId; + if (deploymentIdRaw!= null) { + String deploymentId = null; + try { + deploymentId = Adapters.collapsedStringAdapterAdapter.marshal(deploymentIdRaw); + } catch (Exception e) { + context.xmlAdapterError(ejbDeployment, "deploymentId", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "deployment-id", deploymentId); + } + + // ATTRIBUTE: ejbName + String ejbNameRaw = ejbDeployment.ejbName; + if (ejbNameRaw!= null) { + String ejbName = null; + try { + ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw); + } catch (Exception e) { + context.xmlAdapterError(ejbDeployment, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "ejb-name", ejbName); + } + + // ELEMENT: jndi + List jndi = ejbDeployment.jndi; + if (jndi!= null) { + for (Jndi jndiItem: jndi) { + if (jndiItem!= null) { + writer.writeStartElement(prefix, "jndi", "http://www.openejb.org/openejb-jar/1.1"); + writeJndi(writer, jndiItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(ejbDeployment, "jndi"); + } + } + } + + // ELEMENT: ejbLink + List ejbLink = ejbDeployment.ejbLink; + if (ejbLink!= null) { + for (EjbLink ejbLinkItem: ejbLink) { + if (ejbLinkItem!= null) { + writer.writeStartElement(prefix, "ejb-link", "http://www.openejb.org/openejb-jar/1.1"); + writeEjbLink(writer, ejbLinkItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(ejbDeployment, "ejbLink"); + } + } + } + + // ELEMENT: resourceLink + List resourceLink = ejbDeployment.resourceLink; + if (resourceLink!= null) { + for (ResourceLink resourceLinkItem: resourceLink) { + if (resourceLinkItem!= null) { + writer.writeStartElement(prefix, "resource-link", "http://www.openejb.org/openejb-jar/1.1"); + writeResourceLink(writer, resourceLinkItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(ejbDeployment, "resourceLink"); + } + } + } + + // ELEMENT: query + List query = ejbDeployment.query; + if (query!= null) { + for (Query queryItem: query) { + if (queryItem!= null) { + writer.writeStartElement(prefix, "query", "http://www.openejb.org/openejb-jar/1.1"); + writeQuery(writer, queryItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(ejbDeployment, "query"); + } + } + } + + // ELEMENT: roleMapping + List roleMapping = ejbDeployment.roleMapping; + if (roleMapping!= null) { + for (RoleMapping roleMappingItem: roleMapping) { + if (roleMappingItem!= null) { + writer.writeStartElement(prefix, "role-mapping", "http://www.openejb.org/openejb-jar/1.1"); + writeRoleMapping(writer, roleMappingItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: properties + Properties propertiesRaw = ejbDeployment.properties; + String properties = null; + try { + properties = Adapters.propertiesAdapterAdapter.marshal(propertiesRaw); + } catch (Exception e) { + context.xmlAdapterError(ejbDeployment, "properties", PropertiesAdapter.class, Properties.class, Properties.class, e); + } + if (properties!= null) { + writer.writeStartElement(prefix, "properties", "http://www.openejb.org/openejb-jar/1.1"); + writer.writeCharacters(properties); + writer.writeEndElement(); + } + + context.afterMarshal(ejbDeployment, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/EjbLink$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/EjbLink$JAXB.java new file mode 100644 index 00000000000..4be13e7ce6a --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/EjbLink$JAXB.java @@ -0,0 +1,159 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class EjbLink$JAXB + extends JAXBObject +{ + + + public EjbLink$JAXB() { + super(EjbLink.class, new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "ejb-link".intern()), null); + } + + public static EjbLink readEjbLink(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeEjbLink(XoXMLStreamWriter writer, EjbLink ejbLink, RuntimeContext context) + throws Exception + { + _write(writer, ejbLink, context); + } + + public void write(XoXMLStreamWriter writer, EjbLink ejbLink, RuntimeContext context) + throws Exception + { + _write(writer, ejbLink, context); + } + + public static final EjbLink _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + EjbLink ejbLink = new EjbLink(); + context.beforeUnmarshal(ejbLink, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + return context.unexpectedXsiType(reader, EjbLink.class); + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (("deployment-id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: deployentId + ejbLink.deployentId = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + } else if (("ejb-ref-name" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: ejbRefName + ejbLink.ejbRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "deployment-id"), new QName("", "ejb-ref-name")); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + context.unexpectedElement(elementReader); + } + + context.afterUnmarshal(ejbLink, LifecycleCallback.NONE); + + return ejbLink; + } + + public final EjbLink read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, EjbLink ejbLink, RuntimeContext context) + throws Exception + { + if (ejbLink == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (EjbLink.class!= ejbLink.getClass()) { + context.unexpectedSubclass(writer, ejbLink, EjbLink.class); + return ; + } + + context.beforeMarshal(ejbLink, LifecycleCallback.NONE); + + + // ATTRIBUTE: deployentId + String deployentIdRaw = ejbLink.deployentId; + if (deployentIdRaw!= null) { + String deployentId = null; + try { + deployentId = Adapters.collapsedStringAdapterAdapter.marshal(deployentIdRaw); + } catch (Exception e) { + context.xmlAdapterError(ejbLink, "deployentId", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "deployment-id", deployentId); + } + + // ATTRIBUTE: ejbRefName + String ejbRefNameRaw = ejbLink.ejbRefName; + if (ejbRefNameRaw!= null) { + String ejbRefName = null; + try { + ejbRefName = Adapters.collapsedStringAdapterAdapter.marshal(ejbRefNameRaw); + } catch (Exception e) { + context.xmlAdapterError(ejbLink, "ejbRefName", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "ejb-ref-name", ejbRefName); + } + + context.afterMarshal(ejbLink, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Jndi$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Jndi$JAXB.java new file mode 100644 index 00000000000..5bc06f3faa5 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Jndi$JAXB.java @@ -0,0 +1,159 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class Jndi$JAXB + extends JAXBObject +{ + + + public Jndi$JAXB() { + super(Jndi.class, new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "jndi".intern()), null); + } + + public static Jndi readJndi(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeJndi(XoXMLStreamWriter writer, Jndi jndi, RuntimeContext context) + throws Exception + { + _write(writer, jndi, context); + } + + public void write(XoXMLStreamWriter writer, Jndi jndi, RuntimeContext context) + throws Exception + { + _write(writer, jndi, context); + } + + public static final Jndi _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + Jndi jndi = new Jndi(); + context.beforeUnmarshal(jndi, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + return context.unexpectedXsiType(reader, Jndi.class); + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (("name" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: name + jndi.name = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + } else if (("interface" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: intrface + jndi.intrface = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "name"), new QName("", "interface")); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + context.unexpectedElement(elementReader); + } + + context.afterUnmarshal(jndi, LifecycleCallback.NONE); + + return jndi; + } + + public final Jndi read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, Jndi jndi, RuntimeContext context) + throws Exception + { + if (jndi == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (Jndi.class!= jndi.getClass()) { + context.unexpectedSubclass(writer, jndi, Jndi.class); + return ; + } + + context.beforeMarshal(jndi, LifecycleCallback.NONE); + + + // ATTRIBUTE: name + String nameRaw = jndi.name; + if (nameRaw!= null) { + String name = null; + try { + name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw); + } catch (Exception e) { + context.xmlAdapterError(jndi, "name", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "name", name); + } + + // ATTRIBUTE: intrface + String intrfaceRaw = jndi.intrface; + if (intrfaceRaw!= null) { + String intrface = null; + try { + intrface = Adapters.collapsedStringAdapterAdapter.marshal(intrfaceRaw); + } catch (Exception e) { + context.xmlAdapterError(jndi, "intrface", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "interface", intrface); + } + + context.afterMarshal(jndi, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/MethodParams$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/MethodParams$JAXB.java new file mode 100644 index 00000000000..c4b5c97e5de --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/MethodParams$JAXB.java @@ -0,0 +1,197 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class MethodParams$JAXB + extends JAXBObject +{ + + + public MethodParams$JAXB() { + super(MethodParams.class, new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "method-params".intern()), new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "methodParams".intern())); + } + + public static MethodParams readMethodParams(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeMethodParams(XoXMLStreamWriter writer, MethodParams methodParams, RuntimeContext context) + throws Exception + { + _write(writer, methodParams, context); + } + + public void write(XoXMLStreamWriter writer, MethodParams methodParams, RuntimeContext context) + throws Exception + { + _write(writer, methodParams, context); + } + + 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 methodParam = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("methodParams"!= xsiType.getLocalPart())||("http://www.openejb.org/openejb-jar/1.1"!= 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://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: methodParam + String methodParamItemRaw = elementReader.getElementText(); + + 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<>(); + } + } + methodParam.add(methodParamItem); + } else { + context.unexpectedElement(elementReader, new QName("http://www.openejb.org/openejb-jar/1.1", "method-param")); + } + } + if (methodParam!= null) { + methodParams.methodParam = methodParam; + } + + context.afterUnmarshal(methodParams, LifecycleCallback.NONE); + + return methodParams; + } + + public final MethodParams read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + 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 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://www.openejb.org/openejb-jar/1.1", "method-param"); + writer.writeCharacters(methodParam); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(methodParams, "methodParam"); + } + } + } + + context.afterMarshal(methodParams, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/ObjectFactory$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/ObjectFactory$JAXB.java new file mode 100644 index 00000000000..0b13a20e5f8 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/ObjectFactory$JAXB.java @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import java.util.HashMap; +import java.util.Map; +import javax.xml.namespace.QName; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.JAXBObjectFactory; + +public class ObjectFactory$JAXB + extends JAXBObjectFactory +{ + + public static final ObjectFactory$JAXB INSTANCE = new ObjectFactory$JAXB(); + private final Map> rootElements = new HashMap<>(); + + public ObjectFactory$JAXB() { + super(ObjectFactory.class, EjbDeployment$JAXB.class, OpenejbJar$JAXB.class, EjbLink$JAXB.class, ResourceLink$JAXB.class, MethodParams$JAXB.class, QueryMethod$JAXB.class, Query$JAXB.class); + rootElements.put(new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "method-param".intern()), org.metatype.sxc.jaxb.StandardJAXBObjects.StringJAXB.class); + rootElements.put(new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "method-name".intern()), org.metatype.sxc.jaxb.StandardJAXBObjects.StringJAXB.class); + rootElements.put(new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "object-ql".intern()), org.metatype.sxc.jaxb.StandardJAXBObjects.StringJAXB.class); + rootElements.put(new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "description".intern()), org.metatype.sxc.jaxb.StandardJAXBObjects.StringJAXB.class); + } + + public Map> getRootElements() { + return rootElements; + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/OpenejbJar$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/OpenejbJar$JAXB.java new file mode 100644 index 00000000000..36e25217342 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/OpenejbJar$JAXB.java @@ -0,0 +1,255 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.oejb3.EjbDeployment$JAXB.readEjbDeployment; +import static org.apache.openejb.jee.oejb3.EjbDeployment$JAXB.writeEjbDeployment; +import static org.apache.openejb.jee.oejb3.PojoDeployment$JAXB.readPojoDeployment; +import static org.apache.openejb.jee.oejb3.PojoDeployment$JAXB.writePojoDeployment; + +@SuppressWarnings({ + "StringEquality" +}) +public class OpenejbJar$JAXB + extends JAXBObject +{ + + + public OpenejbJar$JAXB() { + super(OpenejbJar.class, new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "openejb-jar".intern()), new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "openejbJar".intern()), EjbDeployment$JAXB.class, PojoDeployment$JAXB.class); + } + + public static OpenejbJar readOpenejbJar(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeOpenejbJar(XoXMLStreamWriter writer, OpenejbJar openejbJar, RuntimeContext context) + throws Exception + { + _write(writer, openejbJar, context); + } + + public void write(XoXMLStreamWriter writer, OpenejbJar openejbJar, RuntimeContext context) + throws Exception + { + _write(writer, openejbJar, context); + } + + public static final OpenejbJar _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + OpenejbJar openejbJar = new OpenejbJar(); + context.beforeUnmarshal(openejbJar, LifecycleCallback.NONE); + + List ejbDeployment = null; + List pojoDeployment = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("openejbJar"!= xsiType.getLocalPart())||("http://www.openejb.org/openejb-jar/1.1"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, OpenejbJar.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("module-name" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: moduleName + String moduleNameRaw = elementReader.getElementText(); + + String moduleName; + try { + moduleName = Adapters.collapsedStringAdapterAdapter.unmarshal(moduleNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + openejbJar.moduleName = moduleName; + } else if (("properties" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: properties + String propertiesRaw = elementReader.getElementText(); + + Properties properties; + try { + properties = Adapters.propertiesAdapterAdapter.unmarshal(propertiesRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, PropertiesAdapter.class, Properties.class, Properties.class, e); + continue; + } + + openejbJar.properties = properties; + } else if (("ejb-deployment" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbDeployment + EjbDeployment ejbDeploymentItem = readEjbDeployment(elementReader, context); + if (ejbDeployment == null) { + ejbDeployment = openejbJar.ejbDeployment; + if (ejbDeployment!= null) { + ejbDeployment.clear(); + } else { + ejbDeployment = new ArrayList<>(); + } + } + ejbDeployment.add(ejbDeploymentItem); + } else if (("pojo-deployment" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: pojoDeployment + PojoDeployment pojoDeploymentItem = readPojoDeployment(elementReader, context); + if (pojoDeployment == null) { + pojoDeployment = openejbJar.pojoDeployment; + if (pojoDeployment!= null) { + pojoDeployment.clear(); + } else { + pojoDeployment = new ArrayList<>(); + } + } + pojoDeployment.add(pojoDeploymentItem); + } else { + context.unexpectedElement(elementReader, new QName("http://www.openejb.org/openejb-jar/1.1", "module-name"), new QName("http://www.openejb.org/openejb-jar/1.1", "properties"), new QName("http://www.openejb.org/openejb-jar/1.1", "ejb-deployment"), new QName("http://www.openejb.org/openejb-jar/1.1", "pojo-deployment")); + } + } + if (ejbDeployment!= null) { + openejbJar.ejbDeployment = ejbDeployment; + } + if (pojoDeployment!= null) { + openejbJar.pojoDeployment = pojoDeployment; + } + + context.afterUnmarshal(openejbJar, LifecycleCallback.NONE); + + return openejbJar; + } + + public final OpenejbJar read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, OpenejbJar openejbJar, RuntimeContext context) + throws Exception + { + if (openejbJar == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://www.openejb.org/openejb-jar/1.1"); + if (OpenejbJar.class!= openejbJar.getClass()) { + context.unexpectedSubclass(writer, openejbJar, OpenejbJar.class); + return ; + } + + context.beforeMarshal(openejbJar, LifecycleCallback.NONE); + + + // ELEMENT: moduleName + String moduleNameRaw = openejbJar.moduleName; + String moduleName = null; + try { + moduleName = Adapters.collapsedStringAdapterAdapter.marshal(moduleNameRaw); + } catch (Exception e) { + context.xmlAdapterError(openejbJar, "moduleName", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (moduleName!= null) { + writer.writeStartElement(prefix, "module-name", "http://www.openejb.org/openejb-jar/1.1"); + writer.writeCharacters(moduleName); + writer.writeEndElement(); + } + + // ELEMENT: properties + Properties propertiesRaw = openejbJar.properties; + String properties = null; + try { + properties = Adapters.propertiesAdapterAdapter.marshal(propertiesRaw); + } catch (Exception e) { + context.xmlAdapterError(openejbJar, "properties", PropertiesAdapter.class, Properties.class, Properties.class, e); + } + if (properties!= null) { + writer.writeStartElement(prefix, "properties", "http://www.openejb.org/openejb-jar/1.1"); + writer.writeCharacters(properties); + writer.writeEndElement(); + } + + // ELEMENT: ejbDeployment + List ejbDeployment = openejbJar.ejbDeployment; + if (ejbDeployment!= null) { + for (EjbDeployment ejbDeploymentItem: ejbDeployment) { + if (ejbDeploymentItem!= null) { + writer.writeStartElement(prefix, "ejb-deployment", "http://www.openejb.org/openejb-jar/1.1"); + writeEjbDeployment(writer, ejbDeploymentItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(openejbJar, "ejbDeployment"); + } + } + } + + // ELEMENT: pojoDeployment + List pojoDeployment = openejbJar.pojoDeployment; + if (pojoDeployment!= null) { + for (PojoDeployment pojoDeploymentItem: pojoDeployment) { + if (pojoDeploymentItem!= null) { + writer.writeStartElement(prefix, "pojo-deployment", "http://www.openejb.org/openejb-jar/1.1"); + writePojoDeployment(writer, pojoDeploymentItem, context); + writer.writeEndElement(); + } + } + } + + context.afterMarshal(openejbJar, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/PojoDeployment$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/PojoDeployment$JAXB.java new file mode 100644 index 00000000000..a5a94608471 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/PojoDeployment$JAXB.java @@ -0,0 +1,178 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import java.util.Properties; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class PojoDeployment$JAXB + extends JAXBObject +{ + + + public PojoDeployment$JAXB() { + super(PojoDeployment.class, new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "pojo-deployment".intern()), new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "pojoDeployment".intern())); + } + + public static PojoDeployment readPojoDeployment(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writePojoDeployment(XoXMLStreamWriter writer, PojoDeployment pojoDeployment, RuntimeContext context) + throws Exception + { + _write(writer, pojoDeployment, context); + } + + public void write(XoXMLStreamWriter writer, PojoDeployment pojoDeployment, RuntimeContext context) + throws Exception + { + _write(writer, pojoDeployment, context); + } + + public static final PojoDeployment _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + PojoDeployment pojoDeployment = new PojoDeployment(); + context.beforeUnmarshal(pojoDeployment, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("pojoDeployment"!= xsiType.getLocalPart())||("http://www.openejb.org/openejb-jar/1.1"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, PojoDeployment.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (("class-name" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: className + String className = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + context.addXmlId(reader, className, pojoDeployment); + pojoDeployment.className = className; + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "class-name")); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("properties" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: properties + String propertiesRaw = elementReader.getElementText(); + + Properties properties; + try { + properties = Adapters.propertiesAdapterAdapter.unmarshal(propertiesRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, PropertiesAdapter.class, Properties.class, Properties.class, e); + continue; + } + + pojoDeployment.properties = properties; + } else { + context.unexpectedElement(elementReader, new QName("http://www.openejb.org/openejb-jar/1.1", "properties")); + } + } + + context.afterUnmarshal(pojoDeployment, LifecycleCallback.NONE); + + return pojoDeployment; + } + + public final PojoDeployment read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, PojoDeployment pojoDeployment, RuntimeContext context) + throws Exception + { + if (pojoDeployment == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (PojoDeployment.class!= pojoDeployment.getClass()) { + context.unexpectedSubclass(writer, pojoDeployment, PojoDeployment.class); + return ; + } + + context.beforeMarshal(pojoDeployment, LifecycleCallback.NONE); + + + // ATTRIBUTE: className + String classNameRaw = pojoDeployment.className; + if (classNameRaw!= null) { + String className = null; + try { + className = Adapters.collapsedStringAdapterAdapter.marshal(classNameRaw); + } catch (Exception e) { + context.xmlAdapterError(pojoDeployment, "className", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "class-name", className); + } + + // ELEMENT: properties + Properties propertiesRaw = pojoDeployment.properties; + String properties = null; + try { + properties = Adapters.propertiesAdapterAdapter.marshal(propertiesRaw); + } catch (Exception e) { + context.xmlAdapterError(pojoDeployment, "properties", PropertiesAdapter.class, Properties.class, Properties.class, e); + } + if (properties!= null) { + writer.writeStartElementWithAutoPrefix("http://www.openejb.org/openejb-jar/1.1", "properties"); + writer.writeCharacters(properties); + writer.writeEndElement(); + } + + context.afterMarshal(pojoDeployment, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Query$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Query$JAXB.java new file mode 100644 index 00000000000..36359ddd7ec --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/Query$JAXB.java @@ -0,0 +1,206 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.oejb3.QueryMethod$JAXB.readQueryMethod; +import static org.apache.openejb.jee.oejb3.QueryMethod$JAXB.writeQueryMethod; + +@SuppressWarnings({ + "StringEquality" +}) +public class Query$JAXB + extends JAXBObject +{ + + + public Query$JAXB() { + super(Query.class, new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "query".intern()), null, QueryMethod$JAXB.class); + } + + public static Query readQuery(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeQuery(XoXMLStreamWriter writer, Query query, RuntimeContext context) + throws Exception + { + _write(writer, query, context); + } + + public void write(XoXMLStreamWriter writer, Query query, RuntimeContext context) + throws Exception + { + _write(writer, query, context); + } + + public static final Query _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + Query query = new Query(); + context.beforeUnmarshal(query, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + return context.unexpectedXsiType(reader, Query.class); + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("description" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: description + String descriptionRaw = elementReader.getElementText(); + + String description; + try { + description = Adapters.collapsedStringAdapterAdapter.unmarshal(descriptionRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + query.description = description; + } else if (("query-method" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: queryMethod + QueryMethod queryMethod = readQueryMethod(elementReader, context); + query.queryMethod = queryMethod; + } else if (("object-ql" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: objectQl + String objectQlRaw = elementReader.getElementText(); + + String objectQl; + try { + objectQl = Adapters.collapsedStringAdapterAdapter.unmarshal(objectQlRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + query.objectQl = objectQl; + } else { + context.unexpectedElement(elementReader, new QName("http://www.openejb.org/openejb-jar/1.1", "description"), new QName("http://www.openejb.org/openejb-jar/1.1", "query-method"), new QName("http://www.openejb.org/openejb-jar/1.1", "object-ql")); + } + } + + context.afterUnmarshal(query, LifecycleCallback.NONE); + + return query; + } + + public final Query read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, Query query, RuntimeContext context) + throws Exception + { + if (query == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://www.openejb.org/openejb-jar/1.1"); + if (Query.class!= query.getClass()) { + context.unexpectedSubclass(writer, query, Query.class); + return ; + } + + context.beforeMarshal(query, LifecycleCallback.NONE); + + + // ELEMENT: description + String descriptionRaw = query.description; + String description = null; + try { + description = Adapters.collapsedStringAdapterAdapter.marshal(descriptionRaw); + } catch (Exception e) { + context.xmlAdapterError(query, "description", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (description!= null) { + writer.writeStartElement(prefix, "description", "http://www.openejb.org/openejb-jar/1.1"); + writer.writeCharacters(description); + writer.writeEndElement(); + } + + // ELEMENT: queryMethod + QueryMethod queryMethod = query.queryMethod; + if (queryMethod!= null) { + writer.writeStartElement(prefix, "query-method", "http://www.openejb.org/openejb-jar/1.1"); + writeQueryMethod(writer, queryMethod, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(query, "queryMethod"); + } + + // ELEMENT: objectQl + String objectQlRaw = query.objectQl; + String objectQl = null; + try { + objectQl = Adapters.collapsedStringAdapterAdapter.marshal(objectQlRaw); + } catch (Exception e) { + context.xmlAdapterError(query, "objectQl", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (objectQl!= null) { + writer.writeStartElement(prefix, "object-ql", "http://www.openejb.org/openejb-jar/1.1"); + writer.writeCharacters(objectQl); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(query, "objectQl"); + } + + context.afterMarshal(query, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/QueryMethod$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/QueryMethod$JAXB.java new file mode 100644 index 00000000000..0abdd626a8a --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/QueryMethod$JAXB.java @@ -0,0 +1,181 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.oejb3.MethodParams$JAXB.readMethodParams; +import static org.apache.openejb.jee.oejb3.MethodParams$JAXB.writeMethodParams; + +@SuppressWarnings({ + "StringEquality" +}) +public class QueryMethod$JAXB + extends JAXBObject +{ + + + public QueryMethod$JAXB() { + super(QueryMethod.class, new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "query-method".intern()), new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "queryMethod".intern()), MethodParams$JAXB.class); + } + + public static QueryMethod readQueryMethod(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeQueryMethod(XoXMLStreamWriter writer, QueryMethod queryMethod, RuntimeContext context) + throws Exception + { + _write(writer, queryMethod, context); + } + + public void write(XoXMLStreamWriter writer, QueryMethod queryMethod, RuntimeContext context) + throws Exception + { + _write(writer, queryMethod, context); + } + + public static final QueryMethod _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + QueryMethod queryMethod = new QueryMethod(); + context.beforeUnmarshal(queryMethod, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("queryMethod"!= xsiType.getLocalPart())||("http://www.openejb.org/openejb-jar/1.1"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, QueryMethod.class); + } + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("method-name" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: methodName + String methodNameRaw = elementReader.getElementText(); + + String methodName; + try { + methodName = Adapters.collapsedStringAdapterAdapter.unmarshal(methodNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + queryMethod.methodName = methodName; + } else if (("method-params" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: methodParams + MethodParams methodParams = readMethodParams(elementReader, context); + queryMethod.methodParams = methodParams; + } else { + context.unexpectedElement(elementReader, new QName("http://www.openejb.org/openejb-jar/1.1", "method-name"), new QName("http://www.openejb.org/openejb-jar/1.1", "method-params")); + } + } + + context.afterUnmarshal(queryMethod, LifecycleCallback.NONE); + + return queryMethod; + } + + public final QueryMethod read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, QueryMethod queryMethod, RuntimeContext context) + throws Exception + { + if (queryMethod == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://www.openejb.org/openejb-jar/1.1"); + if (QueryMethod.class!= queryMethod.getClass()) { + context.unexpectedSubclass(writer, queryMethod, QueryMethod.class); + return ; + } + + context.beforeMarshal(queryMethod, LifecycleCallback.NONE); + + + // ELEMENT: methodName + String methodNameRaw = queryMethod.methodName; + String methodName = null; + try { + methodName = Adapters.collapsedStringAdapterAdapter.marshal(methodNameRaw); + } catch (Exception e) { + context.xmlAdapterError(queryMethod, "methodName", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (methodName!= null) { + writer.writeStartElement(prefix, "method-name", "http://www.openejb.org/openejb-jar/1.1"); + writer.writeCharacters(methodName); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(queryMethod, "methodName"); + } + + // ELEMENT: methodParams + MethodParams methodParams = queryMethod.methodParams; + if (methodParams!= null) { + writer.writeStartElement(prefix, "method-params", "http://www.openejb.org/openejb-jar/1.1"); + writeMethodParams(writer, methodParams, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(queryMethod, "methodParams"); + } + + context.afterMarshal(queryMethod, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/ResourceLink$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/ResourceLink$JAXB.java new file mode 100644 index 00000000000..ba29308d22a --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/ResourceLink$JAXB.java @@ -0,0 +1,159 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class ResourceLink$JAXB + extends JAXBObject +{ + + + public ResourceLink$JAXB() { + super(ResourceLink.class, new QName("http://www.openejb.org/openejb-jar/1.1".intern(), "resource-link".intern()), null); + } + + public static ResourceLink readResourceLink(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeResourceLink(XoXMLStreamWriter writer, ResourceLink resourceLink, RuntimeContext context) + throws Exception + { + _write(writer, resourceLink, context); + } + + public void write(XoXMLStreamWriter writer, ResourceLink resourceLink, RuntimeContext context) + throws Exception + { + _write(writer, resourceLink, context); + } + + public static final ResourceLink _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + ResourceLink resourceLink = new ResourceLink(); + context.beforeUnmarshal(resourceLink, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + return context.unexpectedXsiType(reader, ResourceLink.class); + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (("res-id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: resId + resourceLink.resId = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + } else if (("res-ref-name" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) { + // ATTRIBUTE: resRefName + resourceLink.resRefName = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue()); + } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute, new QName("", "res-id"), new QName("", "res-ref-name")); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + context.unexpectedElement(elementReader); + } + + context.afterUnmarshal(resourceLink, LifecycleCallback.NONE); + + return resourceLink; + } + + public final ResourceLink read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, ResourceLink resourceLink, RuntimeContext context) + throws Exception + { + if (resourceLink == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + if (ResourceLink.class!= resourceLink.getClass()) { + context.unexpectedSubclass(writer, resourceLink, ResourceLink.class); + return ; + } + + context.beforeMarshal(resourceLink, LifecycleCallback.NONE); + + + // ATTRIBUTE: resId + String resIdRaw = resourceLink.resId; + if (resIdRaw!= null) { + String resId = null; + try { + resId = Adapters.collapsedStringAdapterAdapter.marshal(resIdRaw); + } catch (Exception e) { + context.xmlAdapterError(resourceLink, "resId", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "res-id", resId); + } + + // ATTRIBUTE: resRefName + String resRefNameRaw = resourceLink.resRefName; + if (resRefNameRaw!= null) { + String resRefName = null; + try { + resRefName = Adapters.collapsedStringAdapterAdapter.marshal(resRefNameRaw); + } catch (Exception e) { + context.xmlAdapterError(resourceLink, "resRefName", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "res-ref-name", resRefName); + } + + context.afterMarshal(resourceLink, LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/RoleMapping$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/RoleMapping$JAXB.java new file mode 100644 index 00000000000..0bab258bedb --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/oejb3/RoleMapping$JAXB.java @@ -0,0 +1,190 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee.oejb3; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.LifecycleCallback; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + +@SuppressWarnings({ + "StringEquality" +}) +public class RoleMapping$JAXB + extends JAXBObject +{ + + + public RoleMapping$JAXB() { + super(RoleMapping.class, null, null); + } + + public static RoleMapping readRoleMapping(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeRoleMapping(XoXMLStreamWriter writer, RoleMapping roleMapping, RuntimeContext context) + throws Exception + { + _write(writer, roleMapping, context); + } + + public void write(XoXMLStreamWriter writer, RoleMapping roleMapping, RuntimeContext context) + throws Exception + { + _write(writer, roleMapping, context); + } + + public static final RoleMapping _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + RoleMapping roleMapping = new RoleMapping(); + context.beforeUnmarshal(roleMapping, LifecycleCallback.NONE); + + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + return context.unexpectedXsiType(reader, RoleMapping.class); + } + + // Read attributes + for (Attribute attribute: reader.getAttributes()) { + if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) { + context.unexpectedAttribute(attribute); + } + } + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("role-name" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: roleName + String roleNameRaw = elementReader.getElementText(); + + String roleName; + try { + roleName = Adapters.collapsedStringAdapterAdapter.unmarshal(roleNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + roleMapping.roleName = roleName; + } else if (("principal-name" == elementReader.getLocalName())&&("http://www.openejb.org/openejb-jar/1.1" == elementReader.getNamespaceURI())) { + // ELEMENT: principalName + String principalNameRaw = elementReader.getElementText(); + + String principalName; + try { + principalName = Adapters.collapsedStringAdapterAdapter.unmarshal(principalNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + roleMapping.principalName = principalName; + } else { + context.unexpectedElement(elementReader, new QName("http://www.openejb.org/openejb-jar/1.1", "role-name"), new QName("http://www.openejb.org/openejb-jar/1.1", "principal-name")); + } + } + + context.afterUnmarshal(roleMapping, LifecycleCallback.NONE); + + return roleMapping; + } + + public final RoleMapping read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _write(XoXMLStreamWriter writer, RoleMapping roleMapping, RuntimeContext context) + throws Exception + { + if (roleMapping == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://www.openejb.org/openejb-jar/1.1"); + if (RoleMapping.class!= roleMapping.getClass()) { + context.unexpectedSubclass(writer, roleMapping, RoleMapping.class); + return ; + } + + context.beforeMarshal(roleMapping, LifecycleCallback.NONE); + + + // ELEMENT: roleName + String roleNameRaw = roleMapping.roleName; + String roleName = null; + try { + roleName = Adapters.collapsedStringAdapterAdapter.marshal(roleNameRaw); + } catch (Exception e) { + context.xmlAdapterError(roleMapping, "roleName", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (roleName!= null) { + writer.writeStartElement(prefix, "role-name", "http://www.openejb.org/openejb-jar/1.1"); + writer.writeCharacters(roleName); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(roleMapping, "roleName"); + } + + // ELEMENT: principalName + String principalNameRaw = roleMapping.principalName; + String principalName = null; + try { + principalName = Adapters.collapsedStringAdapterAdapter.marshal(principalNameRaw); + } catch (Exception e) { + context.xmlAdapterError(roleMapping, "principalName", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (principalName!= null) { + writer.writeStartElement(prefix, "principal-name", "http://www.openejb.org/openejb-jar/1.1"); + writer.writeCharacters(principalName); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(roleMapping, "principalName"); + } + + context.afterMarshal(roleMapping, LifecycleCallback.NONE); + } + +} From 2c5dec01c238d5bac0421fd1af611da60d39bb29 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Wed, 28 Aug 2024 16:40:00 +0200 Subject: [PATCH 04/13] remove sxc from excludes --- .../tomee-microprofile-webapp/src/main/assembly/war.xml | 1 - tomee/tomee-plume-webapp/src/main/assembly/war.xml | 1 - tomee/tomee-plus-webapp/src/main/assembly/war.xml | 1 - tomee/tomee-webapp/src/main/assembly/war.xml | 1 - 4 files changed, 4 deletions(-) diff --git a/tomee/tomee-microprofile/tomee-microprofile-webapp/src/main/assembly/war.xml b/tomee/tomee-microprofile/tomee-microprofile-webapp/src/main/assembly/war.xml index 77f55b9a482..cb5ba807f10 100644 --- a/tomee/tomee-microprofile/tomee-microprofile-webapp/src/main/assembly/war.xml +++ b/tomee/tomee-microprofile/tomee-microprofile-webapp/src/main/assembly/war.xml @@ -88,7 +88,6 @@ --> org.apache.commons.dbcp2:* - org.metatype.sxc:* org.apache.taglibs:* diff --git a/tomee/tomee-plume-webapp/src/main/assembly/war.xml b/tomee/tomee-plume-webapp/src/main/assembly/war.xml index 53916598178..2a00d1fcb64 100644 --- a/tomee/tomee-plume-webapp/src/main/assembly/war.xml +++ b/tomee/tomee-plume-webapp/src/main/assembly/war.xml @@ -107,7 +107,6 @@ --> org.apache.commons.dbcp2:* - org.metatype.sxc:* org.apache.taglibs:* diff --git a/tomee/tomee-plus-webapp/src/main/assembly/war.xml b/tomee/tomee-plus-webapp/src/main/assembly/war.xml index 2c4b4585108..89f9d2e39c4 100644 --- a/tomee/tomee-plus-webapp/src/main/assembly/war.xml +++ b/tomee/tomee-plus-webapp/src/main/assembly/war.xml @@ -101,7 +101,6 @@ --> org.apache.commons.dbcp2:* - org.metatype.sxc:* org.apache.taglibs:* diff --git a/tomee/tomee-webapp/src/main/assembly/war.xml b/tomee/tomee-webapp/src/main/assembly/war.xml index 5ac6cf5b729..c5d88d56b1c 100644 --- a/tomee/tomee-webapp/src/main/assembly/war.xml +++ b/tomee/tomee-webapp/src/main/assembly/war.xml @@ -111,7 +111,6 @@ --> org.apache.commons.dbcp2:* - org.metatype.sxc:* org.apache.taglibs:* From 2b9c6087121a95790518cb7e301e93122881be20 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Thu, 29 Aug 2024 11:35:24 +0200 Subject: [PATCH 05/13] private -> protected to avoid field accessors using unsafe --- .../src/main/java/org/apache/openejb/cdi/CdiBeanInfo.java | 2 +- .../src/main/java/org/apache/openejb/jee/ApplicationClient.java | 2 +- .../src/main/java/org/apache/openejb/jee/EntityBean.java | 2 +- .../src/main/java/org/apache/openejb/jee/Interceptor.java | 2 +- .../src/main/java/org/apache/openejb/jee/MessageDrivenBean.java | 2 +- .../src/main/java/org/apache/openejb/jee/SessionBean.java | 2 +- .../src/main/java/org/apache/openejb/jee/WebApp.java | 2 +- .../src/main/java/org/apache/openejb/jee/WebFragment.java | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiBeanInfo.java b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiBeanInfo.java index d16f8f4b4b8..0f22bd02b45 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiBeanInfo.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiBeanInfo.java @@ -66,7 +66,7 @@ public class CdiBeanInfo implements JndiConsumer { private String beanName; private ClassLoader classLoader; private List injections; - private KeyedCollection contextService; + protected KeyedCollection contextService; public String getBeanName() { return beanName; diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/ApplicationClient.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/ApplicationClient.java index 66afe3022ea..941e277bd73 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/ApplicationClient.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/ApplicationClient.java @@ -151,7 +151,7 @@ public class ApplicationClient implements JndiConsumer, Lifecycle, NamedModule { @XmlTransient protected String mainClass; @XmlElement(name="context-service") - private KeyedCollection contextService; + protected KeyedCollection contextService; public ApplicationClient() { } diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/EntityBean.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/EntityBean.java index da8d1c13c96..391ca4248b6 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/EntityBean.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/EntityBean.java @@ -185,7 +185,7 @@ public class EntityBean implements RemoteBean { @XmlID protected String id; @XmlElement(name="context-service") - private KeyedCollection contextService; + protected KeyedCollection contextService; public EntityBean() { final Set publicIds = JaxbJavaee.currentPublicId.get(); diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/Interceptor.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/Interceptor.java index 7c79e69a313..80ea96f3316 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/Interceptor.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/Interceptor.java @@ -142,7 +142,7 @@ public class Interceptor implements JndiConsumer, Session { @XmlID protected String id; @XmlElement(name="context-service") - private KeyedCollection contextService; + protected KeyedCollection contextService; public Interceptor() { } diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java index 4d0ec4e9b92..586904af9da 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/MessageDrivenBean.java @@ -175,7 +175,7 @@ public class MessageDrivenBean implements EnterpriseBean, TimerConsumer, Invokab @XmlID protected String id; @XmlElement(name="context-service") - private KeyedCollection contextService; + protected KeyedCollection contextService; public MessageDrivenBean() { } diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionBean.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionBean.java index 24c5356fe5b..41dc9ddf299 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionBean.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionBean.java @@ -270,7 +270,7 @@ public class SessionBean implements RemoteBean, Session, TimerConsumer { @XmlTransient private final Collection parents = new ArrayList(); // always needed so initialize it early @XmlElement(name="context-service") - private KeyedCollection contextService; + protected KeyedCollection contextService; public SessionBean() { } diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java index 000b20f8868..0f046987517 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java @@ -195,7 +195,7 @@ public class WebApp implements WebCommon, Lifecycle, NamedModule { @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String version = "3.0"; @XmlElement(name="context-service") - private KeyedCollection contextService; + protected KeyedCollection contextService; @Override public String getJndiConsumerName() { diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebFragment.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebFragment.java index 7d19c8a7e8a..72c492f0ae0 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebFragment.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebFragment.java @@ -190,7 +190,7 @@ public class WebFragment implements WebCommon { @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String version; @XmlElement(name="context-service") - private KeyedCollection contextService; + protected KeyedCollection contextService; @Override From ee6ae82b2843c4e6da0634d0b8ed2366f258b9f9 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Thu, 29 Aug 2024 11:36:05 +0200 Subject: [PATCH 06/13] use rzo1's metatype fork --- container/openejb-jee-accessors/pom.xml | 2 +- container/openejb-jee/pom.xml | 2 +- pom.xml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/container/openejb-jee-accessors/pom.xml b/container/openejb-jee-accessors/pom.xml index 893fc09462b..00f0f55f742 100644 --- a/container/openejb-jee-accessors/pom.xml +++ b/container/openejb-jee-accessors/pom.xml @@ -67,7 +67,7 @@ - org.metatype.sxc + io.github.rzo1.org.metatype.sxc sxc-jaxb-core diff --git a/container/openejb-jee/pom.xml b/container/openejb-jee/pom.xml index 41086a80974..81d61056237 100644 --- a/container/openejb-jee/pom.xml +++ b/container/openejb-jee/pom.xml @@ -106,7 +106,7 @@ - org.metatype.sxc + io.github.rzo1.org.metatype.sxc sxc-jaxb-maven-plugin diff --git a/pom.xml b/pom.xml index 6fa4df67ec4..81d975f227e 100644 --- a/pom.xml +++ b/pom.xml @@ -234,7 +234,7 @@ 1.0-alpha-1 2.0.2 0.9.6 - 0.9-SNAPSHOT + 0.9 10.15.2.0 @@ -332,7 +332,7 @@ 1.0.2 - org.metatype.sxc + io.github.rzo1.org.metatype.sxc sxc-jaxb-maven-plugin ${version.sxc} @@ -1859,7 +1859,7 @@ ${version.groovy} - org.metatype.sxc + io.github.rzo1.org.metatype.sxc sxc-jaxb-core ${version.sxc} From 1c66565af167375215545341cb4a87082f082332 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Thu, 29 Aug 2024 11:56:46 +0200 Subject: [PATCH 07/13] add script to regenerate accessors --- container/openejb-jee/pom.xml | 8 +++ container/openejb-jee/regenerate_accessors.sh | 51 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100755 container/openejb-jee/regenerate_accessors.sh diff --git a/container/openejb-jee/pom.xml b/container/openejb-jee/pom.xml index 81d61056237..94a2625618d 100644 --- a/container/openejb-jee/pom.xml +++ b/container/openejb-jee/pom.xml @@ -121,6 +121,14 @@ + + + + org.glassfish.jaxb + jaxb-runtime + 4.0.5 + + diff --git a/container/openejb-jee/regenerate_accessors.sh b/container/openejb-jee/regenerate_accessors.sh new file mode 100755 index 00000000000..a9b27717fcf --- /dev/null +++ b/container/openejb-jee/regenerate_accessors.sh @@ -0,0 +1,51 @@ +#! /bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This regenerates the accessor classes, adds the ASF license header to the generated classes and moves them to ../openejb-jee-accessors +# Run this when modifying JAXB classes in this maven module! +mvn -Pgenerate-accessors -DskipTests + +SRC_DIR="target/sxc/org/apache/openejb/jee" +DEST_DIR="../openejb-jee-accessors/src/main/java/org/apache/openejb/jee" + +# Define the ASF license header +ASF_LICENSE_HEADER='/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */' + +rm -rf $DEST_DIR +mkdir -p $DEST_DIR + +find "$SRC_DIR" -type f -name "*.java" | while read -r file; do + echo "$ASF_LICENSE_HEADER" | cat - "$file" > temp && mv temp "$file" + relative_path="${file#$SRC_DIR/}" + mkdir -p "$DEST_DIR/$(dirname "$relative_path")" + mv "$file" "$DEST_DIR/$relative_path" +done \ No newline at end of file From 65909d784087ddb144ecb6af406112d63ea5d27b Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Thu, 29 Aug 2024 11:56:59 +0200 Subject: [PATCH 08/13] regenerate accessors --- .../org/apache/openejb/jee/ApplicationClient$JAXB.java | 8 +++----- .../main/java/org/apache/openejb/jee/EntityBean$JAXB.java | 8 +++----- .../java/org/apache/openejb/jee/Interceptor$JAXB.java | 8 +++----- .../org/apache/openejb/jee/MessageDrivenBean$JAXB.java | 8 +++----- .../java/org/apache/openejb/jee/SessionBean$JAXB.java | 8 +++----- .../src/main/java/org/apache/openejb/jee/WebApp$JAXB.java | 8 +++----- .../java/org/apache/openejb/jee/WebFragment$JAXB.java | 8 +++----- 7 files changed, 21 insertions(+), 35 deletions(-) diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationClient$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationClient$JAXB.java index dbf35db6850..8df39f4bf2f 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationClient$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ApplicationClient$JAXB.java @@ -22,7 +22,6 @@ import javax.xml.XMLConstants; import javax.xml.namespace.QName; import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; @@ -72,7 +71,6 @@ public class ApplicationClient$JAXB extends JAXBObject { - private static final FieldAccessor> applicationClientContextService = new FieldAccessor<>(ApplicationClient.class, "contextService"); public ApplicationClient$JAXB() { super(ApplicationClient.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "application-client".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "application-clientType".intern()), Text$JAXB.class, Icon$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, MessageDestination$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, ContextService$JAXB.class); @@ -397,7 +395,7 @@ public static final ApplicationClient _read(XoXMLStreamReader reader, RuntimeCon // ELEMENT: contextService ContextService contextServiceItem = readContextService(elementReader, context); if (contextService == null) { - contextService = applicationClientContextService.getObject(reader, context, applicationClient); + contextService = applicationClient.contextService; if (contextService!= null) { contextService.clear(); } else { @@ -472,7 +470,7 @@ public static final ApplicationClient _read(XoXMLStreamReader reader, RuntimeCon applicationClient.jmsDestinations = jmsDestinations; } if (contextService!= null) { - applicationClientContextService.setObject(reader, context, applicationClient, contextService); + applicationClient.contextService = contextService; } context.afterUnmarshal(applicationClient, org.metatype.sxc.jaxb.LifecycleCallback.NONE); @@ -826,7 +824,7 @@ public static final void _write(XoXMLStreamWriter writer, ApplicationClient appl } // ELEMENT: contextService - KeyedCollection contextService = applicationClientContextService.getObject(applicationClient, context, applicationClient); + KeyedCollection contextService = applicationClient.contextService; if (contextService!= null) { for (ContextService contextServiceItem: contextService) { if (contextServiceItem!= null) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EntityBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EntityBean$JAXB.java index c459486b311..dbc442137aa 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EntityBean$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/EntityBean$JAXB.java @@ -22,7 +22,6 @@ import javax.xml.XMLConstants; import javax.xml.namespace.QName; import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; @@ -82,7 +81,6 @@ public class EntityBean$JAXB extends JAXBObject { - private static final FieldAccessor> entityBeanContextService = new FieldAccessor<>(EntityBean.class, "contextService"); public EntityBean$JAXB() { super(EntityBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "entity-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, PersistenceType$JAXB.class, CmpVersion$JAXB.class, CmpField$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, Query$JAXB.class, ContextService$JAXB.class); @@ -559,7 +557,7 @@ public static final EntityBean _read(XoXMLStreamReader reader, RuntimeContext co // ELEMENT: contextService ContextService contextServiceItem = readContextService(elementReader, context); if (contextService == null) { - contextService = entityBeanContextService.getObject(reader, context, entityBean); + contextService = entityBean.contextService; if (contextService!= null) { contextService.clear(); } else { @@ -640,7 +638,7 @@ public static final EntityBean _read(XoXMLStreamReader reader, RuntimeContext co entityBean.query = query; } if (contextService!= null) { - entityBeanContextService.setObject(reader, context, entityBean, contextService); + entityBean.contextService = contextService; } context.afterUnmarshal(entityBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); @@ -1162,7 +1160,7 @@ public static final void _write(XoXMLStreamWriter writer, EntityBean entityBean, } // ELEMENT: contextService - KeyedCollection contextService = entityBeanContextService.getObject(entityBean, context, entityBean); + KeyedCollection contextService = entityBean.contextService; if (contextService!= null) { for (ContextService contextServiceItem: contextService) { if (contextServiceItem!= null) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptor$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptor$JAXB.java index 7ab0143ab76..ba09e65db59 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptor$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Interceptor$JAXB.java @@ -22,7 +22,6 @@ import javax.xml.XMLConstants; import javax.xml.namespace.QName; import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; @@ -72,7 +71,6 @@ public class Interceptor$JAXB extends JAXBObject { - private static final FieldAccessor> interceptorContextService = new FieldAccessor<>(Interceptor.class, "contextService"); public Interceptor$JAXB() { super(Interceptor.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "interceptorType".intern()), Text$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, ContextService$JAXB.class); @@ -447,7 +445,7 @@ public static final Interceptor _read(XoXMLStreamReader reader, RuntimeContext c // ELEMENT: contextService ContextService contextServiceItem = readContextService(elementReader, context); if (contextService == null) { - contextService = interceptorContextService.getObject(reader, context, interceptor); + contextService = interceptor.contextService; if (contextService!= null) { contextService.clear(); } else { @@ -533,7 +531,7 @@ public static final Interceptor _read(XoXMLStreamReader reader, RuntimeContext c interceptor.afterCompletion = afterCompletion; } if (contextService!= null) { - interceptorContextService.setObject(reader, context, interceptor, contextService); + interceptor.contextService = contextService; } context.afterUnmarshal(interceptor, org.metatype.sxc.jaxb.LifecycleCallback.NONE); @@ -920,7 +918,7 @@ public static final void _write(XoXMLStreamWriter writer, Interceptor intercepto } // ELEMENT: contextService - KeyedCollection contextService = interceptorContextService.getObject(interceptor, context, interceptor); + KeyedCollection contextService = interceptor.contextService; if (contextService!= null) { for (ContextService contextServiceItem: contextService) { if (contextServiceItem!= null) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java index 79bd1238ccf..dd375b1dc98 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/MessageDrivenBean$JAXB.java @@ -22,7 +22,6 @@ import javax.xml.XMLConstants; import javax.xml.namespace.QName; import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; @@ -88,7 +87,6 @@ public class MessageDrivenBean$JAXB extends JAXBObject { - private static final FieldAccessor> messageDrivenBeanContextService = new FieldAccessor<>(MessageDrivenBean.class, "contextService"); public MessageDrivenBean$JAXB() { super(MessageDrivenBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "message-driven-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, TransactionType$JAXB.class, MessageDrivenDestination$JAXB.class, ActivationConfig$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, ContextService$JAXB.class); @@ -557,7 +555,7 @@ public static final MessageDrivenBean _read(XoXMLStreamReader reader, RuntimeCon // ELEMENT: contextService ContextService contextServiceItem = readContextService(elementReader, context); if (contextService == null) { - contextService = messageDrivenBeanContextService.getObject(reader, context, messageDrivenBean); + contextService = messageDrivenBean.contextService; if (contextService!= null) { contextService.clear(); } else { @@ -641,7 +639,7 @@ public static final MessageDrivenBean _read(XoXMLStreamReader reader, RuntimeCon messageDrivenBean.securityRoleRef = securityRoleRef; } if (contextService!= null) { - messageDrivenBeanContextService.setObject(reader, context, messageDrivenBean, contextService); + messageDrivenBean.contextService = contextService; } context.afterUnmarshal(messageDrivenBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); @@ -1158,7 +1156,7 @@ public static final void _write(XoXMLStreamWriter writer, MessageDrivenBean mess } // ELEMENT: contextService - KeyedCollection contextService = messageDrivenBeanContextService.getObject(messageDrivenBean, context, messageDrivenBean); + KeyedCollection contextService = messageDrivenBean.contextService; if (contextService!= null) { for (ContextService contextServiceItem: contextService) { if (contextServiceItem!= null) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java index de906da569a..d34f05d5c9a 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java @@ -23,7 +23,6 @@ import javax.xml.XMLConstants; import javax.xml.namespace.QName; import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; @@ -101,7 +100,6 @@ public class SessionBean$JAXB extends JAXBObject { - private static final FieldAccessor> sessionBeanContextService = new FieldAccessor<>(SessionBean.class, "contextService"); public SessionBean$JAXB() { super(SessionBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "session-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, SessionType$JAXB.class, Timeout$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, ConcurrencyManagementType$JAXB.class, ConcurrentMethod$JAXB.class, InitMethod$JAXB.class, RemoveMethod$JAXB.class, AsyncMethod$JAXB.class, TransactionType$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, ContextService$JAXB.class); @@ -727,7 +725,7 @@ public static final SessionBean _read(XoXMLStreamReader reader, RuntimeContext c // ELEMENT: contextService ContextService contextServiceItem = readContextService(elementReader, context); if (contextService == null) { - contextService = sessionBeanContextService.getObject(reader, context, sessionBean); + contextService = sessionBean.contextService; if (contextService!= null) { contextService.clear(); } else { @@ -835,7 +833,7 @@ public static final SessionBean _read(XoXMLStreamReader reader, RuntimeContext c sessionBean.securityRoleRef = securityRoleRef; } if (contextService!= null) { - sessionBeanContextService.setObject(reader, context, sessionBean, contextService); + sessionBean.contextService = contextService; } context.afterUnmarshal(sessionBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); @@ -1571,7 +1569,7 @@ public static final void _write(XoXMLStreamWriter writer, SessionBean sessionBea } // ELEMENT: contextService - KeyedCollection contextService = sessionBeanContextService.getObject(sessionBean, context, sessionBean); + KeyedCollection contextService = sessionBean.contextService; if (contextService!= null) { for (ContextService contextServiceItem: contextService) { if (contextServiceItem!= null) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java index 316a07fecdd..73c1132d81f 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java @@ -22,7 +22,6 @@ import javax.xml.XMLConstants; import javax.xml.namespace.QName; import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; @@ -108,7 +107,6 @@ public class WebApp$JAXB extends JAXBObject { - private static final FieldAccessor> webAppContextService = new FieldAccessor<>(WebApp.class, "contextService"); public WebApp$JAXB() { super(WebApp.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-app".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-appType".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, ParamValue$JAXB.class, Filter$JAXB.class, FilterMapping$JAXB.class, Listener$JAXB.class, Servlet$JAXB.class, ServletMapping$JAXB.class, SessionConfig$JAXB.class, MimeMapping$JAXB.class, WelcomeFileList$JAXB.class, ErrorPage$JAXB.class, Taglib$JAXB.class, JspConfig$JAXB.class, SecurityConstraint$JAXB.class, LoginConfig$JAXB.class, SecurityRole$JAXB.class, LocaleEncodingMappingList$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, MessageDestination$JAXB.class, AbsoluteOrdering$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, ContextService$JAXB.class); @@ -653,7 +651,7 @@ public static final WebApp _read(XoXMLStreamReader reader, RuntimeContext contex // ELEMENT: contextService ContextService contextServiceItem = readContextService(elementReader, context); if (contextService == null) { - contextService = webAppContextService.getObject(reader, context, webApp); + contextService = webApp.contextService; if (contextService!= null) { contextService.clear(); } else { @@ -776,7 +774,7 @@ public static final WebApp _read(XoXMLStreamReader reader, RuntimeContext contex webApp.jmsDestinations = jmsDestinations; } if (contextService!= null) { - webAppContextService.setObject(reader, context, webApp, contextService); + webApp.contextService = contextService; } context.afterUnmarshal(webApp, org.metatype.sxc.jaxb.LifecycleCallback.NONE); @@ -1351,7 +1349,7 @@ public static final void _write(XoXMLStreamWriter writer, WebApp webApp, Runtime } // ELEMENT: contextService - KeyedCollection contextService = webAppContextService.getObject(webApp, context, webApp); + KeyedCollection contextService = webApp.contextService; if (contextService!= null) { for (ContextService contextServiceItem: contextService) { if (contextServiceItem!= null) { diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebFragment$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebFragment$JAXB.java index 9db7f0ce880..55da8d4c63b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebFragment$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebFragment$JAXB.java @@ -22,7 +22,6 @@ import javax.xml.XMLConstants; import javax.xml.namespace.QName; import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; -import org.metatype.sxc.jaxb.FieldAccessor; import org.metatype.sxc.jaxb.JAXBObject; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.Attribute; @@ -106,7 +105,6 @@ public class WebFragment$JAXB extends JAXBObject { - private static final FieldAccessor> webFragmentContextService = new FieldAccessor<>(WebFragment.class, "contextService"); public WebFragment$JAXB() { super(WebFragment.class, new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-fragment".intern()), new QName("http://java.sun.com/xml/ns/javaee".intern(), "web-fragmentType".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, ParamValue$JAXB.class, Filter$JAXB.class, FilterMapping$JAXB.class, Listener$JAXB.class, Servlet$JAXB.class, ServletMapping$JAXB.class, SessionConfig$JAXB.class, MimeMapping$JAXB.class, WelcomeFileList$JAXB.class, ErrorPage$JAXB.class, JspConfig$JAXB.class, SecurityConstraint$JAXB.class, LoginConfig$JAXB.class, SecurityRole$JAXB.class, LocaleEncodingMappingList$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, MessageDestination$JAXB.class, Ordering$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, ContextService$JAXB.class); @@ -630,7 +628,7 @@ public static final WebFragment _read(XoXMLStreamReader reader, RuntimeContext c // ELEMENT: contextService ContextService contextServiceItem = readContextService(elementReader, context); if (contextService == null) { - contextService = webFragmentContextService.getObject(reader, context, webFragment); + contextService = webFragment.contextService; if (contextService!= null) { contextService.clear(); } else { @@ -753,7 +751,7 @@ public static final WebFragment _read(XoXMLStreamReader reader, RuntimeContext c webFragment.jmsDestinations = jmsDestinations; } if (contextService!= null) { - webFragmentContextService.setObject(reader, context, webFragment, contextService); + webFragment.contextService = contextService; } context.afterUnmarshal(webFragment, org.metatype.sxc.jaxb.LifecycleCallback.NONE); @@ -1301,7 +1299,7 @@ public static final void _write(XoXMLStreamWriter writer, WebFragment webFragmen } // ELEMENT: contextService - KeyedCollection contextService = webFragmentContextService.getObject(webFragment, context, webFragment); + KeyedCollection contextService = webFragment.contextService; if (contextService!= null) { for (ContextService contextServiceItem: contextService) { if (contextServiceItem!= null) { From b5b279b551c9d7c1b72de349c3662c30c29cc68f Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Thu, 29 Aug 2024 12:01:10 +0200 Subject: [PATCH 09/13] regenerated boms --- boms/tomee-microprofile/pom.xml | 22 ++++++++++++++++++++++ boms/tomee-plume/pom.xml | 22 ++++++++++++++++++++++ boms/tomee-plus/pom.xml | 22 ++++++++++++++++++++++ boms/tomee-webprofile/pom.xml | 22 ++++++++++++++++++++++ 4 files changed, 88 insertions(+) diff --git a/boms/tomee-microprofile/pom.xml b/boms/tomee-microprofile/pom.xml index 41f360e271a..58ea41f7c6d 100644 --- a/boms/tomee-microprofile/pom.xml +++ b/boms/tomee-microprofile/pom.xml @@ -177,6 +177,28 @@ + + io.github.rzo1.org.metatype.sxc + sxc-jaxb-core + 0.9 + + + * + * + + + + + io.github.rzo1.org.metatype.sxc + sxc-runtime + 0.9 + + + * + * + + + io.micrometer micrometer-commons diff --git a/boms/tomee-plume/pom.xml b/boms/tomee-plume/pom.xml index bfb6bf5afbd..c5c6374eca1 100644 --- a/boms/tomee-plume/pom.xml +++ b/boms/tomee-plume/pom.xml @@ -177,6 +177,28 @@ + + io.github.rzo1.org.metatype.sxc + sxc-jaxb-core + 0.9 + + + * + * + + + + + io.github.rzo1.org.metatype.sxc + sxc-runtime + 0.9 + + + * + * + + + io.micrometer micrometer-commons diff --git a/boms/tomee-plus/pom.xml b/boms/tomee-plus/pom.xml index 56325ce1fc8..1b28d4eab10 100644 --- a/boms/tomee-plus/pom.xml +++ b/boms/tomee-plus/pom.xml @@ -177,6 +177,28 @@ + + io.github.rzo1.org.metatype.sxc + sxc-jaxb-core + 0.9 + + + * + * + + + + + io.github.rzo1.org.metatype.sxc + sxc-runtime + 0.9 + + + * + * + + + io.micrometer micrometer-commons diff --git a/boms/tomee-webprofile/pom.xml b/boms/tomee-webprofile/pom.xml index e3c6620c19d..a4ab0f36a45 100644 --- a/boms/tomee-webprofile/pom.xml +++ b/boms/tomee-webprofile/pom.xml @@ -122,6 +122,28 @@ + + io.github.rzo1.org.metatype.sxc + sxc-jaxb-core + 0.9 + + + * + * + + + + + io.github.rzo1.org.metatype.sxc + sxc-runtime + 0.9 + + + * + * + + + org.apache.bval bval-jsr From 37c4d180da896d985e885e3db13583edff573b58 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Thu, 29 Aug 2024 14:09:51 +0200 Subject: [PATCH 10/13] fix OutputGeneratedDescriptorsTest --- .../apache/openejb/jee/ManagedBean$JAXB.java | 1596 +++++++++++++++++ .../apache/openejb/jee/SessionBean$JAXB.java | 40 +- .../openejb/jee/SingletonBean$JAXB.java | 1586 ++++++++++++++++ .../apache/openejb/jee/StatefulBean$JAXB.java | 1586 ++++++++++++++++ .../openejb/jee/StatelessBean$JAXB.java | 1586 ++++++++++++++++ .../org/apache/openejb/jee/ManagedBean.java | 2 +- .../org/apache/openejb/jee/SessionBean.java | 2 + 7 files changed, 6393 insertions(+), 5 deletions(-) create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ManagedBean$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SingletonBean$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/StatefulBean$JAXB.java create mode 100644 container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/StatelessBean$JAXB.java diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ManagedBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ManagedBean$JAXB.java new file mode 100644 index 00000000000..e550d8cb5a0 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/ManagedBean$JAXB.java @@ -0,0 +1,1596 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.AroundInvoke$JAXB.readAroundInvoke; +import static org.apache.openejb.jee.AroundInvoke$JAXB.writeAroundInvoke; +import static org.apache.openejb.jee.AroundTimeout$JAXB.readAroundTimeout; +import static org.apache.openejb.jee.AroundTimeout$JAXB.writeAroundTimeout; +import static org.apache.openejb.jee.AsyncMethod$JAXB.readAsyncMethod; +import static org.apache.openejb.jee.AsyncMethod$JAXB.writeAsyncMethod; +import static org.apache.openejb.jee.ConcurrencyManagementType$JAXB.parseConcurrencyManagementType; +import static org.apache.openejb.jee.ConcurrencyManagementType$JAXB.toStringConcurrencyManagementType; +import static org.apache.openejb.jee.ConcurrentMethod$JAXB.readConcurrentMethod; +import static org.apache.openejb.jee.ConcurrentMethod$JAXB.writeConcurrentMethod; +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; +import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; +import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; +import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; +import static org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef; +import static org.apache.openejb.jee.EjbRef$JAXB.readEjbRef; +import static org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef; +import static org.apache.openejb.jee.Empty$JAXB.readEmpty; +import static org.apache.openejb.jee.Empty$JAXB.writeEmpty; +import static org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry; +import static org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry; +import static org.apache.openejb.jee.Icon$JAXB.readIcon; +import static org.apache.openejb.jee.Icon$JAXB.writeIcon; +import static org.apache.openejb.jee.InitMethod$JAXB.readInitMethod; +import static org.apache.openejb.jee.InitMethod$JAXB.writeInitMethod; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; +import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; +import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback; +import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef; +import static org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef; +import static org.apache.openejb.jee.NamedMethod$JAXB.readNamedMethod; +import static org.apache.openejb.jee.NamedMethod$JAXB.writeNamedMethod; +import static org.apache.openejb.jee.PersistenceContextRef$JAXB.readPersistenceContextRef; +import static org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef; +import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.readPersistenceUnitRef; +import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.writePersistenceUnitRef; +import static org.apache.openejb.jee.RemoveMethod$JAXB.readRemoveMethod; +import static org.apache.openejb.jee.RemoveMethod$JAXB.writeRemoveMethod; +import static org.apache.openejb.jee.ResourceEnvRef$JAXB.readResourceEnvRef; +import static org.apache.openejb.jee.ResourceEnvRef$JAXB.writeResourceEnvRef; +import static org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef; +import static org.apache.openejb.jee.ResourceRef$JAXB.writeResourceRef; +import static org.apache.openejb.jee.SecurityIdentity$JAXB.readSecurityIdentity; +import static org.apache.openejb.jee.SecurityIdentity$JAXB.writeSecurityIdentity; +import static org.apache.openejb.jee.SecurityRoleRef$JAXB.readSecurityRoleRef; +import static org.apache.openejb.jee.SecurityRoleRef$JAXB.writeSecurityRoleRef; +import static org.apache.openejb.jee.ServiceRef$JAXB.readServiceRef; +import static org.apache.openejb.jee.ServiceRef$JAXB.writeServiceRef; +import static org.apache.openejb.jee.SessionType$JAXB.parseSessionType; +import static org.apache.openejb.jee.SessionType$JAXB.toStringSessionType; +import static org.apache.openejb.jee.Text$JAXB.readText; +import static org.apache.openejb.jee.Text$JAXB.writeText; +import static org.apache.openejb.jee.Timeout$JAXB.readTimeout; +import static org.apache.openejb.jee.Timeout$JAXB.writeTimeout; +import static org.apache.openejb.jee.Timer$JAXB.readTimer; +import static org.apache.openejb.jee.Timer$JAXB.writeTimer; +import static org.apache.openejb.jee.TransactionType$JAXB.parseTransactionType; +import static org.apache.openejb.jee.TransactionType$JAXB.toStringTransactionType; + +@SuppressWarnings({ + "StringEquality" +}) +public class ManagedBean$JAXB + extends JAXBObject +{ + + + public ManagedBean$JAXB() { + super(ManagedBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "managedBean".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, SessionType$JAXB.class, Timeout$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, ConcurrencyManagementType$JAXB.class, ConcurrentMethod$JAXB.class, InitMethod$JAXB.class, RemoveMethod$JAXB.class, AsyncMethod$JAXB.class, TransactionType$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, ContextService$JAXB.class); + } + + public static ManagedBean readManagedBean(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeManagedBean(XoXMLStreamWriter writer, ManagedBean managedBean, RuntimeContext context) + throws Exception + { + _write(writer, managedBean, context); + } + + public void write(XoXMLStreamWriter writer, ManagedBean managedBean, RuntimeContext context) + throws Exception + { + _write(writer, managedBean, context); + } + + public static final ManagedBean _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + ManagedBean managedBean = new ManagedBean(); + context.beforeUnmarshal(managedBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + ArrayList descriptions = null; + ArrayList displayNames = null; + LocalCollection icon = null; + LinkedHashSet businessLocal = null; + LinkedHashSet businessRemote = null; + List timer = null; + List concurrentMethod = null; + List initMethod = null; + List removeMethod = null; + List asyncMethod = null; + List aroundInvoke = null; + List aroundTimeout = null; + KeyedCollection envEntry = null; + KeyedCollection ejbRef = null; + KeyedCollection ejbLocalRef = null; + KeyedCollection serviceRef = null; + KeyedCollection resourceRef = null; + KeyedCollection resourceEnvRef = null; + KeyedCollection messageDestinationRef = null; + KeyedCollection persistenceContextRef = null; + KeyedCollection persistenceUnitRef = null; + List postConstruct = null; + List preDestroy = null; + KeyedCollection dataSource = null; + KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; + List postActivate = null; + List prePassivate = null; + List securityRoleRef = null; + KeyedCollection contextService = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("managedBean"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, ManagedBean.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, managedBean); + managedBean.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 (("hidden" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: hidden + Boolean hidden = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + managedBean.hidden = hidden; + } else if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: descriptions + Text descriptionsItem = readText(elementReader, context); + if (descriptions == null) { + descriptions = new ArrayList<>(); + } + descriptions.add(descriptionsItem); + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: displayNames + Text displayNamesItem = readText(elementReader, context); + if (displayNames == null) { + displayNames = new ArrayList<>(); + } + displayNames.add(displayNamesItem); + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: icon + Icon iconItem = readIcon(elementReader, context); + if (icon == null) { + icon = managedBean.icon; + if (icon!= null) { + icon.clear(); + } else { + icon = new LocalCollection<>(); + } + } + icon.add(iconItem); + } else if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbName + String ejbNameRaw = elementReader.getElementText(); + + String ejbName; + try { + ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + managedBean.ejbName = ejbName; + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: mappedName + String mappedNameRaw = elementReader.getElementText(); + + String mappedName; + try { + mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + managedBean.mappedName = mappedName; + } else if (("home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: home + String homeRaw = elementReader.getElementText(); + + String home; + try { + home = Adapters.collapsedStringAdapterAdapter.unmarshal(homeRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + managedBean.home = home; + } else if (("remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: remote + String remoteRaw = elementReader.getElementText(); + + String remote; + try { + remote = Adapters.collapsedStringAdapterAdapter.unmarshal(remoteRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + managedBean.remote = remote; + } else if (("local-home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: localHome + String localHomeRaw = elementReader.getElementText(); + + String localHome; + try { + localHome = Adapters.collapsedStringAdapterAdapter.unmarshal(localHomeRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + managedBean.localHome = localHome; + } else if (("local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: local + String localRaw = elementReader.getElementText(); + + String local; + try { + local = Adapters.collapsedStringAdapterAdapter.unmarshal(localRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + managedBean.local = local; + } else if (("business-local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: businessLocal + String businessLocalItemRaw = elementReader.getElementText(); + + String businessLocalItem; + try { + businessLocalItem = Adapters.collapsedStringAdapterAdapter.unmarshal(businessLocalItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (businessLocal == null) { + businessLocal = managedBean.businessLocal; + if (businessLocal!= null) { + businessLocal.clear(); + } else { + businessLocal = new LinkedHashSet<>(); + } + } + businessLocal.add(businessLocalItem); + } else if (("business-remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: businessRemote + String businessRemoteItemRaw = elementReader.getElementText(); + + String businessRemoteItem; + try { + businessRemoteItem = Adapters.collapsedStringAdapterAdapter.unmarshal(businessRemoteItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (businessRemote == null) { + businessRemote = managedBean.businessRemote; + if (businessRemote!= null) { + businessRemote.clear(); + } else { + businessRemote = new LinkedHashSet<>(); + } + } + businessRemote.add(businessRemoteItem); + } else if (("local-bean" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: localBean + Empty localBean = readEmpty(elementReader, context); + managedBean.localBean = localBean; + } else if (("service-endpoint" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: serviceEndpoint + String serviceEndpointRaw = elementReader.getElementText(); + + String serviceEndpoint; + try { + serviceEndpoint = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceEndpointRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + managedBean.serviceEndpoint = serviceEndpoint; + } else if (("ejb-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbClass + String ejbClassRaw = elementReader.getElementText(); + + String ejbClass; + try { + ejbClass = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClassRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + managedBean.ejbClass = ejbClass; + } else if (("session-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: sessionType + SessionType sessionType = parseSessionType(elementReader, context, elementReader.getElementText()); + if (sessionType!= null) { + managedBean.sessionType = sessionType; + } + } else if (("stateful-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: statefulTimeout + Timeout statefulTimeout = readTimeout(elementReader, context); + managedBean.statefulTimeout = statefulTimeout; + } else if (("timeout-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: timeoutMethod + NamedMethod timeoutMethod = readNamedMethod(elementReader, context); + managedBean.timeoutMethod = timeoutMethod; + } else if (("timer" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: timer + Timer timerItem = readTimer(elementReader, context); + if (timer == null) { + timer = managedBean.timer; + if (timer!= null) { + timer.clear(); + } else { + timer = new ArrayList<>(); + } + } + timer.add(timerItem); + } else if (("init-on-startup" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: initOnStartup + Boolean initOnStartup = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + managedBean.initOnStartup = initOnStartup; + } else if (("concurrency-management-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: concurrencyManagementType + ConcurrencyManagementType concurrencyManagementType = parseConcurrencyManagementType(elementReader, context, elementReader.getElementText()); + if (concurrencyManagementType!= null) { + managedBean.concurrencyManagementType = concurrencyManagementType; + } + } else if (("concurrent-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: concurrentMethod + ConcurrentMethod concurrentMethodItem = readConcurrentMethod(elementReader, context); + if (concurrentMethod == null) { + concurrentMethod = managedBean.concurrentMethod; + if (concurrentMethod!= null) { + concurrentMethod.clear(); + } else { + concurrentMethod = new ArrayList<>(); + } + } + concurrentMethod.add(concurrentMethodItem); + } else if (("depends-on" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT WRAPPER: dependsOn + _readDependsOn(elementReader, context, managedBean); + } else if (("init-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: initMethod + InitMethod initMethodItem = readInitMethod(elementReader, context); + if (initMethod == null) { + initMethod = managedBean.initMethod; + if (initMethod!= null) { + initMethod.clear(); + } else { + initMethod = new ArrayList<>(); + } + } + initMethod.add(initMethodItem); + } else if (("remove-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: removeMethod + RemoveMethod removeMethodItem = readRemoveMethod(elementReader, context); + if (removeMethod == null) { + removeMethod = managedBean.removeMethod; + if (removeMethod!= null) { + removeMethod.clear(); + } else { + removeMethod = new ArrayList<>(); + } + } + removeMethod.add(removeMethodItem); + } else if (("async-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: asyncMethod + AsyncMethod asyncMethodItem = readAsyncMethod(elementReader, context); + if (asyncMethod == null) { + asyncMethod = managedBean.asyncMethod; + if (asyncMethod!= null) { + asyncMethod.clear(); + } else { + asyncMethod = new ArrayList<>(); + } + } + asyncMethod.add(asyncMethodItem); + } else if (("transaction-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: transactionType + TransactionType transactionType = parseTransactionType(elementReader, context, elementReader.getElementText()); + if (transactionType!= null) { + managedBean.transactionType = transactionType; + } + } else if (("after-begin-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: afterBeginMethod + NamedMethod afterBeginMethod = readNamedMethod(elementReader, context); + try { + managedBean.setAfterBeginMethod(afterBeginMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setAfterBeginMethod", NamedMethod.class, e); + } + } else if (("before-completion-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: beforeCompletionMethod + NamedMethod beforeCompletionMethod = readNamedMethod(elementReader, context); + try { + managedBean.setBeforeCompletionMethod(beforeCompletionMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setBeforeCompletionMethod", NamedMethod.class, e); + } + } else if (("after-completion-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: afterCompletionMethod + NamedMethod afterCompletionMethod = readNamedMethod(elementReader, context); + try { + managedBean.setAfterCompletionMethod(afterCompletionMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setAfterCompletionMethod", NamedMethod.class, e); + } + } else if (("around-invoke" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: aroundInvoke + AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context); + if (aroundInvoke == null) { + aroundInvoke = managedBean.aroundInvoke; + if (aroundInvoke!= null) { + aroundInvoke.clear(); + } else { + aroundInvoke = new ArrayList<>(); + } + } + aroundInvoke.add(aroundInvokeItem); + } else if (("around-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: aroundTimeout + AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context); + if (aroundTimeout == null) { + aroundTimeout = managedBean.aroundTimeout; + if (aroundTimeout!= null) { + aroundTimeout.clear(); + } else { + aroundTimeout = new ArrayList<>(); + } + } + aroundTimeout.add(aroundTimeoutItem); + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: envEntry + EnvEntry envEntryItem = readEnvEntry(elementReader, context); + if (envEntry == null) { + envEntry = managedBean.envEntry; + if (envEntry!= null) { + envEntry.clear(); + } else { + envEntry = new KeyedCollection<>(); + } + } + envEntry.add(envEntryItem); + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbRef + EjbRef ejbRefItem = readEjbRef(elementReader, context); + if (ejbRef == null) { + ejbRef = managedBean.ejbRef; + if (ejbRef!= null) { + ejbRef.clear(); + } else { + ejbRef = new KeyedCollection<>(); + } + } + ejbRef.add(ejbRefItem); + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbLocalRef + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + if (ejbLocalRef == null) { + ejbLocalRef = managedBean.ejbLocalRef; + if (ejbLocalRef!= null) { + ejbLocalRef.clear(); + } else { + ejbLocalRef = new KeyedCollection<>(); + } + } + ejbLocalRef.add(ejbLocalRefItem); + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: serviceRef + ServiceRef serviceRefItem = readServiceRef(elementReader, context); + if (serviceRef == null) { + serviceRef = managedBean.serviceRef; + if (serviceRef!= null) { + serviceRef.clear(); + } else { + serviceRef = new KeyedCollection<>(); + } + } + serviceRef.add(serviceRefItem); + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceRef + ResourceRef resourceRefItem = readResourceRef(elementReader, context); + if (resourceRef == null) { + resourceRef = managedBean.resourceRef; + if (resourceRef!= null) { + resourceRef.clear(); + } else { + resourceRef = new KeyedCollection<>(); + } + } + resourceRef.add(resourceRefItem); + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceEnvRef + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + if (resourceEnvRef == null) { + resourceEnvRef = managedBean.resourceEnvRef; + if (resourceEnvRef!= null) { + resourceEnvRef.clear(); + } else { + resourceEnvRef = new KeyedCollection<>(); + } + } + resourceEnvRef.add(resourceEnvRefItem); + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: messageDestinationRef + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + if (messageDestinationRef == null) { + messageDestinationRef = managedBean.messageDestinationRef; + if (messageDestinationRef!= null) { + messageDestinationRef.clear(); + } else { + messageDestinationRef = new KeyedCollection<>(); + } + } + messageDestinationRef.add(messageDestinationRefItem); + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: persistenceContextRef + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + if (persistenceContextRef == null) { + persistenceContextRef = managedBean.persistenceContextRef; + if (persistenceContextRef!= null) { + persistenceContextRef.clear(); + } else { + persistenceContextRef = new KeyedCollection<>(); + } + } + persistenceContextRef.add(persistenceContextRefItem); + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: persistenceUnitRef + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + if (persistenceUnitRef == null) { + persistenceUnitRef = managedBean.persistenceUnitRef; + if (persistenceUnitRef!= null) { + persistenceUnitRef.clear(); + } else { + persistenceUnitRef = new KeyedCollection<>(); + } + } + persistenceUnitRef.add(persistenceUnitRefItem); + } else if (("post-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: postConstruct + org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); + if (postConstruct == null) { + postConstruct = managedBean.postConstruct; + if (postConstruct!= null) { + postConstruct.clear(); + } else { + postConstruct = new ArrayList<>(); + } + } + postConstruct.add(postConstructItem); + } else if (("pre-destroy" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: preDestroy + org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); + if (preDestroy == null) { + preDestroy = managedBean.preDestroy; + if (preDestroy!= null) { + preDestroy.clear(); + } else { + preDestroy = new ArrayList<>(); + } + } + preDestroy.add(preDestroyItem); + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: dataSource + DataSource dataSourceItem = readDataSource(elementReader, context); + if (dataSource == null) { + dataSource = managedBean.dataSource; + if (dataSource!= null) { + dataSource.clear(); + } else { + dataSource = new KeyedCollection<>(); + } + } + dataSource.add(dataSourceItem); + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); + if (jmsConnectionFactories == null) { + jmsConnectionFactories = managedBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + jmsConnectionFactories.clear(); + } else { + jmsConnectionFactories = new KeyedCollection<>(); + } + } + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = managedBean.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("post-activate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: postActivate + org.apache.openejb.jee.LifecycleCallback postActivateItem = readLifecycleCallback(elementReader, context); + if (postActivate == null) { + postActivate = managedBean.postActivate; + if (postActivate!= null) { + postActivate.clear(); + } else { + postActivate = new ArrayList<>(); + } + } + postActivate.add(postActivateItem); + } else if (("pre-passivate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: prePassivate + org.apache.openejb.jee.LifecycleCallback prePassivateItem = readLifecycleCallback(elementReader, context); + if (prePassivate == null) { + prePassivate = managedBean.prePassivate; + if (prePassivate!= null) { + prePassivate.clear(); + } else { + prePassivate = new ArrayList<>(); + } + } + prePassivate.add(prePassivateItem); + } else if (("security-role-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: securityRoleRef + SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); + if (securityRoleRef == null) { + securityRoleRef = managedBean.securityRoleRef; + if (securityRoleRef!= null) { + securityRoleRef.clear(); + } else { + securityRoleRef = new ArrayList<>(); + } + } + securityRoleRef.add(securityRoleRefItem); + } else if (("security-identity" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: securityIdentity + SecurityIdentity securityIdentity = readSecurityIdentity(elementReader, context); + managedBean.securityIdentity = securityIdentity; + } else if (("passivation-capable" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: passivationCapable + Boolean passivationCapable = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + managedBean.passivationCapable = passivationCapable; + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = managedBean.contextService; + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } + } + contextService.add(contextServiceItem); + } else { + context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "hidden"), 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", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "home"), new QName("http://java.sun.com/xml/ns/javaee", "remote"), 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", "business-local"), new QName("http://java.sun.com/xml/ns/javaee", "business-remote"), new QName("http://java.sun.com/xml/ns/javaee", "local-bean"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-class"), new QName("http://java.sun.com/xml/ns/javaee", "session-type"), new QName("http://java.sun.com/xml/ns/javaee", "stateful-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"), new QName("http://java.sun.com/xml/ns/javaee", "timer"), new QName("http://java.sun.com/xml/ns/javaee", "init-on-startup"), new QName("http://java.sun.com/xml/ns/javaee", "concurrency-management-type"), new QName("http://java.sun.com/xml/ns/javaee", "concurrent-method"), new QName("http://java.sun.com/xml/ns/javaee", "depends-on"), new QName("http://java.sun.com/xml/ns/javaee", "init-method"), new QName("http://java.sun.com/xml/ns/javaee", "remove-method"), new QName("http://java.sun.com/xml/ns/javaee", "async-method"), new QName("http://java.sun.com/xml/ns/javaee", "transaction-type"), new QName("http://java.sun.com/xml/ns/javaee", "after-begin-method"), new QName("http://java.sun.com/xml/ns/javaee", "before-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "after-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "post-activate"), new QName("http://java.sun.com/xml/ns/javaee", "pre-passivate"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "security-identity"), new QName("http://java.sun.com/xml/ns/javaee", "passivation-capable"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); + } + } + if (descriptions!= null) { + try { + managedBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setDescriptions", Text[].class, e); + } + } + if (displayNames!= null) { + try { + managedBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setDisplayNames", Text[].class, e); + } + } + if (icon!= null) { + managedBean.icon = icon; + } + if (businessLocal!= null) { + managedBean.businessLocal = businessLocal; + } + if (businessRemote!= null) { + managedBean.businessRemote = businessRemote; + } + if (timer!= null) { + managedBean.timer = timer; + } + if (concurrentMethod!= null) { + managedBean.concurrentMethod = concurrentMethod; + } + if (initMethod!= null) { + managedBean.initMethod = initMethod; + } + if (removeMethod!= null) { + managedBean.removeMethod = removeMethod; + } + if (asyncMethod!= null) { + managedBean.asyncMethod = asyncMethod; + } + if (aroundInvoke!= null) { + managedBean.aroundInvoke = aroundInvoke; + } + if (aroundTimeout!= null) { + managedBean.aroundTimeout = aroundTimeout; + } + if (envEntry!= null) { + managedBean.envEntry = envEntry; + } + if (ejbRef!= null) { + managedBean.ejbRef = ejbRef; + } + if (ejbLocalRef!= null) { + managedBean.ejbLocalRef = ejbLocalRef; + } + if (serviceRef!= null) { + managedBean.serviceRef = serviceRef; + } + if (resourceRef!= null) { + managedBean.resourceRef = resourceRef; + } + if (resourceEnvRef!= null) { + managedBean.resourceEnvRef = resourceEnvRef; + } + if (messageDestinationRef!= null) { + managedBean.messageDestinationRef = messageDestinationRef; + } + if (persistenceContextRef!= null) { + managedBean.persistenceContextRef = persistenceContextRef; + } + if (persistenceUnitRef!= null) { + managedBean.persistenceUnitRef = persistenceUnitRef; + } + if (postConstruct!= null) { + managedBean.postConstruct = postConstruct; + } + if (preDestroy!= null) { + managedBean.preDestroy = preDestroy; + } + if (dataSource!= null) { + managedBean.dataSource = dataSource; + } + if (jmsConnectionFactories!= null) { + managedBean.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + managedBean.jmsDestinations = jmsDestinations; + } + if (postActivate!= null) { + managedBean.postActivate = postActivate; + } + if (prePassivate!= null) { + managedBean.prePassivate = prePassivate; + } + if (securityRoleRef!= null) { + managedBean.securityRoleRef = securityRoleRef; + } + if (contextService!= null) { + managedBean.contextService = contextService; + } + + context.afterUnmarshal(managedBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + return managedBean; + } + + public final ManagedBean read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _readDependsOn(XoXMLStreamReader reader, RuntimeContext context, ManagedBean managedBean) + throws Exception + { + List dependsOn = null; + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: dependsOn + String dependsOnItemRaw = elementReader.getElementText(); + + String dependsOnItem; + try { + dependsOnItem = Adapters.collapsedStringAdapterAdapter.unmarshal(dependsOnItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (dependsOn == null) { + dependsOn = managedBean.dependsOn; + if (dependsOn!= null) { + dependsOn.clear(); + } else { + dependsOn = new ArrayList<>(); + } + } + dependsOn.add(dependsOnItem); + } + } + if (dependsOn!= null) { + managedBean.dependsOn = dependsOn; + } + } + + public static final void _write(XoXMLStreamWriter writer, ManagedBean managedBean, RuntimeContext context) + throws Exception + { + if (managedBean == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (ManagedBean.class!= managedBean.getClass()) { + context.unexpectedSubclass(writer, managedBean, ManagedBean.class); + return ; + } + + context.beforeMarshal(managedBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = managedBean.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: descriptions + Text[] descriptions = null; + try { + descriptions = managedBean.getDescriptions(); + } catch (Exception e) { + context.getterError(managedBean, "descriptions", SessionBean.class, "getDescriptions", e); + } + if (descriptions!= null) { + for (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(managedBean, "descriptions"); + } + } + } + + // ELEMENT: displayNames + Text[] displayNames = null; + try { + displayNames = managedBean.getDisplayNames(); + } catch (Exception e) { + context.getterError(managedBean, "displayNames", SessionBean.class, "getDisplayNames", e); + } + if (displayNames!= null) { + for (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(managedBean, "displayNames"); + } + } + } + + // ELEMENT: icon + LocalCollection icon = managedBean.icon; + if (icon!= null) { + for (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(managedBean, "icon"); + } + } + } + + // ELEMENT: ejbName + String ejbNameRaw = managedBean.ejbName; + String ejbName = null; + try { + ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (ejbName!= null) { + writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(ejbName); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(managedBean, "ejbName"); + } + + // ELEMENT: mappedName + String mappedNameRaw = managedBean.mappedName; + String mappedName = null; + try { + mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "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: home + String homeRaw = managedBean.home; + String home = null; + try { + home = Adapters.collapsedStringAdapterAdapter.marshal(homeRaw); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "home", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (home!= null) { + writer.writeStartElement(prefix, "home", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(home); + writer.writeEndElement(); + } + + // ELEMENT: remote + String remoteRaw = managedBean.remote; + String remote = null; + try { + remote = Adapters.collapsedStringAdapterAdapter.marshal(remoteRaw); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "remote", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (remote!= null) { + writer.writeStartElement(prefix, "remote", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(remote); + writer.writeEndElement(); + } + + // ELEMENT: localHome + String localHomeRaw = managedBean.localHome; + String localHome = null; + try { + localHome = Adapters.collapsedStringAdapterAdapter.marshal(localHomeRaw); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "localHome", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (localHome!= null) { + writer.writeStartElement(prefix, "local-home", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(localHome); + writer.writeEndElement(); + } + + // ELEMENT: local + String localRaw = managedBean.local; + String local = null; + try { + local = Adapters.collapsedStringAdapterAdapter.marshal(localRaw); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "local", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (local!= null) { + writer.writeStartElement(prefix, "local", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(local); + writer.writeEndElement(); + } + + // ELEMENT: businessLocal + LinkedHashSet businessLocalRaw = managedBean.businessLocal; + if (businessLocalRaw!= null) { + for (String businessLocalItem: businessLocalRaw) { + String businessLocal = null; + try { + businessLocal = Adapters.collapsedStringAdapterAdapter.marshal(businessLocalItem); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "businessLocal", CollapsedStringAdapter.class, LinkedHashSet.class, LinkedHashSet.class, e); + } + if (businessLocal!= null) { + writer.writeStartElement(prefix, "business-local", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(businessLocal); + writer.writeEndElement(); + } + } + } + + // ELEMENT: businessRemote + LinkedHashSet businessRemoteRaw = managedBean.businessRemote; + if (businessRemoteRaw!= null) { + for (String businessRemoteItem: businessRemoteRaw) { + String businessRemote = null; + try { + businessRemote = Adapters.collapsedStringAdapterAdapter.marshal(businessRemoteItem); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "businessRemote", CollapsedStringAdapter.class, LinkedHashSet.class, LinkedHashSet.class, e); + } + if (businessRemote!= null) { + writer.writeStartElement(prefix, "business-remote", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(businessRemote); + writer.writeEndElement(); + } + } + } + + // ELEMENT: localBean + Empty localBean = managedBean.localBean; + if (localBean!= null) { + writer.writeStartElement(prefix, "local-bean", "http://java.sun.com/xml/ns/javaee"); + writeEmpty(writer, localBean, context); + writer.writeEndElement(); + } + + // ELEMENT: serviceEndpoint + String serviceEndpointRaw = managedBean.serviceEndpoint; + String serviceEndpoint = null; + try { + serviceEndpoint = Adapters.collapsedStringAdapterAdapter.marshal(serviceEndpointRaw); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "serviceEndpoint", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (serviceEndpoint!= null) { + writer.writeStartElement(prefix, "service-endpoint", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(serviceEndpoint); + writer.writeEndElement(); + } + + // ELEMENT: ejbClass + String ejbClassRaw = managedBean.ejbClass; + String ejbClass = null; + try { + ejbClass = Adapters.collapsedStringAdapterAdapter.marshal(ejbClassRaw); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "ejbClass", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (ejbClass!= null) { + writer.writeStartElement(prefix, "ejb-class", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(ejbClass); + writer.writeEndElement(); + } + + // ELEMENT: sessionType + SessionType sessionType = managedBean.sessionType; + if (sessionType!= null) { + writer.writeStartElement(prefix, "session-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringSessionType(managedBean, null, context, sessionType)); + writer.writeEndElement(); + } + + // ELEMENT: statefulTimeout + Timeout statefulTimeout = managedBean.statefulTimeout; + if (statefulTimeout!= null) { + writer.writeStartElement(prefix, "stateful-timeout", "http://java.sun.com/xml/ns/javaee"); + writeTimeout(writer, statefulTimeout, context); + writer.writeEndElement(); + } + + // ELEMENT: timeoutMethod + NamedMethod timeoutMethod = managedBean.timeoutMethod; + if (timeoutMethod!= null) { + writer.writeStartElement(prefix, "timeout-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, timeoutMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: timer + List timer = managedBean.timer; + if (timer!= null) { + for (Timer timerItem: timer) { + if (timerItem!= null) { + writer.writeStartElement(prefix, "timer", "http://java.sun.com/xml/ns/javaee"); + writeTimer(writer, timerItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: initOnStartup + Boolean initOnStartup = managedBean.initOnStartup; + if (initOnStartup!= null) { + writer.writeStartElement(prefix, "init-on-startup", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Boolean.toString(initOnStartup)); + writer.writeEndElement(); + } + + // ELEMENT: concurrencyManagementType + ConcurrencyManagementType concurrencyManagementType = managedBean.concurrencyManagementType; + if (concurrencyManagementType!= null) { + writer.writeStartElement(prefix, "concurrency-management-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringConcurrencyManagementType(managedBean, null, context, concurrencyManagementType)); + writer.writeEndElement(); + } + + // ELEMENT: concurrentMethod + List concurrentMethod = managedBean.concurrentMethod; + if (concurrentMethod!= null) { + for (ConcurrentMethod concurrentMethodItem: concurrentMethod) { + if (concurrentMethodItem!= null) { + writer.writeStartElement(prefix, "concurrent-method", "http://java.sun.com/xml/ns/javaee"); + writeConcurrentMethod(writer, concurrentMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: dependsOn + List dependsOnRaw = managedBean.dependsOn; + if (dependsOnRaw!= null) { + writer.writeStartElement(prefix, "depends-on", "http://java.sun.com/xml/ns/javaee"); + for (String dependsOnItem: dependsOnRaw) { + String dependsOn = null; + try { + dependsOn = Adapters.collapsedStringAdapterAdapter.marshal(dependsOnItem); + } catch (Exception e) { + context.xmlAdapterError(managedBean, "dependsOn", CollapsedStringAdapter.class, List.class, List.class, e); + } + if (dependsOn!= null) { + writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(dependsOn); + writer.writeEndElement(); + } + } + writer.writeEndElement(); + } + + // ELEMENT: initMethod + List initMethod = managedBean.initMethod; + if (initMethod!= null) { + for (InitMethod initMethodItem: initMethod) { + if (initMethodItem!= null) { + writer.writeStartElement(prefix, "init-method", "http://java.sun.com/xml/ns/javaee"); + writeInitMethod(writer, initMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: removeMethod + List removeMethod = managedBean.removeMethod; + if (removeMethod!= null) { + for (RemoveMethod removeMethodItem: removeMethod) { + if (removeMethodItem!= null) { + writer.writeStartElement(prefix, "remove-method", "http://java.sun.com/xml/ns/javaee"); + writeRemoveMethod(writer, removeMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: asyncMethod + List asyncMethod = managedBean.asyncMethod; + if (asyncMethod!= null) { + for (AsyncMethod asyncMethodItem: asyncMethod) { + if (asyncMethodItem!= null) { + writer.writeStartElement(prefix, "async-method", "http://java.sun.com/xml/ns/javaee"); + writeAsyncMethod(writer, asyncMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: transactionType + TransactionType transactionType = managedBean.transactionType; + if (transactionType!= null) { + writer.writeStartElement(prefix, "transaction-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringTransactionType(managedBean, null, context, transactionType)); + writer.writeEndElement(); + } + + // ELEMENT: afterBeginMethod + NamedMethod afterBeginMethod = null; + try { + afterBeginMethod = managedBean.getAfterBeginMethod(); + } catch (Exception e) { + context.getterError(managedBean, "afterBeginMethod", SessionBean.class, "getAfterBeginMethod", e); + } + if (afterBeginMethod!= null) { + writer.writeStartElement(prefix, "after-begin-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, afterBeginMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: beforeCompletionMethod + NamedMethod beforeCompletionMethod = null; + try { + beforeCompletionMethod = managedBean.getBeforeCompletionMethod(); + } catch (Exception e) { + context.getterError(managedBean, "beforeCompletionMethod", SessionBean.class, "getBeforeCompletionMethod", e); + } + if (beforeCompletionMethod!= null) { + writer.writeStartElement(prefix, "before-completion-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, beforeCompletionMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: afterCompletionMethod + NamedMethod afterCompletionMethod = null; + try { + afterCompletionMethod = managedBean.getAfterCompletionMethod(); + } catch (Exception e) { + context.getterError(managedBean, "afterCompletionMethod", SessionBean.class, "getAfterCompletionMethod", e); + } + if (afterCompletionMethod!= null) { + writer.writeStartElement(prefix, "after-completion-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, afterCompletionMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: aroundInvoke + List aroundInvoke = managedBean.aroundInvoke; + if (aroundInvoke!= null) { + for (AroundInvoke aroundInvokeItem: aroundInvoke) { + if (aroundInvokeItem!= null) { + writer.writeStartElement(prefix, "around-invoke", "http://java.sun.com/xml/ns/javaee"); + writeAroundInvoke(writer, aroundInvokeItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(managedBean, "aroundInvoke"); + } + } + } + + // ELEMENT: aroundTimeout + List aroundTimeout = managedBean.aroundTimeout; + if (aroundTimeout!= null) { + for (AroundTimeout aroundTimeoutItem: aroundTimeout) { + if (aroundTimeoutItem!= null) { + writer.writeStartElement(prefix, "around-timeout", "http://java.sun.com/xml/ns/javaee"); + writeAroundTimeout(writer, aroundTimeoutItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: envEntry + KeyedCollection envEntry = managedBean.envEntry; + if (envEntry!= null) { + for (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(managedBean, "envEntry"); + } + } + } + + // ELEMENT: ejbRef + KeyedCollection ejbRef = managedBean.ejbRef; + if (ejbRef!= null) { + for (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(managedBean, "ejbRef"); + } + } + } + + // ELEMENT: ejbLocalRef + KeyedCollection ejbLocalRef = managedBean.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(managedBean, "ejbLocalRef"); + } + } + } + + // ELEMENT: serviceRef + KeyedCollection serviceRef = managedBean.serviceRef; + if (serviceRef!= null) { + for (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(managedBean, "serviceRef"); + } + } + } + + // ELEMENT: resourceRef + KeyedCollection resourceRef = managedBean.resourceRef; + if (resourceRef!= null) { + for (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(managedBean, "resourceRef"); + } + } + } + + // ELEMENT: resourceEnvRef + KeyedCollection resourceEnvRef = managedBean.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(managedBean, "resourceEnvRef"); + } + } + } + + // ELEMENT: messageDestinationRef + KeyedCollection messageDestinationRef = managedBean.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(managedBean, "messageDestinationRef"); + } + } + } + + // ELEMENT: persistenceContextRef + KeyedCollection persistenceContextRef = managedBean.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(managedBean, "persistenceContextRef"); + } + } + } + + // ELEMENT: persistenceUnitRef + KeyedCollection persistenceUnitRef = managedBean.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(managedBean, "persistenceUnitRef"); + } + } + } + + // ELEMENT: postConstruct + List postConstruct = managedBean.postConstruct; + if (postConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback postConstructItem: postConstruct) { + if (postConstructItem!= null) { + writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, postConstructItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(managedBean, "postConstruct"); + } + } + } + + // ELEMENT: preDestroy + List preDestroy = managedBean.preDestroy; + if (preDestroy!= null) { + for (org.apache.openejb.jee.LifecycleCallback preDestroyItem: preDestroy) { + if (preDestroyItem!= null) { + writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, preDestroyItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(managedBean, "preDestroy"); + } + } + } + + // ELEMENT: dataSource + KeyedCollection dataSource = managedBean.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { + writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); + writeDataSource(writer, dataSourceItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = managedBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(managedBean, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = managedBean.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: postActivate + List postActivate = managedBean.postActivate; + if (postActivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback postActivateItem: postActivate) { + if (postActivateItem!= null) { + writer.writeStartElement(prefix, "post-activate", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, postActivateItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(managedBean, "postActivate"); + } + } + } + + // ELEMENT: prePassivate + List prePassivate = managedBean.prePassivate; + if (prePassivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback prePassivateItem: prePassivate) { + if (prePassivateItem!= null) { + writer.writeStartElement(prefix, "pre-passivate", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, prePassivateItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(managedBean, "prePassivate"); + } + } + } + + // ELEMENT: securityRoleRef + List securityRoleRef = managedBean.securityRoleRef; + if (securityRoleRef!= null) { + for (SecurityRoleRef securityRoleRefItem: securityRoleRef) { + if (securityRoleRefItem!= null) { + writer.writeStartElement(prefix, "security-role-ref", "http://java.sun.com/xml/ns/javaee"); + writeSecurityRoleRef(writer, securityRoleRefItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(managedBean, "securityRoleRef"); + } + } + } + + // ELEMENT: securityIdentity + SecurityIdentity securityIdentity = managedBean.securityIdentity; + if (securityIdentity!= null) { + writer.writeStartElement(prefix, "security-identity", "http://java.sun.com/xml/ns/javaee"); + writeSecurityIdentity(writer, securityIdentity, context); + writer.writeEndElement(); + } + + // ELEMENT: passivationCapable + Boolean passivationCapable = managedBean.passivationCapable; + if (passivationCapable!= null) { + writer.writeStartElement(prefix, "passivation-capable", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Boolean.toString(passivationCapable)); + writer.writeEndElement(); + } + + // ELEMENT: contextService + KeyedCollection contextService = managedBean.contextService; + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: hidden + Boolean hidden = managedBean.hidden; + writer.writeStartElement(prefix, "hidden", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Boolean.toString(hidden)); + writer.writeEndElement(); + + context.afterMarshal(managedBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java index d34f05d5c9a..859f19aa3a1 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SessionBean$JAXB.java @@ -62,6 +62,8 @@ import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback; +import static org.apache.openejb.jee.ManagedBean$JAXB.readManagedBean; +import static org.apache.openejb.jee.ManagedBean$JAXB.writeManagedBean; import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef; import static org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef; import static org.apache.openejb.jee.NamedMethod$JAXB.readNamedMethod; @@ -84,6 +86,12 @@ import static org.apache.openejb.jee.ServiceRef$JAXB.writeServiceRef; import static org.apache.openejb.jee.SessionType$JAXB.parseSessionType; import static org.apache.openejb.jee.SessionType$JAXB.toStringSessionType; +import static org.apache.openejb.jee.SingletonBean$JAXB.readSingletonBean; +import static org.apache.openejb.jee.SingletonBean$JAXB.writeSingletonBean; +import static org.apache.openejb.jee.StatefulBean$JAXB.readStatefulBean; +import static org.apache.openejb.jee.StatefulBean$JAXB.writeStatefulBean; +import static org.apache.openejb.jee.StatelessBean$JAXB.readStatelessBean; +import static org.apache.openejb.jee.StatelessBean$JAXB.writeStatelessBean; import static org.apache.openejb.jee.Text$JAXB.readText; import static org.apache.openejb.jee.Text$JAXB.writeText; import static org.apache.openejb.jee.Timeout$JAXB.readTimeout; @@ -102,7 +110,7 @@ public class SessionBean$JAXB public SessionBean$JAXB() { - super(SessionBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "session-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, SessionType$JAXB.class, Timeout$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, ConcurrencyManagementType$JAXB.class, ConcurrentMethod$JAXB.class, InitMethod$JAXB.class, RemoveMethod$JAXB.class, AsyncMethod$JAXB.class, TransactionType$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, ContextService$JAXB.class); + super(SessionBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "session-beanType".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, SessionType$JAXB.class, Timeout$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, ConcurrencyManagementType$JAXB.class, ConcurrentMethod$JAXB.class, InitMethod$JAXB.class, RemoveMethod$JAXB.class, AsyncMethod$JAXB.class, TransactionType$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, ContextService$JAXB.class, StatelessBean$JAXB.class, StatefulBean$JAXB.class, SingletonBean$JAXB.class, ManagedBean$JAXB.class); } public static SessionBean readSessionBean(XoXMLStreamReader reader, RuntimeContext context) @@ -173,7 +181,15 @@ public static final SessionBean _read(XoXMLStreamReader reader, RuntimeContext c // Check xsi:type QName xsiType = reader.getXsiType(); if (xsiType!= null) { - if (("session-beanType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + if (("statelessBean" == xsiType.getLocalPart())&&("http://java.sun.com/xml/ns/javaee" == xsiType.getNamespaceURI())) { + return readStatelessBean(reader, context); + } else if (("statefulBean" == xsiType.getLocalPart())&&("http://java.sun.com/xml/ns/javaee" == xsiType.getNamespaceURI())) { + return readStatefulBean(reader, context); + } else if (("singletonBean" == xsiType.getLocalPart())&&("http://java.sun.com/xml/ns/javaee" == xsiType.getNamespaceURI())) { + return readSingletonBean(reader, context); + } else if (("managedBean" == xsiType.getLocalPart())&&("http://java.sun.com/xml/ns/javaee" == xsiType.getNamespaceURI())) { + return readManagedBean(reader, context); + } else if (("session-beanType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, SessionBean.class); } } @@ -895,8 +911,24 @@ public static final void _write(XoXMLStreamWriter writer, SessionBean sessionBea } String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); - if (SessionBean.class!= sessionBean.getClass()) { - context.unexpectedSubclass(writer, sessionBean, SessionBean.class); + if (ManagedBean.class == sessionBean.getClass()) { + writer.writeXsiType("http://java.sun.com/xml/ns/javaee", "managedBean"); + writeManagedBean(writer, ((ManagedBean) sessionBean), context); + return ; + } else if (SingletonBean.class == sessionBean.getClass()) { + writer.writeXsiType("http://java.sun.com/xml/ns/javaee", "singletonBean"); + writeSingletonBean(writer, ((SingletonBean) sessionBean), context); + return ; + } else if (StatefulBean.class == sessionBean.getClass()) { + writer.writeXsiType("http://java.sun.com/xml/ns/javaee", "statefulBean"); + writeStatefulBean(writer, ((StatefulBean) sessionBean), context); + return ; + } else if (StatelessBean.class == sessionBean.getClass()) { + writer.writeXsiType("http://java.sun.com/xml/ns/javaee", "statelessBean"); + writeStatelessBean(writer, ((StatelessBean) sessionBean), context); + return ; + } else if (SessionBean.class!= sessionBean.getClass()) { + context.unexpectedSubclass(writer, sessionBean, SessionBean.class, ManagedBean.class, SingletonBean.class, StatefulBean.class, StatelessBean.class); return ; } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SingletonBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SingletonBean$JAXB.java new file mode 100644 index 00000000000..cc847eb2ed1 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/SingletonBean$JAXB.java @@ -0,0 +1,1586 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.AroundInvoke$JAXB.readAroundInvoke; +import static org.apache.openejb.jee.AroundInvoke$JAXB.writeAroundInvoke; +import static org.apache.openejb.jee.AroundTimeout$JAXB.readAroundTimeout; +import static org.apache.openejb.jee.AroundTimeout$JAXB.writeAroundTimeout; +import static org.apache.openejb.jee.AsyncMethod$JAXB.readAsyncMethod; +import static org.apache.openejb.jee.AsyncMethod$JAXB.writeAsyncMethod; +import static org.apache.openejb.jee.ConcurrencyManagementType$JAXB.parseConcurrencyManagementType; +import static org.apache.openejb.jee.ConcurrencyManagementType$JAXB.toStringConcurrencyManagementType; +import static org.apache.openejb.jee.ConcurrentMethod$JAXB.readConcurrentMethod; +import static org.apache.openejb.jee.ConcurrentMethod$JAXB.writeConcurrentMethod; +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; +import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; +import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; +import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; +import static org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef; +import static org.apache.openejb.jee.EjbRef$JAXB.readEjbRef; +import static org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef; +import static org.apache.openejb.jee.Empty$JAXB.readEmpty; +import static org.apache.openejb.jee.Empty$JAXB.writeEmpty; +import static org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry; +import static org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry; +import static org.apache.openejb.jee.Icon$JAXB.readIcon; +import static org.apache.openejb.jee.Icon$JAXB.writeIcon; +import static org.apache.openejb.jee.InitMethod$JAXB.readInitMethod; +import static org.apache.openejb.jee.InitMethod$JAXB.writeInitMethod; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; +import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; +import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback; +import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef; +import static org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef; +import static org.apache.openejb.jee.NamedMethod$JAXB.readNamedMethod; +import static org.apache.openejb.jee.NamedMethod$JAXB.writeNamedMethod; +import static org.apache.openejb.jee.PersistenceContextRef$JAXB.readPersistenceContextRef; +import static org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef; +import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.readPersistenceUnitRef; +import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.writePersistenceUnitRef; +import static org.apache.openejb.jee.RemoveMethod$JAXB.readRemoveMethod; +import static org.apache.openejb.jee.RemoveMethod$JAXB.writeRemoveMethod; +import static org.apache.openejb.jee.ResourceEnvRef$JAXB.readResourceEnvRef; +import static org.apache.openejb.jee.ResourceEnvRef$JAXB.writeResourceEnvRef; +import static org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef; +import static org.apache.openejb.jee.ResourceRef$JAXB.writeResourceRef; +import static org.apache.openejb.jee.SecurityIdentity$JAXB.readSecurityIdentity; +import static org.apache.openejb.jee.SecurityIdentity$JAXB.writeSecurityIdentity; +import static org.apache.openejb.jee.SecurityRoleRef$JAXB.readSecurityRoleRef; +import static org.apache.openejb.jee.SecurityRoleRef$JAXB.writeSecurityRoleRef; +import static org.apache.openejb.jee.ServiceRef$JAXB.readServiceRef; +import static org.apache.openejb.jee.ServiceRef$JAXB.writeServiceRef; +import static org.apache.openejb.jee.SessionType$JAXB.parseSessionType; +import static org.apache.openejb.jee.SessionType$JAXB.toStringSessionType; +import static org.apache.openejb.jee.Text$JAXB.readText; +import static org.apache.openejb.jee.Text$JAXB.writeText; +import static org.apache.openejb.jee.Timeout$JAXB.readTimeout; +import static org.apache.openejb.jee.Timeout$JAXB.writeTimeout; +import static org.apache.openejb.jee.Timer$JAXB.readTimer; +import static org.apache.openejb.jee.Timer$JAXB.writeTimer; +import static org.apache.openejb.jee.TransactionType$JAXB.parseTransactionType; +import static org.apache.openejb.jee.TransactionType$JAXB.toStringTransactionType; + +@SuppressWarnings({ + "StringEquality" +}) +public class SingletonBean$JAXB + extends JAXBObject +{ + + + public SingletonBean$JAXB() { + super(SingletonBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "singletonBean".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, SessionType$JAXB.class, Timeout$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, ConcurrencyManagementType$JAXB.class, ConcurrentMethod$JAXB.class, InitMethod$JAXB.class, RemoveMethod$JAXB.class, AsyncMethod$JAXB.class, TransactionType$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, ContextService$JAXB.class); + } + + public static SingletonBean readSingletonBean(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeSingletonBean(XoXMLStreamWriter writer, SingletonBean singletonBean, RuntimeContext context) + throws Exception + { + _write(writer, singletonBean, context); + } + + public void write(XoXMLStreamWriter writer, SingletonBean singletonBean, RuntimeContext context) + throws Exception + { + _write(writer, singletonBean, context); + } + + public static final SingletonBean _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + SingletonBean singletonBean = new SingletonBean(); + context.beforeUnmarshal(singletonBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + ArrayList descriptions = null; + ArrayList displayNames = null; + LocalCollection icon = null; + LinkedHashSet businessLocal = null; + LinkedHashSet businessRemote = null; + List timer = null; + List concurrentMethod = null; + List initMethod = null; + List removeMethod = null; + List asyncMethod = null; + List aroundInvoke = null; + List aroundTimeout = null; + KeyedCollection envEntry = null; + KeyedCollection ejbRef = null; + KeyedCollection ejbLocalRef = null; + KeyedCollection serviceRef = null; + KeyedCollection resourceRef = null; + KeyedCollection resourceEnvRef = null; + KeyedCollection messageDestinationRef = null; + KeyedCollection persistenceContextRef = null; + KeyedCollection persistenceUnitRef = null; + List postConstruct = null; + List preDestroy = null; + KeyedCollection dataSource = null; + KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; + List postActivate = null; + List prePassivate = null; + List securityRoleRef = null; + KeyedCollection contextService = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("singletonBean"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, SingletonBean.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, singletonBean); + singletonBean.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 (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: descriptions + Text descriptionsItem = readText(elementReader, context); + if (descriptions == null) { + descriptions = new ArrayList<>(); + } + descriptions.add(descriptionsItem); + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: displayNames + Text displayNamesItem = readText(elementReader, context); + if (displayNames == null) { + displayNames = new ArrayList<>(); + } + displayNames.add(displayNamesItem); + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: icon + Icon iconItem = readIcon(elementReader, context); + if (icon == null) { + icon = singletonBean.icon; + if (icon!= null) { + icon.clear(); + } else { + icon = new LocalCollection<>(); + } + } + icon.add(iconItem); + } else if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbName + String ejbNameRaw = elementReader.getElementText(); + + String ejbName; + try { + ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + singletonBean.ejbName = ejbName; + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: mappedName + String mappedNameRaw = elementReader.getElementText(); + + String mappedName; + try { + mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + singletonBean.mappedName = mappedName; + } else if (("home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: home + String homeRaw = elementReader.getElementText(); + + String home; + try { + home = Adapters.collapsedStringAdapterAdapter.unmarshal(homeRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + singletonBean.home = home; + } else if (("remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: remote + String remoteRaw = elementReader.getElementText(); + + String remote; + try { + remote = Adapters.collapsedStringAdapterAdapter.unmarshal(remoteRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + singletonBean.remote = remote; + } else if (("local-home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: localHome + String localHomeRaw = elementReader.getElementText(); + + String localHome; + try { + localHome = Adapters.collapsedStringAdapterAdapter.unmarshal(localHomeRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + singletonBean.localHome = localHome; + } else if (("local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: local + String localRaw = elementReader.getElementText(); + + String local; + try { + local = Adapters.collapsedStringAdapterAdapter.unmarshal(localRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + singletonBean.local = local; + } else if (("business-local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: businessLocal + String businessLocalItemRaw = elementReader.getElementText(); + + String businessLocalItem; + try { + businessLocalItem = Adapters.collapsedStringAdapterAdapter.unmarshal(businessLocalItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (businessLocal == null) { + businessLocal = singletonBean.businessLocal; + if (businessLocal!= null) { + businessLocal.clear(); + } else { + businessLocal = new LinkedHashSet<>(); + } + } + businessLocal.add(businessLocalItem); + } else if (("business-remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: businessRemote + String businessRemoteItemRaw = elementReader.getElementText(); + + String businessRemoteItem; + try { + businessRemoteItem = Adapters.collapsedStringAdapterAdapter.unmarshal(businessRemoteItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (businessRemote == null) { + businessRemote = singletonBean.businessRemote; + if (businessRemote!= null) { + businessRemote.clear(); + } else { + businessRemote = new LinkedHashSet<>(); + } + } + businessRemote.add(businessRemoteItem); + } else if (("local-bean" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: localBean + Empty localBean = readEmpty(elementReader, context); + singletonBean.localBean = localBean; + } else if (("service-endpoint" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: serviceEndpoint + String serviceEndpointRaw = elementReader.getElementText(); + + String serviceEndpoint; + try { + serviceEndpoint = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceEndpointRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + singletonBean.serviceEndpoint = serviceEndpoint; + } else if (("ejb-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbClass + String ejbClassRaw = elementReader.getElementText(); + + String ejbClass; + try { + ejbClass = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClassRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + singletonBean.ejbClass = ejbClass; + } else if (("session-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: sessionType + SessionType sessionType = parseSessionType(elementReader, context, elementReader.getElementText()); + if (sessionType!= null) { + singletonBean.sessionType = sessionType; + } + } else if (("stateful-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: statefulTimeout + Timeout statefulTimeout = readTimeout(elementReader, context); + singletonBean.statefulTimeout = statefulTimeout; + } else if (("timeout-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: timeoutMethod + NamedMethod timeoutMethod = readNamedMethod(elementReader, context); + singletonBean.timeoutMethod = timeoutMethod; + } else if (("timer" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: timer + Timer timerItem = readTimer(elementReader, context); + if (timer == null) { + timer = singletonBean.timer; + if (timer!= null) { + timer.clear(); + } else { + timer = new ArrayList<>(); + } + } + timer.add(timerItem); + } else if (("init-on-startup" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: initOnStartup + Boolean initOnStartup = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + singletonBean.initOnStartup = initOnStartup; + } else if (("concurrency-management-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: concurrencyManagementType + ConcurrencyManagementType concurrencyManagementType = parseConcurrencyManagementType(elementReader, context, elementReader.getElementText()); + if (concurrencyManagementType!= null) { + singletonBean.concurrencyManagementType = concurrencyManagementType; + } + } else if (("concurrent-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: concurrentMethod + ConcurrentMethod concurrentMethodItem = readConcurrentMethod(elementReader, context); + if (concurrentMethod == null) { + concurrentMethod = singletonBean.concurrentMethod; + if (concurrentMethod!= null) { + concurrentMethod.clear(); + } else { + concurrentMethod = new ArrayList<>(); + } + } + concurrentMethod.add(concurrentMethodItem); + } else if (("depends-on" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT WRAPPER: dependsOn + _readDependsOn(elementReader, context, singletonBean); + } else if (("init-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: initMethod + InitMethod initMethodItem = readInitMethod(elementReader, context); + if (initMethod == null) { + initMethod = singletonBean.initMethod; + if (initMethod!= null) { + initMethod.clear(); + } else { + initMethod = new ArrayList<>(); + } + } + initMethod.add(initMethodItem); + } else if (("remove-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: removeMethod + RemoveMethod removeMethodItem = readRemoveMethod(elementReader, context); + if (removeMethod == null) { + removeMethod = singletonBean.removeMethod; + if (removeMethod!= null) { + removeMethod.clear(); + } else { + removeMethod = new ArrayList<>(); + } + } + removeMethod.add(removeMethodItem); + } else if (("async-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: asyncMethod + AsyncMethod asyncMethodItem = readAsyncMethod(elementReader, context); + if (asyncMethod == null) { + asyncMethod = singletonBean.asyncMethod; + if (asyncMethod!= null) { + asyncMethod.clear(); + } else { + asyncMethod = new ArrayList<>(); + } + } + asyncMethod.add(asyncMethodItem); + } else if (("transaction-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: transactionType + TransactionType transactionType = parseTransactionType(elementReader, context, elementReader.getElementText()); + if (transactionType!= null) { + singletonBean.transactionType = transactionType; + } + } else if (("after-begin-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: afterBeginMethod + NamedMethod afterBeginMethod = readNamedMethod(elementReader, context); + try { + singletonBean.setAfterBeginMethod(afterBeginMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setAfterBeginMethod", NamedMethod.class, e); + } + } else if (("before-completion-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: beforeCompletionMethod + NamedMethod beforeCompletionMethod = readNamedMethod(elementReader, context); + try { + singletonBean.setBeforeCompletionMethod(beforeCompletionMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setBeforeCompletionMethod", NamedMethod.class, e); + } + } else if (("after-completion-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: afterCompletionMethod + NamedMethod afterCompletionMethod = readNamedMethod(elementReader, context); + try { + singletonBean.setAfterCompletionMethod(afterCompletionMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setAfterCompletionMethod", NamedMethod.class, e); + } + } else if (("around-invoke" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: aroundInvoke + AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context); + if (aroundInvoke == null) { + aroundInvoke = singletonBean.aroundInvoke; + if (aroundInvoke!= null) { + aroundInvoke.clear(); + } else { + aroundInvoke = new ArrayList<>(); + } + } + aroundInvoke.add(aroundInvokeItem); + } else if (("around-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: aroundTimeout + AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context); + if (aroundTimeout == null) { + aroundTimeout = singletonBean.aroundTimeout; + if (aroundTimeout!= null) { + aroundTimeout.clear(); + } else { + aroundTimeout = new ArrayList<>(); + } + } + aroundTimeout.add(aroundTimeoutItem); + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: envEntry + EnvEntry envEntryItem = readEnvEntry(elementReader, context); + if (envEntry == null) { + envEntry = singletonBean.envEntry; + if (envEntry!= null) { + envEntry.clear(); + } else { + envEntry = new KeyedCollection<>(); + } + } + envEntry.add(envEntryItem); + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbRef + EjbRef ejbRefItem = readEjbRef(elementReader, context); + if (ejbRef == null) { + ejbRef = singletonBean.ejbRef; + if (ejbRef!= null) { + ejbRef.clear(); + } else { + ejbRef = new KeyedCollection<>(); + } + } + ejbRef.add(ejbRefItem); + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbLocalRef + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + if (ejbLocalRef == null) { + ejbLocalRef = singletonBean.ejbLocalRef; + if (ejbLocalRef!= null) { + ejbLocalRef.clear(); + } else { + ejbLocalRef = new KeyedCollection<>(); + } + } + ejbLocalRef.add(ejbLocalRefItem); + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: serviceRef + ServiceRef serviceRefItem = readServiceRef(elementReader, context); + if (serviceRef == null) { + serviceRef = singletonBean.serviceRef; + if (serviceRef!= null) { + serviceRef.clear(); + } else { + serviceRef = new KeyedCollection<>(); + } + } + serviceRef.add(serviceRefItem); + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceRef + ResourceRef resourceRefItem = readResourceRef(elementReader, context); + if (resourceRef == null) { + resourceRef = singletonBean.resourceRef; + if (resourceRef!= null) { + resourceRef.clear(); + } else { + resourceRef = new KeyedCollection<>(); + } + } + resourceRef.add(resourceRefItem); + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceEnvRef + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + if (resourceEnvRef == null) { + resourceEnvRef = singletonBean.resourceEnvRef; + if (resourceEnvRef!= null) { + resourceEnvRef.clear(); + } else { + resourceEnvRef = new KeyedCollection<>(); + } + } + resourceEnvRef.add(resourceEnvRefItem); + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: messageDestinationRef + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + if (messageDestinationRef == null) { + messageDestinationRef = singletonBean.messageDestinationRef; + if (messageDestinationRef!= null) { + messageDestinationRef.clear(); + } else { + messageDestinationRef = new KeyedCollection<>(); + } + } + messageDestinationRef.add(messageDestinationRefItem); + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: persistenceContextRef + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + if (persistenceContextRef == null) { + persistenceContextRef = singletonBean.persistenceContextRef; + if (persistenceContextRef!= null) { + persistenceContextRef.clear(); + } else { + persistenceContextRef = new KeyedCollection<>(); + } + } + persistenceContextRef.add(persistenceContextRefItem); + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: persistenceUnitRef + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + if (persistenceUnitRef == null) { + persistenceUnitRef = singletonBean.persistenceUnitRef; + if (persistenceUnitRef!= null) { + persistenceUnitRef.clear(); + } else { + persistenceUnitRef = new KeyedCollection<>(); + } + } + persistenceUnitRef.add(persistenceUnitRefItem); + } else if (("post-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: postConstruct + org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); + if (postConstruct == null) { + postConstruct = singletonBean.postConstruct; + if (postConstruct!= null) { + postConstruct.clear(); + } else { + postConstruct = new ArrayList<>(); + } + } + postConstruct.add(postConstructItem); + } else if (("pre-destroy" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: preDestroy + org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); + if (preDestroy == null) { + preDestroy = singletonBean.preDestroy; + if (preDestroy!= null) { + preDestroy.clear(); + } else { + preDestroy = new ArrayList<>(); + } + } + preDestroy.add(preDestroyItem); + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: dataSource + DataSource dataSourceItem = readDataSource(elementReader, context); + if (dataSource == null) { + dataSource = singletonBean.dataSource; + if (dataSource!= null) { + dataSource.clear(); + } else { + dataSource = new KeyedCollection<>(); + } + } + dataSource.add(dataSourceItem); + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); + if (jmsConnectionFactories == null) { + jmsConnectionFactories = singletonBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + jmsConnectionFactories.clear(); + } else { + jmsConnectionFactories = new KeyedCollection<>(); + } + } + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = singletonBean.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("post-activate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: postActivate + org.apache.openejb.jee.LifecycleCallback postActivateItem = readLifecycleCallback(elementReader, context); + if (postActivate == null) { + postActivate = singletonBean.postActivate; + if (postActivate!= null) { + postActivate.clear(); + } else { + postActivate = new ArrayList<>(); + } + } + postActivate.add(postActivateItem); + } else if (("pre-passivate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: prePassivate + org.apache.openejb.jee.LifecycleCallback prePassivateItem = readLifecycleCallback(elementReader, context); + if (prePassivate == null) { + prePassivate = singletonBean.prePassivate; + if (prePassivate!= null) { + prePassivate.clear(); + } else { + prePassivate = new ArrayList<>(); + } + } + prePassivate.add(prePassivateItem); + } else if (("security-role-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: securityRoleRef + SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); + if (securityRoleRef == null) { + securityRoleRef = singletonBean.securityRoleRef; + if (securityRoleRef!= null) { + securityRoleRef.clear(); + } else { + securityRoleRef = new ArrayList<>(); + } + } + securityRoleRef.add(securityRoleRefItem); + } else if (("security-identity" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: securityIdentity + SecurityIdentity securityIdentity = readSecurityIdentity(elementReader, context); + singletonBean.securityIdentity = securityIdentity; + } else if (("passivation-capable" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: passivationCapable + Boolean passivationCapable = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + singletonBean.passivationCapable = passivationCapable; + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = singletonBean.contextService; + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } + } + contextService.add(contextServiceItem); + } 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", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "home"), new QName("http://java.sun.com/xml/ns/javaee", "remote"), 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", "business-local"), new QName("http://java.sun.com/xml/ns/javaee", "business-remote"), new QName("http://java.sun.com/xml/ns/javaee", "local-bean"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-class"), new QName("http://java.sun.com/xml/ns/javaee", "session-type"), new QName("http://java.sun.com/xml/ns/javaee", "stateful-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"), new QName("http://java.sun.com/xml/ns/javaee", "timer"), new QName("http://java.sun.com/xml/ns/javaee", "init-on-startup"), new QName("http://java.sun.com/xml/ns/javaee", "concurrency-management-type"), new QName("http://java.sun.com/xml/ns/javaee", "concurrent-method"), new QName("http://java.sun.com/xml/ns/javaee", "depends-on"), new QName("http://java.sun.com/xml/ns/javaee", "init-method"), new QName("http://java.sun.com/xml/ns/javaee", "remove-method"), new QName("http://java.sun.com/xml/ns/javaee", "async-method"), new QName("http://java.sun.com/xml/ns/javaee", "transaction-type"), new QName("http://java.sun.com/xml/ns/javaee", "after-begin-method"), new QName("http://java.sun.com/xml/ns/javaee", "before-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "after-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "post-activate"), new QName("http://java.sun.com/xml/ns/javaee", "pre-passivate"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "security-identity"), new QName("http://java.sun.com/xml/ns/javaee", "passivation-capable"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); + } + } + if (descriptions!= null) { + try { + singletonBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setDescriptions", Text[].class, e); + } + } + if (displayNames!= null) { + try { + singletonBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setDisplayNames", Text[].class, e); + } + } + if (icon!= null) { + singletonBean.icon = icon; + } + if (businessLocal!= null) { + singletonBean.businessLocal = businessLocal; + } + if (businessRemote!= null) { + singletonBean.businessRemote = businessRemote; + } + if (timer!= null) { + singletonBean.timer = timer; + } + if (concurrentMethod!= null) { + singletonBean.concurrentMethod = concurrentMethod; + } + if (initMethod!= null) { + singletonBean.initMethod = initMethod; + } + if (removeMethod!= null) { + singletonBean.removeMethod = removeMethod; + } + if (asyncMethod!= null) { + singletonBean.asyncMethod = asyncMethod; + } + if (aroundInvoke!= null) { + singletonBean.aroundInvoke = aroundInvoke; + } + if (aroundTimeout!= null) { + singletonBean.aroundTimeout = aroundTimeout; + } + if (envEntry!= null) { + singletonBean.envEntry = envEntry; + } + if (ejbRef!= null) { + singletonBean.ejbRef = ejbRef; + } + if (ejbLocalRef!= null) { + singletonBean.ejbLocalRef = ejbLocalRef; + } + if (serviceRef!= null) { + singletonBean.serviceRef = serviceRef; + } + if (resourceRef!= null) { + singletonBean.resourceRef = resourceRef; + } + if (resourceEnvRef!= null) { + singletonBean.resourceEnvRef = resourceEnvRef; + } + if (messageDestinationRef!= null) { + singletonBean.messageDestinationRef = messageDestinationRef; + } + if (persistenceContextRef!= null) { + singletonBean.persistenceContextRef = persistenceContextRef; + } + if (persistenceUnitRef!= null) { + singletonBean.persistenceUnitRef = persistenceUnitRef; + } + if (postConstruct!= null) { + singletonBean.postConstruct = postConstruct; + } + if (preDestroy!= null) { + singletonBean.preDestroy = preDestroy; + } + if (dataSource!= null) { + singletonBean.dataSource = dataSource; + } + if (jmsConnectionFactories!= null) { + singletonBean.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + singletonBean.jmsDestinations = jmsDestinations; + } + if (postActivate!= null) { + singletonBean.postActivate = postActivate; + } + if (prePassivate!= null) { + singletonBean.prePassivate = prePassivate; + } + if (securityRoleRef!= null) { + singletonBean.securityRoleRef = securityRoleRef; + } + if (contextService!= null) { + singletonBean.contextService = contextService; + } + + context.afterUnmarshal(singletonBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + return singletonBean; + } + + public final SingletonBean read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _readDependsOn(XoXMLStreamReader reader, RuntimeContext context, SingletonBean singletonBean) + throws Exception + { + List dependsOn = null; + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: dependsOn + String dependsOnItemRaw = elementReader.getElementText(); + + String dependsOnItem; + try { + dependsOnItem = Adapters.collapsedStringAdapterAdapter.unmarshal(dependsOnItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (dependsOn == null) { + dependsOn = singletonBean.dependsOn; + if (dependsOn!= null) { + dependsOn.clear(); + } else { + dependsOn = new ArrayList<>(); + } + } + dependsOn.add(dependsOnItem); + } + } + if (dependsOn!= null) { + singletonBean.dependsOn = dependsOn; + } + } + + public static final void _write(XoXMLStreamWriter writer, SingletonBean singletonBean, RuntimeContext context) + throws Exception + { + if (singletonBean == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (SingletonBean.class!= singletonBean.getClass()) { + context.unexpectedSubclass(writer, singletonBean, SingletonBean.class); + return ; + } + + context.beforeMarshal(singletonBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = singletonBean.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: descriptions + Text[] descriptions = null; + try { + descriptions = singletonBean.getDescriptions(); + } catch (Exception e) { + context.getterError(singletonBean, "descriptions", SessionBean.class, "getDescriptions", e); + } + if (descriptions!= null) { + for (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(singletonBean, "descriptions"); + } + } + } + + // ELEMENT: displayNames + Text[] displayNames = null; + try { + displayNames = singletonBean.getDisplayNames(); + } catch (Exception e) { + context.getterError(singletonBean, "displayNames", SessionBean.class, "getDisplayNames", e); + } + if (displayNames!= null) { + for (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(singletonBean, "displayNames"); + } + } + } + + // ELEMENT: icon + LocalCollection icon = singletonBean.icon; + if (icon!= null) { + for (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(singletonBean, "icon"); + } + } + } + + // ELEMENT: ejbName + String ejbNameRaw = singletonBean.ejbName; + String ejbName = null; + try { + ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (ejbName!= null) { + writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(ejbName); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(singletonBean, "ejbName"); + } + + // ELEMENT: mappedName + String mappedNameRaw = singletonBean.mappedName; + String mappedName = null; + try { + mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "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: home + String homeRaw = singletonBean.home; + String home = null; + try { + home = Adapters.collapsedStringAdapterAdapter.marshal(homeRaw); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "home", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (home!= null) { + writer.writeStartElement(prefix, "home", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(home); + writer.writeEndElement(); + } + + // ELEMENT: remote + String remoteRaw = singletonBean.remote; + String remote = null; + try { + remote = Adapters.collapsedStringAdapterAdapter.marshal(remoteRaw); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "remote", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (remote!= null) { + writer.writeStartElement(prefix, "remote", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(remote); + writer.writeEndElement(); + } + + // ELEMENT: localHome + String localHomeRaw = singletonBean.localHome; + String localHome = null; + try { + localHome = Adapters.collapsedStringAdapterAdapter.marshal(localHomeRaw); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "localHome", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (localHome!= null) { + writer.writeStartElement(prefix, "local-home", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(localHome); + writer.writeEndElement(); + } + + // ELEMENT: local + String localRaw = singletonBean.local; + String local = null; + try { + local = Adapters.collapsedStringAdapterAdapter.marshal(localRaw); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "local", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (local!= null) { + writer.writeStartElement(prefix, "local", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(local); + writer.writeEndElement(); + } + + // ELEMENT: businessLocal + LinkedHashSet businessLocalRaw = singletonBean.businessLocal; + if (businessLocalRaw!= null) { + for (String businessLocalItem: businessLocalRaw) { + String businessLocal = null; + try { + businessLocal = Adapters.collapsedStringAdapterAdapter.marshal(businessLocalItem); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "businessLocal", CollapsedStringAdapter.class, LinkedHashSet.class, LinkedHashSet.class, e); + } + if (businessLocal!= null) { + writer.writeStartElement(prefix, "business-local", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(businessLocal); + writer.writeEndElement(); + } + } + } + + // ELEMENT: businessRemote + LinkedHashSet businessRemoteRaw = singletonBean.businessRemote; + if (businessRemoteRaw!= null) { + for (String businessRemoteItem: businessRemoteRaw) { + String businessRemote = null; + try { + businessRemote = Adapters.collapsedStringAdapterAdapter.marshal(businessRemoteItem); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "businessRemote", CollapsedStringAdapter.class, LinkedHashSet.class, LinkedHashSet.class, e); + } + if (businessRemote!= null) { + writer.writeStartElement(prefix, "business-remote", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(businessRemote); + writer.writeEndElement(); + } + } + } + + // ELEMENT: localBean + Empty localBean = singletonBean.localBean; + if (localBean!= null) { + writer.writeStartElement(prefix, "local-bean", "http://java.sun.com/xml/ns/javaee"); + writeEmpty(writer, localBean, context); + writer.writeEndElement(); + } + + // ELEMENT: serviceEndpoint + String serviceEndpointRaw = singletonBean.serviceEndpoint; + String serviceEndpoint = null; + try { + serviceEndpoint = Adapters.collapsedStringAdapterAdapter.marshal(serviceEndpointRaw); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "serviceEndpoint", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (serviceEndpoint!= null) { + writer.writeStartElement(prefix, "service-endpoint", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(serviceEndpoint); + writer.writeEndElement(); + } + + // ELEMENT: ejbClass + String ejbClassRaw = singletonBean.ejbClass; + String ejbClass = null; + try { + ejbClass = Adapters.collapsedStringAdapterAdapter.marshal(ejbClassRaw); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "ejbClass", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (ejbClass!= null) { + writer.writeStartElement(prefix, "ejb-class", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(ejbClass); + writer.writeEndElement(); + } + + // ELEMENT: sessionType + SessionType sessionType = singletonBean.sessionType; + if (sessionType!= null) { + writer.writeStartElement(prefix, "session-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringSessionType(singletonBean, null, context, sessionType)); + writer.writeEndElement(); + } + + // ELEMENT: statefulTimeout + Timeout statefulTimeout = singletonBean.statefulTimeout; + if (statefulTimeout!= null) { + writer.writeStartElement(prefix, "stateful-timeout", "http://java.sun.com/xml/ns/javaee"); + writeTimeout(writer, statefulTimeout, context); + writer.writeEndElement(); + } + + // ELEMENT: timeoutMethod + NamedMethod timeoutMethod = singletonBean.timeoutMethod; + if (timeoutMethod!= null) { + writer.writeStartElement(prefix, "timeout-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, timeoutMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: timer + List timer = singletonBean.timer; + if (timer!= null) { + for (Timer timerItem: timer) { + if (timerItem!= null) { + writer.writeStartElement(prefix, "timer", "http://java.sun.com/xml/ns/javaee"); + writeTimer(writer, timerItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: initOnStartup + Boolean initOnStartup = singletonBean.initOnStartup; + if (initOnStartup!= null) { + writer.writeStartElement(prefix, "init-on-startup", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Boolean.toString(initOnStartup)); + writer.writeEndElement(); + } + + // ELEMENT: concurrencyManagementType + ConcurrencyManagementType concurrencyManagementType = singletonBean.concurrencyManagementType; + if (concurrencyManagementType!= null) { + writer.writeStartElement(prefix, "concurrency-management-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringConcurrencyManagementType(singletonBean, null, context, concurrencyManagementType)); + writer.writeEndElement(); + } + + // ELEMENT: concurrentMethod + List concurrentMethod = singletonBean.concurrentMethod; + if (concurrentMethod!= null) { + for (ConcurrentMethod concurrentMethodItem: concurrentMethod) { + if (concurrentMethodItem!= null) { + writer.writeStartElement(prefix, "concurrent-method", "http://java.sun.com/xml/ns/javaee"); + writeConcurrentMethod(writer, concurrentMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: dependsOn + List dependsOnRaw = singletonBean.dependsOn; + if (dependsOnRaw!= null) { + writer.writeStartElement(prefix, "depends-on", "http://java.sun.com/xml/ns/javaee"); + for (String dependsOnItem: dependsOnRaw) { + String dependsOn = null; + try { + dependsOn = Adapters.collapsedStringAdapterAdapter.marshal(dependsOnItem); + } catch (Exception e) { + context.xmlAdapterError(singletonBean, "dependsOn", CollapsedStringAdapter.class, List.class, List.class, e); + } + if (dependsOn!= null) { + writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(dependsOn); + writer.writeEndElement(); + } + } + writer.writeEndElement(); + } + + // ELEMENT: initMethod + List initMethod = singletonBean.initMethod; + if (initMethod!= null) { + for (InitMethod initMethodItem: initMethod) { + if (initMethodItem!= null) { + writer.writeStartElement(prefix, "init-method", "http://java.sun.com/xml/ns/javaee"); + writeInitMethod(writer, initMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: removeMethod + List removeMethod = singletonBean.removeMethod; + if (removeMethod!= null) { + for (RemoveMethod removeMethodItem: removeMethod) { + if (removeMethodItem!= null) { + writer.writeStartElement(prefix, "remove-method", "http://java.sun.com/xml/ns/javaee"); + writeRemoveMethod(writer, removeMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: asyncMethod + List asyncMethod = singletonBean.asyncMethod; + if (asyncMethod!= null) { + for (AsyncMethod asyncMethodItem: asyncMethod) { + if (asyncMethodItem!= null) { + writer.writeStartElement(prefix, "async-method", "http://java.sun.com/xml/ns/javaee"); + writeAsyncMethod(writer, asyncMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: transactionType + TransactionType transactionType = singletonBean.transactionType; + if (transactionType!= null) { + writer.writeStartElement(prefix, "transaction-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringTransactionType(singletonBean, null, context, transactionType)); + writer.writeEndElement(); + } + + // ELEMENT: afterBeginMethod + NamedMethod afterBeginMethod = null; + try { + afterBeginMethod = singletonBean.getAfterBeginMethod(); + } catch (Exception e) { + context.getterError(singletonBean, "afterBeginMethod", SessionBean.class, "getAfterBeginMethod", e); + } + if (afterBeginMethod!= null) { + writer.writeStartElement(prefix, "after-begin-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, afterBeginMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: beforeCompletionMethod + NamedMethod beforeCompletionMethod = null; + try { + beforeCompletionMethod = singletonBean.getBeforeCompletionMethod(); + } catch (Exception e) { + context.getterError(singletonBean, "beforeCompletionMethod", SessionBean.class, "getBeforeCompletionMethod", e); + } + if (beforeCompletionMethod!= null) { + writer.writeStartElement(prefix, "before-completion-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, beforeCompletionMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: afterCompletionMethod + NamedMethod afterCompletionMethod = null; + try { + afterCompletionMethod = singletonBean.getAfterCompletionMethod(); + } catch (Exception e) { + context.getterError(singletonBean, "afterCompletionMethod", SessionBean.class, "getAfterCompletionMethod", e); + } + if (afterCompletionMethod!= null) { + writer.writeStartElement(prefix, "after-completion-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, afterCompletionMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: aroundInvoke + List aroundInvoke = singletonBean.aroundInvoke; + if (aroundInvoke!= null) { + for (AroundInvoke aroundInvokeItem: aroundInvoke) { + if (aroundInvokeItem!= null) { + writer.writeStartElement(prefix, "around-invoke", "http://java.sun.com/xml/ns/javaee"); + writeAroundInvoke(writer, aroundInvokeItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(singletonBean, "aroundInvoke"); + } + } + } + + // ELEMENT: aroundTimeout + List aroundTimeout = singletonBean.aroundTimeout; + if (aroundTimeout!= null) { + for (AroundTimeout aroundTimeoutItem: aroundTimeout) { + if (aroundTimeoutItem!= null) { + writer.writeStartElement(prefix, "around-timeout", "http://java.sun.com/xml/ns/javaee"); + writeAroundTimeout(writer, aroundTimeoutItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: envEntry + KeyedCollection envEntry = singletonBean.envEntry; + if (envEntry!= null) { + for (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(singletonBean, "envEntry"); + } + } + } + + // ELEMENT: ejbRef + KeyedCollection ejbRef = singletonBean.ejbRef; + if (ejbRef!= null) { + for (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(singletonBean, "ejbRef"); + } + } + } + + // ELEMENT: ejbLocalRef + KeyedCollection ejbLocalRef = singletonBean.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(singletonBean, "ejbLocalRef"); + } + } + } + + // ELEMENT: serviceRef + KeyedCollection serviceRef = singletonBean.serviceRef; + if (serviceRef!= null) { + for (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(singletonBean, "serviceRef"); + } + } + } + + // ELEMENT: resourceRef + KeyedCollection resourceRef = singletonBean.resourceRef; + if (resourceRef!= null) { + for (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(singletonBean, "resourceRef"); + } + } + } + + // ELEMENT: resourceEnvRef + KeyedCollection resourceEnvRef = singletonBean.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(singletonBean, "resourceEnvRef"); + } + } + } + + // ELEMENT: messageDestinationRef + KeyedCollection messageDestinationRef = singletonBean.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(singletonBean, "messageDestinationRef"); + } + } + } + + // ELEMENT: persistenceContextRef + KeyedCollection persistenceContextRef = singletonBean.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(singletonBean, "persistenceContextRef"); + } + } + } + + // ELEMENT: persistenceUnitRef + KeyedCollection persistenceUnitRef = singletonBean.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(singletonBean, "persistenceUnitRef"); + } + } + } + + // ELEMENT: postConstruct + List postConstruct = singletonBean.postConstruct; + if (postConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback postConstructItem: postConstruct) { + if (postConstructItem!= null) { + writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, postConstructItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(singletonBean, "postConstruct"); + } + } + } + + // ELEMENT: preDestroy + List preDestroy = singletonBean.preDestroy; + if (preDestroy!= null) { + for (org.apache.openejb.jee.LifecycleCallback preDestroyItem: preDestroy) { + if (preDestroyItem!= null) { + writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, preDestroyItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(singletonBean, "preDestroy"); + } + } + } + + // ELEMENT: dataSource + KeyedCollection dataSource = singletonBean.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { + writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); + writeDataSource(writer, dataSourceItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = singletonBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(singletonBean, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = singletonBean.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: postActivate + List postActivate = singletonBean.postActivate; + if (postActivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback postActivateItem: postActivate) { + if (postActivateItem!= null) { + writer.writeStartElement(prefix, "post-activate", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, postActivateItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(singletonBean, "postActivate"); + } + } + } + + // ELEMENT: prePassivate + List prePassivate = singletonBean.prePassivate; + if (prePassivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback prePassivateItem: prePassivate) { + if (prePassivateItem!= null) { + writer.writeStartElement(prefix, "pre-passivate", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, prePassivateItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(singletonBean, "prePassivate"); + } + } + } + + // ELEMENT: securityRoleRef + List securityRoleRef = singletonBean.securityRoleRef; + if (securityRoleRef!= null) { + for (SecurityRoleRef securityRoleRefItem: securityRoleRef) { + if (securityRoleRefItem!= null) { + writer.writeStartElement(prefix, "security-role-ref", "http://java.sun.com/xml/ns/javaee"); + writeSecurityRoleRef(writer, securityRoleRefItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(singletonBean, "securityRoleRef"); + } + } + } + + // ELEMENT: securityIdentity + SecurityIdentity securityIdentity = singletonBean.securityIdentity; + if (securityIdentity!= null) { + writer.writeStartElement(prefix, "security-identity", "http://java.sun.com/xml/ns/javaee"); + writeSecurityIdentity(writer, securityIdentity, context); + writer.writeEndElement(); + } + + // ELEMENT: passivationCapable + Boolean passivationCapable = singletonBean.passivationCapable; + if (passivationCapable!= null) { + writer.writeStartElement(prefix, "passivation-capable", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Boolean.toString(passivationCapable)); + writer.writeEndElement(); + } + + // ELEMENT: contextService + KeyedCollection contextService = singletonBean.contextService; + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + + context.afterMarshal(singletonBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/StatefulBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/StatefulBean$JAXB.java new file mode 100644 index 00000000000..a53e0063849 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/StatefulBean$JAXB.java @@ -0,0 +1,1586 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.AroundInvoke$JAXB.readAroundInvoke; +import static org.apache.openejb.jee.AroundInvoke$JAXB.writeAroundInvoke; +import static org.apache.openejb.jee.AroundTimeout$JAXB.readAroundTimeout; +import static org.apache.openejb.jee.AroundTimeout$JAXB.writeAroundTimeout; +import static org.apache.openejb.jee.AsyncMethod$JAXB.readAsyncMethod; +import static org.apache.openejb.jee.AsyncMethod$JAXB.writeAsyncMethod; +import static org.apache.openejb.jee.ConcurrencyManagementType$JAXB.parseConcurrencyManagementType; +import static org.apache.openejb.jee.ConcurrencyManagementType$JAXB.toStringConcurrencyManagementType; +import static org.apache.openejb.jee.ConcurrentMethod$JAXB.readConcurrentMethod; +import static org.apache.openejb.jee.ConcurrentMethod$JAXB.writeConcurrentMethod; +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; +import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; +import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; +import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; +import static org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef; +import static org.apache.openejb.jee.EjbRef$JAXB.readEjbRef; +import static org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef; +import static org.apache.openejb.jee.Empty$JAXB.readEmpty; +import static org.apache.openejb.jee.Empty$JAXB.writeEmpty; +import static org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry; +import static org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry; +import static org.apache.openejb.jee.Icon$JAXB.readIcon; +import static org.apache.openejb.jee.Icon$JAXB.writeIcon; +import static org.apache.openejb.jee.InitMethod$JAXB.readInitMethod; +import static org.apache.openejb.jee.InitMethod$JAXB.writeInitMethod; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; +import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; +import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback; +import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef; +import static org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef; +import static org.apache.openejb.jee.NamedMethod$JAXB.readNamedMethod; +import static org.apache.openejb.jee.NamedMethod$JAXB.writeNamedMethod; +import static org.apache.openejb.jee.PersistenceContextRef$JAXB.readPersistenceContextRef; +import static org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef; +import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.readPersistenceUnitRef; +import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.writePersistenceUnitRef; +import static org.apache.openejb.jee.RemoveMethod$JAXB.readRemoveMethod; +import static org.apache.openejb.jee.RemoveMethod$JAXB.writeRemoveMethod; +import static org.apache.openejb.jee.ResourceEnvRef$JAXB.readResourceEnvRef; +import static org.apache.openejb.jee.ResourceEnvRef$JAXB.writeResourceEnvRef; +import static org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef; +import static org.apache.openejb.jee.ResourceRef$JAXB.writeResourceRef; +import static org.apache.openejb.jee.SecurityIdentity$JAXB.readSecurityIdentity; +import static org.apache.openejb.jee.SecurityIdentity$JAXB.writeSecurityIdentity; +import static org.apache.openejb.jee.SecurityRoleRef$JAXB.readSecurityRoleRef; +import static org.apache.openejb.jee.SecurityRoleRef$JAXB.writeSecurityRoleRef; +import static org.apache.openejb.jee.ServiceRef$JAXB.readServiceRef; +import static org.apache.openejb.jee.ServiceRef$JAXB.writeServiceRef; +import static org.apache.openejb.jee.SessionType$JAXB.parseSessionType; +import static org.apache.openejb.jee.SessionType$JAXB.toStringSessionType; +import static org.apache.openejb.jee.Text$JAXB.readText; +import static org.apache.openejb.jee.Text$JAXB.writeText; +import static org.apache.openejb.jee.Timeout$JAXB.readTimeout; +import static org.apache.openejb.jee.Timeout$JAXB.writeTimeout; +import static org.apache.openejb.jee.Timer$JAXB.readTimer; +import static org.apache.openejb.jee.Timer$JAXB.writeTimer; +import static org.apache.openejb.jee.TransactionType$JAXB.parseTransactionType; +import static org.apache.openejb.jee.TransactionType$JAXB.toStringTransactionType; + +@SuppressWarnings({ + "StringEquality" +}) +public class StatefulBean$JAXB + extends JAXBObject +{ + + + public StatefulBean$JAXB() { + super(StatefulBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "statefulBean".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, SessionType$JAXB.class, Timeout$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, ConcurrencyManagementType$JAXB.class, ConcurrentMethod$JAXB.class, InitMethod$JAXB.class, RemoveMethod$JAXB.class, AsyncMethod$JAXB.class, TransactionType$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, ContextService$JAXB.class); + } + + public static StatefulBean readStatefulBean(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeStatefulBean(XoXMLStreamWriter writer, StatefulBean statefulBean, RuntimeContext context) + throws Exception + { + _write(writer, statefulBean, context); + } + + public void write(XoXMLStreamWriter writer, StatefulBean statefulBean, RuntimeContext context) + throws Exception + { + _write(writer, statefulBean, context); + } + + public static final StatefulBean _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + StatefulBean statefulBean = new StatefulBean(); + context.beforeUnmarshal(statefulBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + ArrayList descriptions = null; + ArrayList displayNames = null; + LocalCollection icon = null; + LinkedHashSet businessLocal = null; + LinkedHashSet businessRemote = null; + List timer = null; + List concurrentMethod = null; + List initMethod = null; + List removeMethod = null; + List asyncMethod = null; + List aroundInvoke = null; + List aroundTimeout = null; + KeyedCollection envEntry = null; + KeyedCollection ejbRef = null; + KeyedCollection ejbLocalRef = null; + KeyedCollection serviceRef = null; + KeyedCollection resourceRef = null; + KeyedCollection resourceEnvRef = null; + KeyedCollection messageDestinationRef = null; + KeyedCollection persistenceContextRef = null; + KeyedCollection persistenceUnitRef = null; + List postConstruct = null; + List preDestroy = null; + KeyedCollection dataSource = null; + KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; + List postActivate = null; + List prePassivate = null; + List securityRoleRef = null; + KeyedCollection contextService = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("statefulBean"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, StatefulBean.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, statefulBean); + statefulBean.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 (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: descriptions + Text descriptionsItem = readText(elementReader, context); + if (descriptions == null) { + descriptions = new ArrayList<>(); + } + descriptions.add(descriptionsItem); + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: displayNames + Text displayNamesItem = readText(elementReader, context); + if (displayNames == null) { + displayNames = new ArrayList<>(); + } + displayNames.add(displayNamesItem); + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: icon + Icon iconItem = readIcon(elementReader, context); + if (icon == null) { + icon = statefulBean.icon; + if (icon!= null) { + icon.clear(); + } else { + icon = new LocalCollection<>(); + } + } + icon.add(iconItem); + } else if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbName + String ejbNameRaw = elementReader.getElementText(); + + String ejbName; + try { + ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statefulBean.ejbName = ejbName; + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: mappedName + String mappedNameRaw = elementReader.getElementText(); + + String mappedName; + try { + mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statefulBean.mappedName = mappedName; + } else if (("home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: home + String homeRaw = elementReader.getElementText(); + + String home; + try { + home = Adapters.collapsedStringAdapterAdapter.unmarshal(homeRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statefulBean.home = home; + } else if (("remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: remote + String remoteRaw = elementReader.getElementText(); + + String remote; + try { + remote = Adapters.collapsedStringAdapterAdapter.unmarshal(remoteRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statefulBean.remote = remote; + } else if (("local-home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: localHome + String localHomeRaw = elementReader.getElementText(); + + String localHome; + try { + localHome = Adapters.collapsedStringAdapterAdapter.unmarshal(localHomeRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statefulBean.localHome = localHome; + } else if (("local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: local + String localRaw = elementReader.getElementText(); + + String local; + try { + local = Adapters.collapsedStringAdapterAdapter.unmarshal(localRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statefulBean.local = local; + } else if (("business-local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: businessLocal + String businessLocalItemRaw = elementReader.getElementText(); + + String businessLocalItem; + try { + businessLocalItem = Adapters.collapsedStringAdapterAdapter.unmarshal(businessLocalItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (businessLocal == null) { + businessLocal = statefulBean.businessLocal; + if (businessLocal!= null) { + businessLocal.clear(); + } else { + businessLocal = new LinkedHashSet<>(); + } + } + businessLocal.add(businessLocalItem); + } else if (("business-remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: businessRemote + String businessRemoteItemRaw = elementReader.getElementText(); + + String businessRemoteItem; + try { + businessRemoteItem = Adapters.collapsedStringAdapterAdapter.unmarshal(businessRemoteItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (businessRemote == null) { + businessRemote = statefulBean.businessRemote; + if (businessRemote!= null) { + businessRemote.clear(); + } else { + businessRemote = new LinkedHashSet<>(); + } + } + businessRemote.add(businessRemoteItem); + } else if (("local-bean" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: localBean + Empty localBean = readEmpty(elementReader, context); + statefulBean.localBean = localBean; + } else if (("service-endpoint" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: serviceEndpoint + String serviceEndpointRaw = elementReader.getElementText(); + + String serviceEndpoint; + try { + serviceEndpoint = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceEndpointRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statefulBean.serviceEndpoint = serviceEndpoint; + } else if (("ejb-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbClass + String ejbClassRaw = elementReader.getElementText(); + + String ejbClass; + try { + ejbClass = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClassRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statefulBean.ejbClass = ejbClass; + } else if (("session-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: sessionType + SessionType sessionType = parseSessionType(elementReader, context, elementReader.getElementText()); + if (sessionType!= null) { + statefulBean.sessionType = sessionType; + } + } else if (("stateful-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: statefulTimeout + Timeout statefulTimeout = readTimeout(elementReader, context); + statefulBean.statefulTimeout = statefulTimeout; + } else if (("timeout-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: timeoutMethod + NamedMethod timeoutMethod = readNamedMethod(elementReader, context); + statefulBean.timeoutMethod = timeoutMethod; + } else if (("timer" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: timer + Timer timerItem = readTimer(elementReader, context); + if (timer == null) { + timer = statefulBean.timer; + if (timer!= null) { + timer.clear(); + } else { + timer = new ArrayList<>(); + } + } + timer.add(timerItem); + } else if (("init-on-startup" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: initOnStartup + Boolean initOnStartup = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + statefulBean.initOnStartup = initOnStartup; + } else if (("concurrency-management-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: concurrencyManagementType + ConcurrencyManagementType concurrencyManagementType = parseConcurrencyManagementType(elementReader, context, elementReader.getElementText()); + if (concurrencyManagementType!= null) { + statefulBean.concurrencyManagementType = concurrencyManagementType; + } + } else if (("concurrent-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: concurrentMethod + ConcurrentMethod concurrentMethodItem = readConcurrentMethod(elementReader, context); + if (concurrentMethod == null) { + concurrentMethod = statefulBean.concurrentMethod; + if (concurrentMethod!= null) { + concurrentMethod.clear(); + } else { + concurrentMethod = new ArrayList<>(); + } + } + concurrentMethod.add(concurrentMethodItem); + } else if (("depends-on" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT WRAPPER: dependsOn + _readDependsOn(elementReader, context, statefulBean); + } else if (("init-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: initMethod + InitMethod initMethodItem = readInitMethod(elementReader, context); + if (initMethod == null) { + initMethod = statefulBean.initMethod; + if (initMethod!= null) { + initMethod.clear(); + } else { + initMethod = new ArrayList<>(); + } + } + initMethod.add(initMethodItem); + } else if (("remove-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: removeMethod + RemoveMethod removeMethodItem = readRemoveMethod(elementReader, context); + if (removeMethod == null) { + removeMethod = statefulBean.removeMethod; + if (removeMethod!= null) { + removeMethod.clear(); + } else { + removeMethod = new ArrayList<>(); + } + } + removeMethod.add(removeMethodItem); + } else if (("async-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: asyncMethod + AsyncMethod asyncMethodItem = readAsyncMethod(elementReader, context); + if (asyncMethod == null) { + asyncMethod = statefulBean.asyncMethod; + if (asyncMethod!= null) { + asyncMethod.clear(); + } else { + asyncMethod = new ArrayList<>(); + } + } + asyncMethod.add(asyncMethodItem); + } else if (("transaction-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: transactionType + TransactionType transactionType = parseTransactionType(elementReader, context, elementReader.getElementText()); + if (transactionType!= null) { + statefulBean.transactionType = transactionType; + } + } else if (("after-begin-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: afterBeginMethod + NamedMethod afterBeginMethod = readNamedMethod(elementReader, context); + try { + statefulBean.setAfterBeginMethod(afterBeginMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setAfterBeginMethod", NamedMethod.class, e); + } + } else if (("before-completion-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: beforeCompletionMethod + NamedMethod beforeCompletionMethod = readNamedMethod(elementReader, context); + try { + statefulBean.setBeforeCompletionMethod(beforeCompletionMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setBeforeCompletionMethod", NamedMethod.class, e); + } + } else if (("after-completion-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: afterCompletionMethod + NamedMethod afterCompletionMethod = readNamedMethod(elementReader, context); + try { + statefulBean.setAfterCompletionMethod(afterCompletionMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setAfterCompletionMethod", NamedMethod.class, e); + } + } else if (("around-invoke" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: aroundInvoke + AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context); + if (aroundInvoke == null) { + aroundInvoke = statefulBean.aroundInvoke; + if (aroundInvoke!= null) { + aroundInvoke.clear(); + } else { + aroundInvoke = new ArrayList<>(); + } + } + aroundInvoke.add(aroundInvokeItem); + } else if (("around-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: aroundTimeout + AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context); + if (aroundTimeout == null) { + aroundTimeout = statefulBean.aroundTimeout; + if (aroundTimeout!= null) { + aroundTimeout.clear(); + } else { + aroundTimeout = new ArrayList<>(); + } + } + aroundTimeout.add(aroundTimeoutItem); + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: envEntry + EnvEntry envEntryItem = readEnvEntry(elementReader, context); + if (envEntry == null) { + envEntry = statefulBean.envEntry; + if (envEntry!= null) { + envEntry.clear(); + } else { + envEntry = new KeyedCollection<>(); + } + } + envEntry.add(envEntryItem); + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbRef + EjbRef ejbRefItem = readEjbRef(elementReader, context); + if (ejbRef == null) { + ejbRef = statefulBean.ejbRef; + if (ejbRef!= null) { + ejbRef.clear(); + } else { + ejbRef = new KeyedCollection<>(); + } + } + ejbRef.add(ejbRefItem); + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbLocalRef + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + if (ejbLocalRef == null) { + ejbLocalRef = statefulBean.ejbLocalRef; + if (ejbLocalRef!= null) { + ejbLocalRef.clear(); + } else { + ejbLocalRef = new KeyedCollection<>(); + } + } + ejbLocalRef.add(ejbLocalRefItem); + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: serviceRef + ServiceRef serviceRefItem = readServiceRef(elementReader, context); + if (serviceRef == null) { + serviceRef = statefulBean.serviceRef; + if (serviceRef!= null) { + serviceRef.clear(); + } else { + serviceRef = new KeyedCollection<>(); + } + } + serviceRef.add(serviceRefItem); + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceRef + ResourceRef resourceRefItem = readResourceRef(elementReader, context); + if (resourceRef == null) { + resourceRef = statefulBean.resourceRef; + if (resourceRef!= null) { + resourceRef.clear(); + } else { + resourceRef = new KeyedCollection<>(); + } + } + resourceRef.add(resourceRefItem); + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceEnvRef + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + if (resourceEnvRef == null) { + resourceEnvRef = statefulBean.resourceEnvRef; + if (resourceEnvRef!= null) { + resourceEnvRef.clear(); + } else { + resourceEnvRef = new KeyedCollection<>(); + } + } + resourceEnvRef.add(resourceEnvRefItem); + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: messageDestinationRef + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + if (messageDestinationRef == null) { + messageDestinationRef = statefulBean.messageDestinationRef; + if (messageDestinationRef!= null) { + messageDestinationRef.clear(); + } else { + messageDestinationRef = new KeyedCollection<>(); + } + } + messageDestinationRef.add(messageDestinationRefItem); + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: persistenceContextRef + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + if (persistenceContextRef == null) { + persistenceContextRef = statefulBean.persistenceContextRef; + if (persistenceContextRef!= null) { + persistenceContextRef.clear(); + } else { + persistenceContextRef = new KeyedCollection<>(); + } + } + persistenceContextRef.add(persistenceContextRefItem); + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: persistenceUnitRef + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + if (persistenceUnitRef == null) { + persistenceUnitRef = statefulBean.persistenceUnitRef; + if (persistenceUnitRef!= null) { + persistenceUnitRef.clear(); + } else { + persistenceUnitRef = new KeyedCollection<>(); + } + } + persistenceUnitRef.add(persistenceUnitRefItem); + } else if (("post-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: postConstruct + org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); + if (postConstruct == null) { + postConstruct = statefulBean.postConstruct; + if (postConstruct!= null) { + postConstruct.clear(); + } else { + postConstruct = new ArrayList<>(); + } + } + postConstruct.add(postConstructItem); + } else if (("pre-destroy" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: preDestroy + org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); + if (preDestroy == null) { + preDestroy = statefulBean.preDestroy; + if (preDestroy!= null) { + preDestroy.clear(); + } else { + preDestroy = new ArrayList<>(); + } + } + preDestroy.add(preDestroyItem); + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: dataSource + DataSource dataSourceItem = readDataSource(elementReader, context); + if (dataSource == null) { + dataSource = statefulBean.dataSource; + if (dataSource!= null) { + dataSource.clear(); + } else { + dataSource = new KeyedCollection<>(); + } + } + dataSource.add(dataSourceItem); + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); + if (jmsConnectionFactories == null) { + jmsConnectionFactories = statefulBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + jmsConnectionFactories.clear(); + } else { + jmsConnectionFactories = new KeyedCollection<>(); + } + } + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = statefulBean.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("post-activate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: postActivate + org.apache.openejb.jee.LifecycleCallback postActivateItem = readLifecycleCallback(elementReader, context); + if (postActivate == null) { + postActivate = statefulBean.postActivate; + if (postActivate!= null) { + postActivate.clear(); + } else { + postActivate = new ArrayList<>(); + } + } + postActivate.add(postActivateItem); + } else if (("pre-passivate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: prePassivate + org.apache.openejb.jee.LifecycleCallback prePassivateItem = readLifecycleCallback(elementReader, context); + if (prePassivate == null) { + prePassivate = statefulBean.prePassivate; + if (prePassivate!= null) { + prePassivate.clear(); + } else { + prePassivate = new ArrayList<>(); + } + } + prePassivate.add(prePassivateItem); + } else if (("security-role-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: securityRoleRef + SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); + if (securityRoleRef == null) { + securityRoleRef = statefulBean.securityRoleRef; + if (securityRoleRef!= null) { + securityRoleRef.clear(); + } else { + securityRoleRef = new ArrayList<>(); + } + } + securityRoleRef.add(securityRoleRefItem); + } else if (("security-identity" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: securityIdentity + SecurityIdentity securityIdentity = readSecurityIdentity(elementReader, context); + statefulBean.securityIdentity = securityIdentity; + } else if (("passivation-capable" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: passivationCapable + Boolean passivationCapable = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + statefulBean.passivationCapable = passivationCapable; + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = statefulBean.contextService; + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } + } + contextService.add(contextServiceItem); + } 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", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "home"), new QName("http://java.sun.com/xml/ns/javaee", "remote"), 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", "business-local"), new QName("http://java.sun.com/xml/ns/javaee", "business-remote"), new QName("http://java.sun.com/xml/ns/javaee", "local-bean"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-class"), new QName("http://java.sun.com/xml/ns/javaee", "session-type"), new QName("http://java.sun.com/xml/ns/javaee", "stateful-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"), new QName("http://java.sun.com/xml/ns/javaee", "timer"), new QName("http://java.sun.com/xml/ns/javaee", "init-on-startup"), new QName("http://java.sun.com/xml/ns/javaee", "concurrency-management-type"), new QName("http://java.sun.com/xml/ns/javaee", "concurrent-method"), new QName("http://java.sun.com/xml/ns/javaee", "depends-on"), new QName("http://java.sun.com/xml/ns/javaee", "init-method"), new QName("http://java.sun.com/xml/ns/javaee", "remove-method"), new QName("http://java.sun.com/xml/ns/javaee", "async-method"), new QName("http://java.sun.com/xml/ns/javaee", "transaction-type"), new QName("http://java.sun.com/xml/ns/javaee", "after-begin-method"), new QName("http://java.sun.com/xml/ns/javaee", "before-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "after-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "post-activate"), new QName("http://java.sun.com/xml/ns/javaee", "pre-passivate"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "security-identity"), new QName("http://java.sun.com/xml/ns/javaee", "passivation-capable"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); + } + } + if (descriptions!= null) { + try { + statefulBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setDescriptions", Text[].class, e); + } + } + if (displayNames!= null) { + try { + statefulBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setDisplayNames", Text[].class, e); + } + } + if (icon!= null) { + statefulBean.icon = icon; + } + if (businessLocal!= null) { + statefulBean.businessLocal = businessLocal; + } + if (businessRemote!= null) { + statefulBean.businessRemote = businessRemote; + } + if (timer!= null) { + statefulBean.timer = timer; + } + if (concurrentMethod!= null) { + statefulBean.concurrentMethod = concurrentMethod; + } + if (initMethod!= null) { + statefulBean.initMethod = initMethod; + } + if (removeMethod!= null) { + statefulBean.removeMethod = removeMethod; + } + if (asyncMethod!= null) { + statefulBean.asyncMethod = asyncMethod; + } + if (aroundInvoke!= null) { + statefulBean.aroundInvoke = aroundInvoke; + } + if (aroundTimeout!= null) { + statefulBean.aroundTimeout = aroundTimeout; + } + if (envEntry!= null) { + statefulBean.envEntry = envEntry; + } + if (ejbRef!= null) { + statefulBean.ejbRef = ejbRef; + } + if (ejbLocalRef!= null) { + statefulBean.ejbLocalRef = ejbLocalRef; + } + if (serviceRef!= null) { + statefulBean.serviceRef = serviceRef; + } + if (resourceRef!= null) { + statefulBean.resourceRef = resourceRef; + } + if (resourceEnvRef!= null) { + statefulBean.resourceEnvRef = resourceEnvRef; + } + if (messageDestinationRef!= null) { + statefulBean.messageDestinationRef = messageDestinationRef; + } + if (persistenceContextRef!= null) { + statefulBean.persistenceContextRef = persistenceContextRef; + } + if (persistenceUnitRef!= null) { + statefulBean.persistenceUnitRef = persistenceUnitRef; + } + if (postConstruct!= null) { + statefulBean.postConstruct = postConstruct; + } + if (preDestroy!= null) { + statefulBean.preDestroy = preDestroy; + } + if (dataSource!= null) { + statefulBean.dataSource = dataSource; + } + if (jmsConnectionFactories!= null) { + statefulBean.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + statefulBean.jmsDestinations = jmsDestinations; + } + if (postActivate!= null) { + statefulBean.postActivate = postActivate; + } + if (prePassivate!= null) { + statefulBean.prePassivate = prePassivate; + } + if (securityRoleRef!= null) { + statefulBean.securityRoleRef = securityRoleRef; + } + if (contextService!= null) { + statefulBean.contextService = contextService; + } + + context.afterUnmarshal(statefulBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + return statefulBean; + } + + public final StatefulBean read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _readDependsOn(XoXMLStreamReader reader, RuntimeContext context, StatefulBean statefulBean) + throws Exception + { + List dependsOn = null; + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: dependsOn + String dependsOnItemRaw = elementReader.getElementText(); + + String dependsOnItem; + try { + dependsOnItem = Adapters.collapsedStringAdapterAdapter.unmarshal(dependsOnItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (dependsOn == null) { + dependsOn = statefulBean.dependsOn; + if (dependsOn!= null) { + dependsOn.clear(); + } else { + dependsOn = new ArrayList<>(); + } + } + dependsOn.add(dependsOnItem); + } + } + if (dependsOn!= null) { + statefulBean.dependsOn = dependsOn; + } + } + + public static final void _write(XoXMLStreamWriter writer, StatefulBean statefulBean, RuntimeContext context) + throws Exception + { + if (statefulBean == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (StatefulBean.class!= statefulBean.getClass()) { + context.unexpectedSubclass(writer, statefulBean, StatefulBean.class); + return ; + } + + context.beforeMarshal(statefulBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = statefulBean.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: descriptions + Text[] descriptions = null; + try { + descriptions = statefulBean.getDescriptions(); + } catch (Exception e) { + context.getterError(statefulBean, "descriptions", SessionBean.class, "getDescriptions", e); + } + if (descriptions!= null) { + for (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(statefulBean, "descriptions"); + } + } + } + + // ELEMENT: displayNames + Text[] displayNames = null; + try { + displayNames = statefulBean.getDisplayNames(); + } catch (Exception e) { + context.getterError(statefulBean, "displayNames", SessionBean.class, "getDisplayNames", e); + } + if (displayNames!= null) { + for (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(statefulBean, "displayNames"); + } + } + } + + // ELEMENT: icon + LocalCollection icon = statefulBean.icon; + if (icon!= null) { + for (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(statefulBean, "icon"); + } + } + } + + // ELEMENT: ejbName + String ejbNameRaw = statefulBean.ejbName; + String ejbName = null; + try { + ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (ejbName!= null) { + writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(ejbName); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statefulBean, "ejbName"); + } + + // ELEMENT: mappedName + String mappedNameRaw = statefulBean.mappedName; + String mappedName = null; + try { + mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "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: home + String homeRaw = statefulBean.home; + String home = null; + try { + home = Adapters.collapsedStringAdapterAdapter.marshal(homeRaw); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "home", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (home!= null) { + writer.writeStartElement(prefix, "home", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(home); + writer.writeEndElement(); + } + + // ELEMENT: remote + String remoteRaw = statefulBean.remote; + String remote = null; + try { + remote = Adapters.collapsedStringAdapterAdapter.marshal(remoteRaw); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "remote", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (remote!= null) { + writer.writeStartElement(prefix, "remote", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(remote); + writer.writeEndElement(); + } + + // ELEMENT: localHome + String localHomeRaw = statefulBean.localHome; + String localHome = null; + try { + localHome = Adapters.collapsedStringAdapterAdapter.marshal(localHomeRaw); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "localHome", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (localHome!= null) { + writer.writeStartElement(prefix, "local-home", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(localHome); + writer.writeEndElement(); + } + + // ELEMENT: local + String localRaw = statefulBean.local; + String local = null; + try { + local = Adapters.collapsedStringAdapterAdapter.marshal(localRaw); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "local", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (local!= null) { + writer.writeStartElement(prefix, "local", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(local); + writer.writeEndElement(); + } + + // ELEMENT: businessLocal + LinkedHashSet businessLocalRaw = statefulBean.businessLocal; + if (businessLocalRaw!= null) { + for (String businessLocalItem: businessLocalRaw) { + String businessLocal = null; + try { + businessLocal = Adapters.collapsedStringAdapterAdapter.marshal(businessLocalItem); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "businessLocal", CollapsedStringAdapter.class, LinkedHashSet.class, LinkedHashSet.class, e); + } + if (businessLocal!= null) { + writer.writeStartElement(prefix, "business-local", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(businessLocal); + writer.writeEndElement(); + } + } + } + + // ELEMENT: businessRemote + LinkedHashSet businessRemoteRaw = statefulBean.businessRemote; + if (businessRemoteRaw!= null) { + for (String businessRemoteItem: businessRemoteRaw) { + String businessRemote = null; + try { + businessRemote = Adapters.collapsedStringAdapterAdapter.marshal(businessRemoteItem); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "businessRemote", CollapsedStringAdapter.class, LinkedHashSet.class, LinkedHashSet.class, e); + } + if (businessRemote!= null) { + writer.writeStartElement(prefix, "business-remote", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(businessRemote); + writer.writeEndElement(); + } + } + } + + // ELEMENT: localBean + Empty localBean = statefulBean.localBean; + if (localBean!= null) { + writer.writeStartElement(prefix, "local-bean", "http://java.sun.com/xml/ns/javaee"); + writeEmpty(writer, localBean, context); + writer.writeEndElement(); + } + + // ELEMENT: serviceEndpoint + String serviceEndpointRaw = statefulBean.serviceEndpoint; + String serviceEndpoint = null; + try { + serviceEndpoint = Adapters.collapsedStringAdapterAdapter.marshal(serviceEndpointRaw); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "serviceEndpoint", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (serviceEndpoint!= null) { + writer.writeStartElement(prefix, "service-endpoint", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(serviceEndpoint); + writer.writeEndElement(); + } + + // ELEMENT: ejbClass + String ejbClassRaw = statefulBean.ejbClass; + String ejbClass = null; + try { + ejbClass = Adapters.collapsedStringAdapterAdapter.marshal(ejbClassRaw); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "ejbClass", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (ejbClass!= null) { + writer.writeStartElement(prefix, "ejb-class", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(ejbClass); + writer.writeEndElement(); + } + + // ELEMENT: sessionType + SessionType sessionType = statefulBean.sessionType; + if (sessionType!= null) { + writer.writeStartElement(prefix, "session-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringSessionType(statefulBean, null, context, sessionType)); + writer.writeEndElement(); + } + + // ELEMENT: statefulTimeout + Timeout statefulTimeout = statefulBean.statefulTimeout; + if (statefulTimeout!= null) { + writer.writeStartElement(prefix, "stateful-timeout", "http://java.sun.com/xml/ns/javaee"); + writeTimeout(writer, statefulTimeout, context); + writer.writeEndElement(); + } + + // ELEMENT: timeoutMethod + NamedMethod timeoutMethod = statefulBean.timeoutMethod; + if (timeoutMethod!= null) { + writer.writeStartElement(prefix, "timeout-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, timeoutMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: timer + List timer = statefulBean.timer; + if (timer!= null) { + for (Timer timerItem: timer) { + if (timerItem!= null) { + writer.writeStartElement(prefix, "timer", "http://java.sun.com/xml/ns/javaee"); + writeTimer(writer, timerItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: initOnStartup + Boolean initOnStartup = statefulBean.initOnStartup; + if (initOnStartup!= null) { + writer.writeStartElement(prefix, "init-on-startup", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Boolean.toString(initOnStartup)); + writer.writeEndElement(); + } + + // ELEMENT: concurrencyManagementType + ConcurrencyManagementType concurrencyManagementType = statefulBean.concurrencyManagementType; + if (concurrencyManagementType!= null) { + writer.writeStartElement(prefix, "concurrency-management-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringConcurrencyManagementType(statefulBean, null, context, concurrencyManagementType)); + writer.writeEndElement(); + } + + // ELEMENT: concurrentMethod + List concurrentMethod = statefulBean.concurrentMethod; + if (concurrentMethod!= null) { + for (ConcurrentMethod concurrentMethodItem: concurrentMethod) { + if (concurrentMethodItem!= null) { + writer.writeStartElement(prefix, "concurrent-method", "http://java.sun.com/xml/ns/javaee"); + writeConcurrentMethod(writer, concurrentMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: dependsOn + List dependsOnRaw = statefulBean.dependsOn; + if (dependsOnRaw!= null) { + writer.writeStartElement(prefix, "depends-on", "http://java.sun.com/xml/ns/javaee"); + for (String dependsOnItem: dependsOnRaw) { + String dependsOn = null; + try { + dependsOn = Adapters.collapsedStringAdapterAdapter.marshal(dependsOnItem); + } catch (Exception e) { + context.xmlAdapterError(statefulBean, "dependsOn", CollapsedStringAdapter.class, List.class, List.class, e); + } + if (dependsOn!= null) { + writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(dependsOn); + writer.writeEndElement(); + } + } + writer.writeEndElement(); + } + + // ELEMENT: initMethod + List initMethod = statefulBean.initMethod; + if (initMethod!= null) { + for (InitMethod initMethodItem: initMethod) { + if (initMethodItem!= null) { + writer.writeStartElement(prefix, "init-method", "http://java.sun.com/xml/ns/javaee"); + writeInitMethod(writer, initMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: removeMethod + List removeMethod = statefulBean.removeMethod; + if (removeMethod!= null) { + for (RemoveMethod removeMethodItem: removeMethod) { + if (removeMethodItem!= null) { + writer.writeStartElement(prefix, "remove-method", "http://java.sun.com/xml/ns/javaee"); + writeRemoveMethod(writer, removeMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: asyncMethod + List asyncMethod = statefulBean.asyncMethod; + if (asyncMethod!= null) { + for (AsyncMethod asyncMethodItem: asyncMethod) { + if (asyncMethodItem!= null) { + writer.writeStartElement(prefix, "async-method", "http://java.sun.com/xml/ns/javaee"); + writeAsyncMethod(writer, asyncMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: transactionType + TransactionType transactionType = statefulBean.transactionType; + if (transactionType!= null) { + writer.writeStartElement(prefix, "transaction-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringTransactionType(statefulBean, null, context, transactionType)); + writer.writeEndElement(); + } + + // ELEMENT: afterBeginMethod + NamedMethod afterBeginMethod = null; + try { + afterBeginMethod = statefulBean.getAfterBeginMethod(); + } catch (Exception e) { + context.getterError(statefulBean, "afterBeginMethod", SessionBean.class, "getAfterBeginMethod", e); + } + if (afterBeginMethod!= null) { + writer.writeStartElement(prefix, "after-begin-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, afterBeginMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: beforeCompletionMethod + NamedMethod beforeCompletionMethod = null; + try { + beforeCompletionMethod = statefulBean.getBeforeCompletionMethod(); + } catch (Exception e) { + context.getterError(statefulBean, "beforeCompletionMethod", SessionBean.class, "getBeforeCompletionMethod", e); + } + if (beforeCompletionMethod!= null) { + writer.writeStartElement(prefix, "before-completion-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, beforeCompletionMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: afterCompletionMethod + NamedMethod afterCompletionMethod = null; + try { + afterCompletionMethod = statefulBean.getAfterCompletionMethod(); + } catch (Exception e) { + context.getterError(statefulBean, "afterCompletionMethod", SessionBean.class, "getAfterCompletionMethod", e); + } + if (afterCompletionMethod!= null) { + writer.writeStartElement(prefix, "after-completion-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, afterCompletionMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: aroundInvoke + List aroundInvoke = statefulBean.aroundInvoke; + if (aroundInvoke!= null) { + for (AroundInvoke aroundInvokeItem: aroundInvoke) { + if (aroundInvokeItem!= null) { + writer.writeStartElement(prefix, "around-invoke", "http://java.sun.com/xml/ns/javaee"); + writeAroundInvoke(writer, aroundInvokeItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statefulBean, "aroundInvoke"); + } + } + } + + // ELEMENT: aroundTimeout + List aroundTimeout = statefulBean.aroundTimeout; + if (aroundTimeout!= null) { + for (AroundTimeout aroundTimeoutItem: aroundTimeout) { + if (aroundTimeoutItem!= null) { + writer.writeStartElement(prefix, "around-timeout", "http://java.sun.com/xml/ns/javaee"); + writeAroundTimeout(writer, aroundTimeoutItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: envEntry + KeyedCollection envEntry = statefulBean.envEntry; + if (envEntry!= null) { + for (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(statefulBean, "envEntry"); + } + } + } + + // ELEMENT: ejbRef + KeyedCollection ejbRef = statefulBean.ejbRef; + if (ejbRef!= null) { + for (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(statefulBean, "ejbRef"); + } + } + } + + // ELEMENT: ejbLocalRef + KeyedCollection ejbLocalRef = statefulBean.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(statefulBean, "ejbLocalRef"); + } + } + } + + // ELEMENT: serviceRef + KeyedCollection serviceRef = statefulBean.serviceRef; + if (serviceRef!= null) { + for (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(statefulBean, "serviceRef"); + } + } + } + + // ELEMENT: resourceRef + KeyedCollection resourceRef = statefulBean.resourceRef; + if (resourceRef!= null) { + for (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(statefulBean, "resourceRef"); + } + } + } + + // ELEMENT: resourceEnvRef + KeyedCollection resourceEnvRef = statefulBean.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(statefulBean, "resourceEnvRef"); + } + } + } + + // ELEMENT: messageDestinationRef + KeyedCollection messageDestinationRef = statefulBean.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(statefulBean, "messageDestinationRef"); + } + } + } + + // ELEMENT: persistenceContextRef + KeyedCollection persistenceContextRef = statefulBean.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(statefulBean, "persistenceContextRef"); + } + } + } + + // ELEMENT: persistenceUnitRef + KeyedCollection persistenceUnitRef = statefulBean.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(statefulBean, "persistenceUnitRef"); + } + } + } + + // ELEMENT: postConstruct + List postConstruct = statefulBean.postConstruct; + if (postConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback postConstructItem: postConstruct) { + if (postConstructItem!= null) { + writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, postConstructItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statefulBean, "postConstruct"); + } + } + } + + // ELEMENT: preDestroy + List preDestroy = statefulBean.preDestroy; + if (preDestroy!= null) { + for (org.apache.openejb.jee.LifecycleCallback preDestroyItem: preDestroy) { + if (preDestroyItem!= null) { + writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, preDestroyItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statefulBean, "preDestroy"); + } + } + } + + // ELEMENT: dataSource + KeyedCollection dataSource = statefulBean.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { + writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); + writeDataSource(writer, dataSourceItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = statefulBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statefulBean, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = statefulBean.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: postActivate + List postActivate = statefulBean.postActivate; + if (postActivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback postActivateItem: postActivate) { + if (postActivateItem!= null) { + writer.writeStartElement(prefix, "post-activate", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, postActivateItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statefulBean, "postActivate"); + } + } + } + + // ELEMENT: prePassivate + List prePassivate = statefulBean.prePassivate; + if (prePassivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback prePassivateItem: prePassivate) { + if (prePassivateItem!= null) { + writer.writeStartElement(prefix, "pre-passivate", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, prePassivateItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statefulBean, "prePassivate"); + } + } + } + + // ELEMENT: securityRoleRef + List securityRoleRef = statefulBean.securityRoleRef; + if (securityRoleRef!= null) { + for (SecurityRoleRef securityRoleRefItem: securityRoleRef) { + if (securityRoleRefItem!= null) { + writer.writeStartElement(prefix, "security-role-ref", "http://java.sun.com/xml/ns/javaee"); + writeSecurityRoleRef(writer, securityRoleRefItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statefulBean, "securityRoleRef"); + } + } + } + + // ELEMENT: securityIdentity + SecurityIdentity securityIdentity = statefulBean.securityIdentity; + if (securityIdentity!= null) { + writer.writeStartElement(prefix, "security-identity", "http://java.sun.com/xml/ns/javaee"); + writeSecurityIdentity(writer, securityIdentity, context); + writer.writeEndElement(); + } + + // ELEMENT: passivationCapable + Boolean passivationCapable = statefulBean.passivationCapable; + if (passivationCapable!= null) { + writer.writeStartElement(prefix, "passivation-capable", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Boolean.toString(passivationCapable)); + writer.writeEndElement(); + } + + // ELEMENT: contextService + KeyedCollection contextService = statefulBean.contextService; + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + + context.afterMarshal(statefulBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/StatelessBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/StatelessBean$JAXB.java new file mode 100644 index 00000000000..cce8b3a5ef8 --- /dev/null +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/StatelessBean$JAXB.java @@ -0,0 +1,1586 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.jee; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import org.metatype.sxc.jaxb.JAXBObject; +import org.metatype.sxc.jaxb.RuntimeContext; +import org.metatype.sxc.util.Attribute; +import org.metatype.sxc.util.XoXMLStreamReader; +import org.metatype.sxc.util.XoXMLStreamWriter; + + +import static org.apache.openejb.jee.AroundInvoke$JAXB.readAroundInvoke; +import static org.apache.openejb.jee.AroundInvoke$JAXB.writeAroundInvoke; +import static org.apache.openejb.jee.AroundTimeout$JAXB.readAroundTimeout; +import static org.apache.openejb.jee.AroundTimeout$JAXB.writeAroundTimeout; +import static org.apache.openejb.jee.AsyncMethod$JAXB.readAsyncMethod; +import static org.apache.openejb.jee.AsyncMethod$JAXB.writeAsyncMethod; +import static org.apache.openejb.jee.ConcurrencyManagementType$JAXB.parseConcurrencyManagementType; +import static org.apache.openejb.jee.ConcurrencyManagementType$JAXB.toStringConcurrencyManagementType; +import static org.apache.openejb.jee.ConcurrentMethod$JAXB.readConcurrentMethod; +import static org.apache.openejb.jee.ConcurrentMethod$JAXB.writeConcurrentMethod; +import static org.apache.openejb.jee.ContextService$JAXB.readContextService; +import static org.apache.openejb.jee.ContextService$JAXB.writeContextService; +import static org.apache.openejb.jee.DataSource$JAXB.readDataSource; +import static org.apache.openejb.jee.DataSource$JAXB.writeDataSource; +import static org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef; +import static org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef; +import static org.apache.openejb.jee.EjbRef$JAXB.readEjbRef; +import static org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef; +import static org.apache.openejb.jee.Empty$JAXB.readEmpty; +import static org.apache.openejb.jee.Empty$JAXB.writeEmpty; +import static org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry; +import static org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry; +import static org.apache.openejb.jee.Icon$JAXB.readIcon; +import static org.apache.openejb.jee.Icon$JAXB.writeIcon; +import static org.apache.openejb.jee.InitMethod$JAXB.readInitMethod; +import static org.apache.openejb.jee.InitMethod$JAXB.writeInitMethod; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.readJMSConnectionFactory; +import static org.apache.openejb.jee.JMSConnectionFactory$JAXB.writeJMSConnectionFactory; +import static org.apache.openejb.jee.JMSDestination$JAXB.readJMSDestination; +import static org.apache.openejb.jee.JMSDestination$JAXB.writeJMSDestination; +import static org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback; +import static org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback; +import static org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef; +import static org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef; +import static org.apache.openejb.jee.NamedMethod$JAXB.readNamedMethod; +import static org.apache.openejb.jee.NamedMethod$JAXB.writeNamedMethod; +import static org.apache.openejb.jee.PersistenceContextRef$JAXB.readPersistenceContextRef; +import static org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef; +import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.readPersistenceUnitRef; +import static org.apache.openejb.jee.PersistenceUnitRef$JAXB.writePersistenceUnitRef; +import static org.apache.openejb.jee.RemoveMethod$JAXB.readRemoveMethod; +import static org.apache.openejb.jee.RemoveMethod$JAXB.writeRemoveMethod; +import static org.apache.openejb.jee.ResourceEnvRef$JAXB.readResourceEnvRef; +import static org.apache.openejb.jee.ResourceEnvRef$JAXB.writeResourceEnvRef; +import static org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef; +import static org.apache.openejb.jee.ResourceRef$JAXB.writeResourceRef; +import static org.apache.openejb.jee.SecurityIdentity$JAXB.readSecurityIdentity; +import static org.apache.openejb.jee.SecurityIdentity$JAXB.writeSecurityIdentity; +import static org.apache.openejb.jee.SecurityRoleRef$JAXB.readSecurityRoleRef; +import static org.apache.openejb.jee.SecurityRoleRef$JAXB.writeSecurityRoleRef; +import static org.apache.openejb.jee.ServiceRef$JAXB.readServiceRef; +import static org.apache.openejb.jee.ServiceRef$JAXB.writeServiceRef; +import static org.apache.openejb.jee.SessionType$JAXB.parseSessionType; +import static org.apache.openejb.jee.SessionType$JAXB.toStringSessionType; +import static org.apache.openejb.jee.Text$JAXB.readText; +import static org.apache.openejb.jee.Text$JAXB.writeText; +import static org.apache.openejb.jee.Timeout$JAXB.readTimeout; +import static org.apache.openejb.jee.Timeout$JAXB.writeTimeout; +import static org.apache.openejb.jee.Timer$JAXB.readTimer; +import static org.apache.openejb.jee.Timer$JAXB.writeTimer; +import static org.apache.openejb.jee.TransactionType$JAXB.parseTransactionType; +import static org.apache.openejb.jee.TransactionType$JAXB.toStringTransactionType; + +@SuppressWarnings({ + "StringEquality" +}) +public class StatelessBean$JAXB + extends JAXBObject +{ + + + public StatelessBean$JAXB() { + super(StatelessBean.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "statelessBean".intern()), Text$JAXB.class, Icon$JAXB.class, Empty$JAXB.class, SessionType$JAXB.class, Timeout$JAXB.class, NamedMethod$JAXB.class, Timer$JAXB.class, ConcurrencyManagementType$JAXB.class, ConcurrentMethod$JAXB.class, InitMethod$JAXB.class, RemoveMethod$JAXB.class, AsyncMethod$JAXB.class, TransactionType$JAXB.class, AroundInvoke$JAXB.class, AroundTimeout$JAXB.class, EnvEntry$JAXB.class, EjbRef$JAXB.class, EjbLocalRef$JAXB.class, ServiceRef$JAXB.class, ResourceRef$JAXB.class, ResourceEnvRef$JAXB.class, MessageDestinationRef$JAXB.class, PersistenceContextRef$JAXB.class, PersistenceUnitRef$JAXB.class, LifecycleCallback$JAXB.class, DataSource$JAXB.class, JMSConnectionFactory$JAXB.class, JMSDestination$JAXB.class, SecurityRoleRef$JAXB.class, SecurityIdentity$JAXB.class, ContextService$JAXB.class); + } + + public static StatelessBean readStatelessBean(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static void writeStatelessBean(XoXMLStreamWriter writer, StatelessBean statelessBean, RuntimeContext context) + throws Exception + { + _write(writer, statelessBean, context); + } + + public void write(XoXMLStreamWriter writer, StatelessBean statelessBean, RuntimeContext context) + throws Exception + { + _write(writer, statelessBean, context); + } + + public static final StatelessBean _read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + + // Check for xsi:nil + if (reader.isXsiNil()) { + return null; + } + + if (context == null) { + context = new RuntimeContext(); + } + + StatelessBean statelessBean = new StatelessBean(); + context.beforeUnmarshal(statelessBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + ArrayList descriptions = null; + ArrayList displayNames = null; + LocalCollection icon = null; + LinkedHashSet businessLocal = null; + LinkedHashSet businessRemote = null; + List timer = null; + List concurrentMethod = null; + List initMethod = null; + List removeMethod = null; + List asyncMethod = null; + List aroundInvoke = null; + List aroundTimeout = null; + KeyedCollection envEntry = null; + KeyedCollection ejbRef = null; + KeyedCollection ejbLocalRef = null; + KeyedCollection serviceRef = null; + KeyedCollection resourceRef = null; + KeyedCollection resourceEnvRef = null; + KeyedCollection messageDestinationRef = null; + KeyedCollection persistenceContextRef = null; + KeyedCollection persistenceUnitRef = null; + List postConstruct = null; + List preDestroy = null; + KeyedCollection dataSource = null; + KeyedCollection jmsConnectionFactories = null; + KeyedCollection jmsDestinations = null; + List postActivate = null; + List prePassivate = null; + List securityRoleRef = null; + KeyedCollection contextService = null; + + // Check xsi:type + QName xsiType = reader.getXsiType(); + if (xsiType!= null) { + if (("statelessBean"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) { + return context.unexpectedXsiType(reader, StatelessBean.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, statelessBean); + statelessBean.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 (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: descriptions + Text descriptionsItem = readText(elementReader, context); + if (descriptions == null) { + descriptions = new ArrayList<>(); + } + descriptions.add(descriptionsItem); + } else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: displayNames + Text displayNamesItem = readText(elementReader, context); + if (displayNames == null) { + displayNames = new ArrayList<>(); + } + displayNames.add(displayNamesItem); + } else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: icon + Icon iconItem = readIcon(elementReader, context); + if (icon == null) { + icon = statelessBean.icon; + if (icon!= null) { + icon.clear(); + } else { + icon = new LocalCollection<>(); + } + } + icon.add(iconItem); + } else if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbName + String ejbNameRaw = elementReader.getElementText(); + + String ejbName; + try { + ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statelessBean.ejbName = ejbName; + } else if (("mapped-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: mappedName + String mappedNameRaw = elementReader.getElementText(); + + String mappedName; + try { + mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statelessBean.mappedName = mappedName; + } else if (("home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: home + String homeRaw = elementReader.getElementText(); + + String home; + try { + home = Adapters.collapsedStringAdapterAdapter.unmarshal(homeRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statelessBean.home = home; + } else if (("remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: remote + String remoteRaw = elementReader.getElementText(); + + String remote; + try { + remote = Adapters.collapsedStringAdapterAdapter.unmarshal(remoteRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statelessBean.remote = remote; + } else if (("local-home" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: localHome + String localHomeRaw = elementReader.getElementText(); + + String localHome; + try { + localHome = Adapters.collapsedStringAdapterAdapter.unmarshal(localHomeRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statelessBean.localHome = localHome; + } else if (("local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: local + String localRaw = elementReader.getElementText(); + + String local; + try { + local = Adapters.collapsedStringAdapterAdapter.unmarshal(localRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statelessBean.local = local; + } else if (("business-local" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: businessLocal + String businessLocalItemRaw = elementReader.getElementText(); + + String businessLocalItem; + try { + businessLocalItem = Adapters.collapsedStringAdapterAdapter.unmarshal(businessLocalItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (businessLocal == null) { + businessLocal = statelessBean.businessLocal; + if (businessLocal!= null) { + businessLocal.clear(); + } else { + businessLocal = new LinkedHashSet<>(); + } + } + businessLocal.add(businessLocalItem); + } else if (("business-remote" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: businessRemote + String businessRemoteItemRaw = elementReader.getElementText(); + + String businessRemoteItem; + try { + businessRemoteItem = Adapters.collapsedStringAdapterAdapter.unmarshal(businessRemoteItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (businessRemote == null) { + businessRemote = statelessBean.businessRemote; + if (businessRemote!= null) { + businessRemote.clear(); + } else { + businessRemote = new LinkedHashSet<>(); + } + } + businessRemote.add(businessRemoteItem); + } else if (("local-bean" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: localBean + Empty localBean = readEmpty(elementReader, context); + statelessBean.localBean = localBean; + } else if (("service-endpoint" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: serviceEndpoint + String serviceEndpointRaw = elementReader.getElementText(); + + String serviceEndpoint; + try { + serviceEndpoint = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceEndpointRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statelessBean.serviceEndpoint = serviceEndpoint; + } else if (("ejb-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbClass + String ejbClassRaw = elementReader.getElementText(); + + String ejbClass; + try { + ejbClass = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbClassRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + statelessBean.ejbClass = ejbClass; + } else if (("session-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: sessionType + SessionType sessionType = parseSessionType(elementReader, context, elementReader.getElementText()); + if (sessionType!= null) { + statelessBean.sessionType = sessionType; + } + } else if (("stateful-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: statefulTimeout + Timeout statefulTimeout = readTimeout(elementReader, context); + statelessBean.statefulTimeout = statefulTimeout; + } else if (("timeout-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: timeoutMethod + NamedMethod timeoutMethod = readNamedMethod(elementReader, context); + statelessBean.timeoutMethod = timeoutMethod; + } else if (("timer" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: timer + Timer timerItem = readTimer(elementReader, context); + if (timer == null) { + timer = statelessBean.timer; + if (timer!= null) { + timer.clear(); + } else { + timer = new ArrayList<>(); + } + } + timer.add(timerItem); + } else if (("init-on-startup" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: initOnStartup + Boolean initOnStartup = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + statelessBean.initOnStartup = initOnStartup; + } else if (("concurrency-management-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: concurrencyManagementType + ConcurrencyManagementType concurrencyManagementType = parseConcurrencyManagementType(elementReader, context, elementReader.getElementText()); + if (concurrencyManagementType!= null) { + statelessBean.concurrencyManagementType = concurrencyManagementType; + } + } else if (("concurrent-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: concurrentMethod + ConcurrentMethod concurrentMethodItem = readConcurrentMethod(elementReader, context); + if (concurrentMethod == null) { + concurrentMethod = statelessBean.concurrentMethod; + if (concurrentMethod!= null) { + concurrentMethod.clear(); + } else { + concurrentMethod = new ArrayList<>(); + } + } + concurrentMethod.add(concurrentMethodItem); + } else if (("depends-on" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT WRAPPER: dependsOn + _readDependsOn(elementReader, context, statelessBean); + } else if (("init-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: initMethod + InitMethod initMethodItem = readInitMethod(elementReader, context); + if (initMethod == null) { + initMethod = statelessBean.initMethod; + if (initMethod!= null) { + initMethod.clear(); + } else { + initMethod = new ArrayList<>(); + } + } + initMethod.add(initMethodItem); + } else if (("remove-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: removeMethod + RemoveMethod removeMethodItem = readRemoveMethod(elementReader, context); + if (removeMethod == null) { + removeMethod = statelessBean.removeMethod; + if (removeMethod!= null) { + removeMethod.clear(); + } else { + removeMethod = new ArrayList<>(); + } + } + removeMethod.add(removeMethodItem); + } else if (("async-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: asyncMethod + AsyncMethod asyncMethodItem = readAsyncMethod(elementReader, context); + if (asyncMethod == null) { + asyncMethod = statelessBean.asyncMethod; + if (asyncMethod!= null) { + asyncMethod.clear(); + } else { + asyncMethod = new ArrayList<>(); + } + } + asyncMethod.add(asyncMethodItem); + } else if (("transaction-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: transactionType + TransactionType transactionType = parseTransactionType(elementReader, context, elementReader.getElementText()); + if (transactionType!= null) { + statelessBean.transactionType = transactionType; + } + } else if (("after-begin-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: afterBeginMethod + NamedMethod afterBeginMethod = readNamedMethod(elementReader, context); + try { + statelessBean.setAfterBeginMethod(afterBeginMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setAfterBeginMethod", NamedMethod.class, e); + } + } else if (("before-completion-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: beforeCompletionMethod + NamedMethod beforeCompletionMethod = readNamedMethod(elementReader, context); + try { + statelessBean.setBeforeCompletionMethod(beforeCompletionMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setBeforeCompletionMethod", NamedMethod.class, e); + } + } else if (("after-completion-method" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: afterCompletionMethod + NamedMethod afterCompletionMethod = readNamedMethod(elementReader, context); + try { + statelessBean.setAfterCompletionMethod(afterCompletionMethod); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setAfterCompletionMethod", NamedMethod.class, e); + } + } else if (("around-invoke" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: aroundInvoke + AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context); + if (aroundInvoke == null) { + aroundInvoke = statelessBean.aroundInvoke; + if (aroundInvoke!= null) { + aroundInvoke.clear(); + } else { + aroundInvoke = new ArrayList<>(); + } + } + aroundInvoke.add(aroundInvokeItem); + } else if (("around-timeout" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: aroundTimeout + AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context); + if (aroundTimeout == null) { + aroundTimeout = statelessBean.aroundTimeout; + if (aroundTimeout!= null) { + aroundTimeout.clear(); + } else { + aroundTimeout = new ArrayList<>(); + } + } + aroundTimeout.add(aroundTimeoutItem); + } else if (("env-entry" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: envEntry + EnvEntry envEntryItem = readEnvEntry(elementReader, context); + if (envEntry == null) { + envEntry = statelessBean.envEntry; + if (envEntry!= null) { + envEntry.clear(); + } else { + envEntry = new KeyedCollection<>(); + } + } + envEntry.add(envEntryItem); + } else if (("ejb-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbRef + EjbRef ejbRefItem = readEjbRef(elementReader, context); + if (ejbRef == null) { + ejbRef = statelessBean.ejbRef; + if (ejbRef!= null) { + ejbRef.clear(); + } else { + ejbRef = new KeyedCollection<>(); + } + } + ejbRef.add(ejbRefItem); + } else if (("ejb-local-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: ejbLocalRef + EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context); + if (ejbLocalRef == null) { + ejbLocalRef = statelessBean.ejbLocalRef; + if (ejbLocalRef!= null) { + ejbLocalRef.clear(); + } else { + ejbLocalRef = new KeyedCollection<>(); + } + } + ejbLocalRef.add(ejbLocalRefItem); + } else if (("service-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: serviceRef + ServiceRef serviceRefItem = readServiceRef(elementReader, context); + if (serviceRef == null) { + serviceRef = statelessBean.serviceRef; + if (serviceRef!= null) { + serviceRef.clear(); + } else { + serviceRef = new KeyedCollection<>(); + } + } + serviceRef.add(serviceRefItem); + } else if (("resource-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceRef + ResourceRef resourceRefItem = readResourceRef(elementReader, context); + if (resourceRef == null) { + resourceRef = statelessBean.resourceRef; + if (resourceRef!= null) { + resourceRef.clear(); + } else { + resourceRef = new KeyedCollection<>(); + } + } + resourceRef.add(resourceRefItem); + } else if (("resource-env-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: resourceEnvRef + ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context); + if (resourceEnvRef == null) { + resourceEnvRef = statelessBean.resourceEnvRef; + if (resourceEnvRef!= null) { + resourceEnvRef.clear(); + } else { + resourceEnvRef = new KeyedCollection<>(); + } + } + resourceEnvRef.add(resourceEnvRefItem); + } else if (("message-destination-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: messageDestinationRef + MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context); + if (messageDestinationRef == null) { + messageDestinationRef = statelessBean.messageDestinationRef; + if (messageDestinationRef!= null) { + messageDestinationRef.clear(); + } else { + messageDestinationRef = new KeyedCollection<>(); + } + } + messageDestinationRef.add(messageDestinationRefItem); + } else if (("persistence-context-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: persistenceContextRef + PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context); + if (persistenceContextRef == null) { + persistenceContextRef = statelessBean.persistenceContextRef; + if (persistenceContextRef!= null) { + persistenceContextRef.clear(); + } else { + persistenceContextRef = new KeyedCollection<>(); + } + } + persistenceContextRef.add(persistenceContextRefItem); + } else if (("persistence-unit-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: persistenceUnitRef + PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context); + if (persistenceUnitRef == null) { + persistenceUnitRef = statelessBean.persistenceUnitRef; + if (persistenceUnitRef!= null) { + persistenceUnitRef.clear(); + } else { + persistenceUnitRef = new KeyedCollection<>(); + } + } + persistenceUnitRef.add(persistenceUnitRefItem); + } else if (("post-construct" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: postConstruct + org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context); + if (postConstruct == null) { + postConstruct = statelessBean.postConstruct; + if (postConstruct!= null) { + postConstruct.clear(); + } else { + postConstruct = new ArrayList<>(); + } + } + postConstruct.add(postConstructItem); + } else if (("pre-destroy" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: preDestroy + org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context); + if (preDestroy == null) { + preDestroy = statelessBean.preDestroy; + if (preDestroy!= null) { + preDestroy.clear(); + } else { + preDestroy = new ArrayList<>(); + } + } + preDestroy.add(preDestroyItem); + } else if (("data-source" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: dataSource + DataSource dataSourceItem = readDataSource(elementReader, context); + if (dataSource == null) { + dataSource = statelessBean.dataSource; + if (dataSource!= null) { + dataSource.clear(); + } else { + dataSource = new KeyedCollection<>(); + } + } + dataSource.add(dataSourceItem); + } else if (("jms-connection-factory" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsConnectionFactories + JMSConnectionFactory jmsConnectionFactoriesItem = readJMSConnectionFactory(elementReader, context); + if (jmsConnectionFactories == null) { + jmsConnectionFactories = statelessBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + jmsConnectionFactories.clear(); + } else { + jmsConnectionFactories = new KeyedCollection<>(); + } + } + jmsConnectionFactories.add(jmsConnectionFactoriesItem); + } else if (("jms-destination" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: jmsDestinations + JMSDestination jmsDestinationsItem = readJMSDestination(elementReader, context); + if (jmsDestinations == null) { + jmsDestinations = statelessBean.jmsDestinations; + if (jmsDestinations!= null) { + jmsDestinations.clear(); + } else { + jmsDestinations = new KeyedCollection<>(); + } + } + jmsDestinations.add(jmsDestinationsItem); + } else if (("post-activate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: postActivate + org.apache.openejb.jee.LifecycleCallback postActivateItem = readLifecycleCallback(elementReader, context); + if (postActivate == null) { + postActivate = statelessBean.postActivate; + if (postActivate!= null) { + postActivate.clear(); + } else { + postActivate = new ArrayList<>(); + } + } + postActivate.add(postActivateItem); + } else if (("pre-passivate" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: prePassivate + org.apache.openejb.jee.LifecycleCallback prePassivateItem = readLifecycleCallback(elementReader, context); + if (prePassivate == null) { + prePassivate = statelessBean.prePassivate; + if (prePassivate!= null) { + prePassivate.clear(); + } else { + prePassivate = new ArrayList<>(); + } + } + prePassivate.add(prePassivateItem); + } else if (("security-role-ref" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: securityRoleRef + SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context); + if (securityRoleRef == null) { + securityRoleRef = statelessBean.securityRoleRef; + if (securityRoleRef!= null) { + securityRoleRef.clear(); + } else { + securityRoleRef = new ArrayList<>(); + } + } + securityRoleRef.add(securityRoleRefItem); + } else if (("security-identity" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: securityIdentity + SecurityIdentity securityIdentity = readSecurityIdentity(elementReader, context); + statelessBean.securityIdentity = securityIdentity; + } else if (("passivation-capable" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: passivationCapable + Boolean passivationCapable = ("1".equals(elementReader.getElementText())||"true".equals(elementReader.getElementText())); + statelessBean.passivationCapable = passivationCapable; + } else if (("context-service" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: contextService + ContextService contextServiceItem = readContextService(elementReader, context); + if (contextService == null) { + contextService = statelessBean.contextService; + if (contextService!= null) { + contextService.clear(); + } else { + contextService = new KeyedCollection<>(); + } + } + contextService.add(contextServiceItem); + } 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", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "home"), new QName("http://java.sun.com/xml/ns/javaee", "remote"), 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", "business-local"), new QName("http://java.sun.com/xml/ns/javaee", "business-remote"), new QName("http://java.sun.com/xml/ns/javaee", "local-bean"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-class"), new QName("http://java.sun.com/xml/ns/javaee", "session-type"), new QName("http://java.sun.com/xml/ns/javaee", "stateful-timeout"), new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"), new QName("http://java.sun.com/xml/ns/javaee", "timer"), new QName("http://java.sun.com/xml/ns/javaee", "init-on-startup"), new QName("http://java.sun.com/xml/ns/javaee", "concurrency-management-type"), new QName("http://java.sun.com/xml/ns/javaee", "concurrent-method"), new QName("http://java.sun.com/xml/ns/javaee", "depends-on"), new QName("http://java.sun.com/xml/ns/javaee", "init-method"), new QName("http://java.sun.com/xml/ns/javaee", "remove-method"), new QName("http://java.sun.com/xml/ns/javaee", "async-method"), new QName("http://java.sun.com/xml/ns/javaee", "transaction-type"), new QName("http://java.sun.com/xml/ns/javaee", "after-begin-method"), new QName("http://java.sun.com/xml/ns/javaee", "before-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "after-completion-method"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "post-activate"), new QName("http://java.sun.com/xml/ns/javaee", "pre-passivate"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "security-identity"), new QName("http://java.sun.com/xml/ns/javaee", "passivation-capable"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); + } + } + if (descriptions!= null) { + try { + statelessBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()] )); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setDescriptions", Text[].class, e); + } + } + if (displayNames!= null) { + try { + statelessBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] )); + } catch (Exception e) { + context.setterError(reader, SessionBean.class, "setDisplayNames", Text[].class, e); + } + } + if (icon!= null) { + statelessBean.icon = icon; + } + if (businessLocal!= null) { + statelessBean.businessLocal = businessLocal; + } + if (businessRemote!= null) { + statelessBean.businessRemote = businessRemote; + } + if (timer!= null) { + statelessBean.timer = timer; + } + if (concurrentMethod!= null) { + statelessBean.concurrentMethod = concurrentMethod; + } + if (initMethod!= null) { + statelessBean.initMethod = initMethod; + } + if (removeMethod!= null) { + statelessBean.removeMethod = removeMethod; + } + if (asyncMethod!= null) { + statelessBean.asyncMethod = asyncMethod; + } + if (aroundInvoke!= null) { + statelessBean.aroundInvoke = aroundInvoke; + } + if (aroundTimeout!= null) { + statelessBean.aroundTimeout = aroundTimeout; + } + if (envEntry!= null) { + statelessBean.envEntry = envEntry; + } + if (ejbRef!= null) { + statelessBean.ejbRef = ejbRef; + } + if (ejbLocalRef!= null) { + statelessBean.ejbLocalRef = ejbLocalRef; + } + if (serviceRef!= null) { + statelessBean.serviceRef = serviceRef; + } + if (resourceRef!= null) { + statelessBean.resourceRef = resourceRef; + } + if (resourceEnvRef!= null) { + statelessBean.resourceEnvRef = resourceEnvRef; + } + if (messageDestinationRef!= null) { + statelessBean.messageDestinationRef = messageDestinationRef; + } + if (persistenceContextRef!= null) { + statelessBean.persistenceContextRef = persistenceContextRef; + } + if (persistenceUnitRef!= null) { + statelessBean.persistenceUnitRef = persistenceUnitRef; + } + if (postConstruct!= null) { + statelessBean.postConstruct = postConstruct; + } + if (preDestroy!= null) { + statelessBean.preDestroy = preDestroy; + } + if (dataSource!= null) { + statelessBean.dataSource = dataSource; + } + if (jmsConnectionFactories!= null) { + statelessBean.jmsConnectionFactories = jmsConnectionFactories; + } + if (jmsDestinations!= null) { + statelessBean.jmsDestinations = jmsDestinations; + } + if (postActivate!= null) { + statelessBean.postActivate = postActivate; + } + if (prePassivate!= null) { + statelessBean.prePassivate = prePassivate; + } + if (securityRoleRef!= null) { + statelessBean.securityRoleRef = securityRoleRef; + } + if (contextService!= null) { + statelessBean.contextService = contextService; + } + + context.afterUnmarshal(statelessBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + return statelessBean; + } + + public final StatelessBean read(XoXMLStreamReader reader, RuntimeContext context) + throws Exception + { + return _read(reader, context); + } + + public static final void _readDependsOn(XoXMLStreamReader reader, RuntimeContext context, StatelessBean statelessBean) + throws Exception + { + List dependsOn = null; + + // Read elements + for (XoXMLStreamReader elementReader: reader.getChildElements()) { + if (("ejb-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { + // ELEMENT: dependsOn + String dependsOnItemRaw = elementReader.getElementText(); + + String dependsOnItem; + try { + dependsOnItem = Adapters.collapsedStringAdapterAdapter.unmarshal(dependsOnItemRaw); + } catch (Exception e) { + context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e); + continue; + } + + if (dependsOn == null) { + dependsOn = statelessBean.dependsOn; + if (dependsOn!= null) { + dependsOn.clear(); + } else { + dependsOn = new ArrayList<>(); + } + } + dependsOn.add(dependsOnItem); + } + } + if (dependsOn!= null) { + statelessBean.dependsOn = dependsOn; + } + } + + public static final void _write(XoXMLStreamWriter writer, StatelessBean statelessBean, RuntimeContext context) + throws Exception + { + if (statelessBean == null) { + writer.writeXsiNil(); + return ; + } + + if (context == null) { + context = new RuntimeContext(); + } + + String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee"); + if (StatelessBean.class!= statelessBean.getClass()) { + context.unexpectedSubclass(writer, statelessBean, StatelessBean.class); + return ; + } + + context.beforeMarshal(statelessBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + + + // ATTRIBUTE: id + String idRaw = statelessBean.id; + if (idRaw!= null) { + String id = null; + try { + id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "id", CollapsedStringAdapter.class, String.class, String.class, e); + } + writer.writeAttribute("", "", "id", id); + } + + // ELEMENT: descriptions + Text[] descriptions = null; + try { + descriptions = statelessBean.getDescriptions(); + } catch (Exception e) { + context.getterError(statelessBean, "descriptions", SessionBean.class, "getDescriptions", e); + } + if (descriptions!= null) { + for (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(statelessBean, "descriptions"); + } + } + } + + // ELEMENT: displayNames + Text[] displayNames = null; + try { + displayNames = statelessBean.getDisplayNames(); + } catch (Exception e) { + context.getterError(statelessBean, "displayNames", SessionBean.class, "getDisplayNames", e); + } + if (displayNames!= null) { + for (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(statelessBean, "displayNames"); + } + } + } + + // ELEMENT: icon + LocalCollection icon = statelessBean.icon; + if (icon!= null) { + for (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(statelessBean, "icon"); + } + } + } + + // ELEMENT: ejbName + String ejbNameRaw = statelessBean.ejbName; + String ejbName = null; + try { + ejbName = Adapters.collapsedStringAdapterAdapter.marshal(ejbNameRaw); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "ejbName", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (ejbName!= null) { + writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(ejbName); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statelessBean, "ejbName"); + } + + // ELEMENT: mappedName + String mappedNameRaw = statelessBean.mappedName; + String mappedName = null; + try { + mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "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: home + String homeRaw = statelessBean.home; + String home = null; + try { + home = Adapters.collapsedStringAdapterAdapter.marshal(homeRaw); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "home", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (home!= null) { + writer.writeStartElement(prefix, "home", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(home); + writer.writeEndElement(); + } + + // ELEMENT: remote + String remoteRaw = statelessBean.remote; + String remote = null; + try { + remote = Adapters.collapsedStringAdapterAdapter.marshal(remoteRaw); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "remote", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (remote!= null) { + writer.writeStartElement(prefix, "remote", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(remote); + writer.writeEndElement(); + } + + // ELEMENT: localHome + String localHomeRaw = statelessBean.localHome; + String localHome = null; + try { + localHome = Adapters.collapsedStringAdapterAdapter.marshal(localHomeRaw); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "localHome", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (localHome!= null) { + writer.writeStartElement(prefix, "local-home", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(localHome); + writer.writeEndElement(); + } + + // ELEMENT: local + String localRaw = statelessBean.local; + String local = null; + try { + local = Adapters.collapsedStringAdapterAdapter.marshal(localRaw); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "local", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (local!= null) { + writer.writeStartElement(prefix, "local", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(local); + writer.writeEndElement(); + } + + // ELEMENT: businessLocal + LinkedHashSet businessLocalRaw = statelessBean.businessLocal; + if (businessLocalRaw!= null) { + for (String businessLocalItem: businessLocalRaw) { + String businessLocal = null; + try { + businessLocal = Adapters.collapsedStringAdapterAdapter.marshal(businessLocalItem); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "businessLocal", CollapsedStringAdapter.class, LinkedHashSet.class, LinkedHashSet.class, e); + } + if (businessLocal!= null) { + writer.writeStartElement(prefix, "business-local", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(businessLocal); + writer.writeEndElement(); + } + } + } + + // ELEMENT: businessRemote + LinkedHashSet businessRemoteRaw = statelessBean.businessRemote; + if (businessRemoteRaw!= null) { + for (String businessRemoteItem: businessRemoteRaw) { + String businessRemote = null; + try { + businessRemote = Adapters.collapsedStringAdapterAdapter.marshal(businessRemoteItem); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "businessRemote", CollapsedStringAdapter.class, LinkedHashSet.class, LinkedHashSet.class, e); + } + if (businessRemote!= null) { + writer.writeStartElement(prefix, "business-remote", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(businessRemote); + writer.writeEndElement(); + } + } + } + + // ELEMENT: localBean + Empty localBean = statelessBean.localBean; + if (localBean!= null) { + writer.writeStartElement(prefix, "local-bean", "http://java.sun.com/xml/ns/javaee"); + writeEmpty(writer, localBean, context); + writer.writeEndElement(); + } + + // ELEMENT: serviceEndpoint + String serviceEndpointRaw = statelessBean.serviceEndpoint; + String serviceEndpoint = null; + try { + serviceEndpoint = Adapters.collapsedStringAdapterAdapter.marshal(serviceEndpointRaw); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "serviceEndpoint", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (serviceEndpoint!= null) { + writer.writeStartElement(prefix, "service-endpoint", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(serviceEndpoint); + writer.writeEndElement(); + } + + // ELEMENT: ejbClass + String ejbClassRaw = statelessBean.ejbClass; + String ejbClass = null; + try { + ejbClass = Adapters.collapsedStringAdapterAdapter.marshal(ejbClassRaw); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "ejbClass", CollapsedStringAdapter.class, String.class, String.class, e); + } + if (ejbClass!= null) { + writer.writeStartElement(prefix, "ejb-class", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(ejbClass); + writer.writeEndElement(); + } + + // ELEMENT: sessionType + SessionType sessionType = statelessBean.sessionType; + if (sessionType!= null) { + writer.writeStartElement(prefix, "session-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringSessionType(statelessBean, null, context, sessionType)); + writer.writeEndElement(); + } + + // ELEMENT: statefulTimeout + Timeout statefulTimeout = statelessBean.statefulTimeout; + if (statefulTimeout!= null) { + writer.writeStartElement(prefix, "stateful-timeout", "http://java.sun.com/xml/ns/javaee"); + writeTimeout(writer, statefulTimeout, context); + writer.writeEndElement(); + } + + // ELEMENT: timeoutMethod + NamedMethod timeoutMethod = statelessBean.timeoutMethod; + if (timeoutMethod!= null) { + writer.writeStartElement(prefix, "timeout-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, timeoutMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: timer + List timer = statelessBean.timer; + if (timer!= null) { + for (Timer timerItem: timer) { + if (timerItem!= null) { + writer.writeStartElement(prefix, "timer", "http://java.sun.com/xml/ns/javaee"); + writeTimer(writer, timerItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: initOnStartup + Boolean initOnStartup = statelessBean.initOnStartup; + if (initOnStartup!= null) { + writer.writeStartElement(prefix, "init-on-startup", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Boolean.toString(initOnStartup)); + writer.writeEndElement(); + } + + // ELEMENT: concurrencyManagementType + ConcurrencyManagementType concurrencyManagementType = statelessBean.concurrencyManagementType; + if (concurrencyManagementType!= null) { + writer.writeStartElement(prefix, "concurrency-management-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringConcurrencyManagementType(statelessBean, null, context, concurrencyManagementType)); + writer.writeEndElement(); + } + + // ELEMENT: concurrentMethod + List concurrentMethod = statelessBean.concurrentMethod; + if (concurrentMethod!= null) { + for (ConcurrentMethod concurrentMethodItem: concurrentMethod) { + if (concurrentMethodItem!= null) { + writer.writeStartElement(prefix, "concurrent-method", "http://java.sun.com/xml/ns/javaee"); + writeConcurrentMethod(writer, concurrentMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: dependsOn + List dependsOnRaw = statelessBean.dependsOn; + if (dependsOnRaw!= null) { + writer.writeStartElement(prefix, "depends-on", "http://java.sun.com/xml/ns/javaee"); + for (String dependsOnItem: dependsOnRaw) { + String dependsOn = null; + try { + dependsOn = Adapters.collapsedStringAdapterAdapter.marshal(dependsOnItem); + } catch (Exception e) { + context.xmlAdapterError(statelessBean, "dependsOn", CollapsedStringAdapter.class, List.class, List.class, e); + } + if (dependsOn!= null) { + writer.writeStartElement(prefix, "ejb-name", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(dependsOn); + writer.writeEndElement(); + } + } + writer.writeEndElement(); + } + + // ELEMENT: initMethod + List initMethod = statelessBean.initMethod; + if (initMethod!= null) { + for (InitMethod initMethodItem: initMethod) { + if (initMethodItem!= null) { + writer.writeStartElement(prefix, "init-method", "http://java.sun.com/xml/ns/javaee"); + writeInitMethod(writer, initMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: removeMethod + List removeMethod = statelessBean.removeMethod; + if (removeMethod!= null) { + for (RemoveMethod removeMethodItem: removeMethod) { + if (removeMethodItem!= null) { + writer.writeStartElement(prefix, "remove-method", "http://java.sun.com/xml/ns/javaee"); + writeRemoveMethod(writer, removeMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: asyncMethod + List asyncMethod = statelessBean.asyncMethod; + if (asyncMethod!= null) { + for (AsyncMethod asyncMethodItem: asyncMethod) { + if (asyncMethodItem!= null) { + writer.writeStartElement(prefix, "async-method", "http://java.sun.com/xml/ns/javaee"); + writeAsyncMethod(writer, asyncMethodItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: transactionType + TransactionType transactionType = statelessBean.transactionType; + if (transactionType!= null) { + writer.writeStartElement(prefix, "transaction-type", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(toStringTransactionType(statelessBean, null, context, transactionType)); + writer.writeEndElement(); + } + + // ELEMENT: afterBeginMethod + NamedMethod afterBeginMethod = null; + try { + afterBeginMethod = statelessBean.getAfterBeginMethod(); + } catch (Exception e) { + context.getterError(statelessBean, "afterBeginMethod", SessionBean.class, "getAfterBeginMethod", e); + } + if (afterBeginMethod!= null) { + writer.writeStartElement(prefix, "after-begin-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, afterBeginMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: beforeCompletionMethod + NamedMethod beforeCompletionMethod = null; + try { + beforeCompletionMethod = statelessBean.getBeforeCompletionMethod(); + } catch (Exception e) { + context.getterError(statelessBean, "beforeCompletionMethod", SessionBean.class, "getBeforeCompletionMethod", e); + } + if (beforeCompletionMethod!= null) { + writer.writeStartElement(prefix, "before-completion-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, beforeCompletionMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: afterCompletionMethod + NamedMethod afterCompletionMethod = null; + try { + afterCompletionMethod = statelessBean.getAfterCompletionMethod(); + } catch (Exception e) { + context.getterError(statelessBean, "afterCompletionMethod", SessionBean.class, "getAfterCompletionMethod", e); + } + if (afterCompletionMethod!= null) { + writer.writeStartElement(prefix, "after-completion-method", "http://java.sun.com/xml/ns/javaee"); + writeNamedMethod(writer, afterCompletionMethod, context); + writer.writeEndElement(); + } + + // ELEMENT: aroundInvoke + List aroundInvoke = statelessBean.aroundInvoke; + if (aroundInvoke!= null) { + for (AroundInvoke aroundInvokeItem: aroundInvoke) { + if (aroundInvokeItem!= null) { + writer.writeStartElement(prefix, "around-invoke", "http://java.sun.com/xml/ns/javaee"); + writeAroundInvoke(writer, aroundInvokeItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statelessBean, "aroundInvoke"); + } + } + } + + // ELEMENT: aroundTimeout + List aroundTimeout = statelessBean.aroundTimeout; + if (aroundTimeout!= null) { + for (AroundTimeout aroundTimeoutItem: aroundTimeout) { + if (aroundTimeoutItem!= null) { + writer.writeStartElement(prefix, "around-timeout", "http://java.sun.com/xml/ns/javaee"); + writeAroundTimeout(writer, aroundTimeoutItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: envEntry + KeyedCollection envEntry = statelessBean.envEntry; + if (envEntry!= null) { + for (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(statelessBean, "envEntry"); + } + } + } + + // ELEMENT: ejbRef + KeyedCollection ejbRef = statelessBean.ejbRef; + if (ejbRef!= null) { + for (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(statelessBean, "ejbRef"); + } + } + } + + // ELEMENT: ejbLocalRef + KeyedCollection ejbLocalRef = statelessBean.ejbLocalRef; + if (ejbLocalRef!= null) { + for (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(statelessBean, "ejbLocalRef"); + } + } + } + + // ELEMENT: serviceRef + KeyedCollection serviceRef = statelessBean.serviceRef; + if (serviceRef!= null) { + for (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(statelessBean, "serviceRef"); + } + } + } + + // ELEMENT: resourceRef + KeyedCollection resourceRef = statelessBean.resourceRef; + if (resourceRef!= null) { + for (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(statelessBean, "resourceRef"); + } + } + } + + // ELEMENT: resourceEnvRef + KeyedCollection resourceEnvRef = statelessBean.resourceEnvRef; + if (resourceEnvRef!= null) { + for (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(statelessBean, "resourceEnvRef"); + } + } + } + + // ELEMENT: messageDestinationRef + KeyedCollection messageDestinationRef = statelessBean.messageDestinationRef; + if (messageDestinationRef!= null) { + for (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(statelessBean, "messageDestinationRef"); + } + } + } + + // ELEMENT: persistenceContextRef + KeyedCollection persistenceContextRef = statelessBean.persistenceContextRef; + if (persistenceContextRef!= null) { + for (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(statelessBean, "persistenceContextRef"); + } + } + } + + // ELEMENT: persistenceUnitRef + KeyedCollection persistenceUnitRef = statelessBean.persistenceUnitRef; + if (persistenceUnitRef!= null) { + for (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(statelessBean, "persistenceUnitRef"); + } + } + } + + // ELEMENT: postConstruct + List postConstruct = statelessBean.postConstruct; + if (postConstruct!= null) { + for (org.apache.openejb.jee.LifecycleCallback postConstructItem: postConstruct) { + if (postConstructItem!= null) { + writer.writeStartElement(prefix, "post-construct", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, postConstructItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statelessBean, "postConstruct"); + } + } + } + + // ELEMENT: preDestroy + List preDestroy = statelessBean.preDestroy; + if (preDestroy!= null) { + for (org.apache.openejb.jee.LifecycleCallback preDestroyItem: preDestroy) { + if (preDestroyItem!= null) { + writer.writeStartElement(prefix, "pre-destroy", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, preDestroyItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statelessBean, "preDestroy"); + } + } + } + + // ELEMENT: dataSource + KeyedCollection dataSource = statelessBean.dataSource; + if (dataSource!= null) { + for (DataSource dataSourceItem: dataSource) { + if (dataSourceItem!= null) { + writer.writeStartElement(prefix, "data-source", "http://java.sun.com/xml/ns/javaee"); + writeDataSource(writer, dataSourceItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: jmsConnectionFactories + KeyedCollection jmsConnectionFactories = statelessBean.jmsConnectionFactories; + if (jmsConnectionFactories!= null) { + for (JMSConnectionFactory jmsConnectionFactoriesItem: jmsConnectionFactories) { + if (jmsConnectionFactoriesItem!= null) { + writer.writeStartElement(prefix, "jms-connection-factory", "http://java.sun.com/xml/ns/javaee"); + writeJMSConnectionFactory(writer, jmsConnectionFactoriesItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statelessBean, "jmsConnectionFactories"); + } + } + } + + // ELEMENT: jmsDestinations + KeyedCollection jmsDestinations = statelessBean.jmsDestinations; + if (jmsDestinations!= null) { + for (JMSDestination jmsDestinationsItem: jmsDestinations) { + if (jmsDestinationsItem!= null) { + writer.writeStartElement(prefix, "jms-destination", "http://java.sun.com/xml/ns/javaee"); + writeJMSDestination(writer, jmsDestinationsItem, context); + writer.writeEndElement(); + } + } + } + + // ELEMENT: postActivate + List postActivate = statelessBean.postActivate; + if (postActivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback postActivateItem: postActivate) { + if (postActivateItem!= null) { + writer.writeStartElement(prefix, "post-activate", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, postActivateItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statelessBean, "postActivate"); + } + } + } + + // ELEMENT: prePassivate + List prePassivate = statelessBean.prePassivate; + if (prePassivate!= null) { + for (org.apache.openejb.jee.LifecycleCallback prePassivateItem: prePassivate) { + if (prePassivateItem!= null) { + writer.writeStartElement(prefix, "pre-passivate", "http://java.sun.com/xml/ns/javaee"); + writeLifecycleCallback(writer, prePassivateItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statelessBean, "prePassivate"); + } + } + } + + // ELEMENT: securityRoleRef + List securityRoleRef = statelessBean.securityRoleRef; + if (securityRoleRef!= null) { + for (SecurityRoleRef securityRoleRefItem: securityRoleRef) { + if (securityRoleRefItem!= null) { + writer.writeStartElement(prefix, "security-role-ref", "http://java.sun.com/xml/ns/javaee"); + writeSecurityRoleRef(writer, securityRoleRefItem, context); + writer.writeEndElement(); + } else { + context.unexpectedNullValue(statelessBean, "securityRoleRef"); + } + } + } + + // ELEMENT: securityIdentity + SecurityIdentity securityIdentity = statelessBean.securityIdentity; + if (securityIdentity!= null) { + writer.writeStartElement(prefix, "security-identity", "http://java.sun.com/xml/ns/javaee"); + writeSecurityIdentity(writer, securityIdentity, context); + writer.writeEndElement(); + } + + // ELEMENT: passivationCapable + Boolean passivationCapable = statelessBean.passivationCapable; + if (passivationCapable!= null) { + writer.writeStartElement(prefix, "passivation-capable", "http://java.sun.com/xml/ns/javaee"); + writer.writeCharacters(Boolean.toString(passivationCapable)); + writer.writeEndElement(); + } + + // ELEMENT: contextService + KeyedCollection contextService = statelessBean.contextService; + if (contextService!= null) { + for (ContextService contextServiceItem: contextService) { + if (contextServiceItem!= null) { + writer.writeStartElement(prefix, "context-service", "http://java.sun.com/xml/ns/javaee"); + writeContextService(writer, contextServiceItem, context); + writer.writeEndElement(); + } + } + } + + context.afterMarshal(statelessBean, org.metatype.sxc.jaxb.LifecycleCallback.NONE); + } + +} diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/ManagedBean.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/ManagedBean.java index 914692c4075..0fe59d2525a 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/ManagedBean.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/ManagedBean.java @@ -23,7 +23,7 @@ * @version $Revision$ $Date$ */ public class ManagedBean extends SessionBean { - private boolean hidden; + protected boolean hidden; public ManagedBean(final String ejbName, final String ejbClass) { super(ejbName, ejbClass, SessionType.MANAGED); diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionBean.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionBean.java index 41dc9ddf299..07bc67b849b 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionBean.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionBean.java @@ -33,6 +33,7 @@ import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlID; +import jakarta.xml.bind.annotation.XmlSeeAlso; import jakarta.xml.bind.annotation.XmlTransient; import jakarta.xml.bind.annotation.XmlType; import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; @@ -146,6 +147,7 @@ "passivationCapable", "contextService" }) +@XmlSeeAlso({StatelessBean.class, StatefulBean.class, SingletonBean.class, ManagedBean.class}) public class SessionBean implements RemoteBean, Session, TimerConsumer { @XmlTransient protected TextMap description = new TextMap(); From ab81c40de3570b3d704c35389f09e972df565902 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Thu, 29 Aug 2024 14:18:47 +0200 Subject: [PATCH 11/13] fix DontFailOnUnusedTagTest --- .../org/apache/openejb/jee/WebApp$JAXB.java | 23 ++++++++++++++++++- .../java/org/apache/openejb/jee/WebApp.java | 8 +++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java index 73c1132d81f..6459e9d8b8b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java @@ -181,6 +181,7 @@ public static final WebApp _read(XoXMLStreamReader reader, RuntimeContext contex KeyedCollection jmsConnectionFactories = null; KeyedCollection jmsDestinations = null; KeyedCollection contextService = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -660,7 +661,16 @@ public static final WebApp _read(XoXMLStreamReader reader, RuntimeContext contex } contextService.add(contextServiceItem); } 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", "distributable"), new QName("http://java.sun.com/xml/ns/javaee", "context-param"), new QName("http://java.sun.com/xml/ns/javaee", "filter"), new QName("http://java.sun.com/xml/ns/javaee", "filter-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "listener"), new QName("http://java.sun.com/xml/ns/javaee", "servlet"), new QName("http://java.sun.com/xml/ns/javaee", "servlet-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "default-context-path"), new QName("http://java.sun.com/xml/ns/javaee", "session-config"), new QName("http://java.sun.com/xml/ns/javaee", "mime-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "welcome-file-list"), new QName("http://java.sun.com/xml/ns/javaee", "error-page"), new QName("http://java.sun.com/xml/ns/javaee", "taglib"), new QName("http://java.sun.com/xml/ns/javaee", "jsp-config"), new QName("http://java.sun.com/xml/ns/javaee", "security-constraint"), new QName("http://java.sun.com/xml/ns/javaee", "login-config"), new QName("http://java.sun.com/xml/ns/javaee", "security-role"), new QName("http://java.sun.com/xml/ns/javaee", "locale-encoding-mapping-list"), 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", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination"), new QName("http://java.sun.com/xml/ns/javaee", "absolute-ordering"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "jms-connection-factory"), new QName("http://java.sun.com/xml/ns/javaee", "jms-destination"), new QName("http://java.sun.com/xml/ns/javaee", "module-name"), new QName("http://java.sun.com/xml/ns/javaee", "context-service")); + // ELEMENT_REF: others + if (others == null) { + others = webApp.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (descriptions!= null) { @@ -776,6 +786,9 @@ public static final WebApp _read(XoXMLStreamReader reader, RuntimeContext contex if (contextService!= null) { webApp.contextService = contextService; } + if (others!= null) { + webApp.others = others; + } context.afterUnmarshal(webApp, org.metatype.sxc.jaxb.LifecycleCallback.NONE); @@ -1360,6 +1373,14 @@ public static final void _write(XoXMLStreamWriter writer, WebApp webApp, Runtime } } + // ELEMENT_REF: others + List others = webApp.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, webApp, "others", othersItem); + } + } + context.afterMarshal(webApp, org.metatype.sxc.jaxb.LifecycleCallback.NONE); } diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java index 0f046987517..a7fa6cc60b4 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java @@ -19,6 +19,7 @@ import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlID; @@ -99,8 +100,8 @@ "jmsConnectionFactories", "jmsDestinations", "moduleName", - "contextService" - + "contextService", + "others" }) public class WebApp implements WebCommon, Lifecycle, NamedModule { @XmlTransient @@ -197,6 +198,9 @@ public class WebApp implements WebCommon, Lifecycle, NamedModule { @XmlElement(name="context-service") protected KeyedCollection contextService; + @XmlAnyElement + protected List others; + @Override public String getJndiConsumerName() { return contextRoot; From 3c4ef6ec3fae65e98e424d8a4c889c74160e0932 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Thu, 29 Aug 2024 14:40:26 +0200 Subject: [PATCH 12/13] fix FacesConfig22Test --- .../jee/FacesAbsoluteOrdering$JAXB.java | 23 ++++++++++++++++- .../openejb/jee/FacesApplication$JAXB.java | 23 ++++++++++++++++- .../openejb/jee/FacesBehavior$JAXB.java | 23 ++++++++++++++++- .../openejb/jee/FacesComponent$JAXB.java | 23 ++++++++++++++++- .../apache/openejb/jee/FacesConfig$JAXB.java | 23 ++++++++++++++++- .../openejb/jee/FacesConverter$JAXB.java | 23 ++++++++++++++++- .../apache/openejb/jee/FacesFactory$JAXB.java | 23 ++++++++++++++++- .../openejb/jee/FacesLifecycle$JAXB.java | 23 ++++++++++++++++- .../openejb/jee/FacesNavigationRule$JAXB.java | 23 ++++++++++++++++- .../openejb/jee/FacesOrdering$JAXB.java | 25 ++++++++++++++++++- .../openejb/jee/FacesReferencedBean$JAXB.java | 24 +++++++++++++++++- .../openejb/jee/FacesRenderKit$JAXB.java | 23 ++++++++++++++++- .../openejb/jee/FacesValidator$JAXB.java | 23 ++++++++++++++++- .../openejb/jee/FacesAbsoluteOrdering.java | 7 +++++- .../apache/openejb/jee/FacesApplication.java | 7 +++++- .../org/apache/openejb/jee/FacesBehavior.java | 7 +++++- .../apache/openejb/jee/FacesComponent.java | 7 +++++- .../org/apache/openejb/jee/FacesConfig.java | 7 +++++- .../apache/openejb/jee/FacesConverter.java | 7 +++++- .../org/apache/openejb/jee/FacesFactory.java | 7 +++++- .../apache/openejb/jee/FacesLifecycle.java | 7 +++++- .../openejb/jee/FacesNavigationRule.java | 7 +++++- .../org/apache/openejb/jee/FacesOrdering.java | 10 +++++++- .../openejb/jee/FacesReferencedBean.java | 8 +++++- .../apache/openejb/jee/FacesRenderKit.java | 8 +++++- .../apache/openejb/jee/FacesValidator.java | 7 +++++- 26 files changed, 372 insertions(+), 26 deletions(-) diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering$JAXB.java index d8f324a2fe8..80a0d330a20 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering$JAXB.java @@ -79,6 +79,7 @@ public static final FacesAbsoluteOrdering _read(XoXMLStreamReader reader, Runtim context.beforeUnmarshal(facesAbsoluteOrdering, LifecycleCallback.NONE); List nameOrOthers = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -122,12 +123,24 @@ public static final FacesAbsoluteOrdering _read(XoXMLStreamReader reader, Runtim } nameOrOthers.add(nameOrOthersItem1); } else { - context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "others"), new QName("http://java.sun.com/xml/ns/javaee", "name")); + // ELEMENT_REF: others + if (others == null) { + others = facesAbsoluteOrdering.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (nameOrOthers!= null) { facesAbsoluteOrdering.nameOrOthers = nameOrOthers; } + if (others!= null) { + facesAbsoluteOrdering.others = others; + } context.afterUnmarshal(facesAbsoluteOrdering, LifecycleCallback.NONE); @@ -183,6 +196,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesAbsoluteOrdering } } + // ELEMENT_REF: others + List others = facesAbsoluteOrdering.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesAbsoluteOrdering, "others", othersItem); + } + } + context.afterMarshal(facesAbsoluteOrdering, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplication$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplication$JAXB.java index 9e17c33ab54..50f42e38642 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplication$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesApplication$JAXB.java @@ -101,6 +101,7 @@ public static final FacesApplication _read(XoXMLStreamReader reader, RuntimeCont List localeConfig = null; List applicationExtension = null; List defaultValidators = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -387,7 +388,16 @@ public static final FacesApplication _read(XoXMLStreamReader reader, RuntimeCont } defaultValidators.add(defaultValidatorsItem); } else { - context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "action-listener"), new QName("http://java.sun.com/xml/ns/javaee", "default-render-kit-id"), new QName("http://java.sun.com/xml/ns/javaee", "message-bundle"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-handler"), new QName("http://java.sun.com/xml/ns/javaee", "view-handler"), new QName("http://java.sun.com/xml/ns/javaee", "state-manager"), new QName("http://java.sun.com/xml/ns/javaee", "el-resolver"), new QName("http://java.sun.com/xml/ns/javaee", "property-resolver"), new QName("http://java.sun.com/xml/ns/javaee", "variable-resolver"), new QName("http://java.sun.com/xml/ns/javaee", "resource-handler"), new QName("http://java.sun.com/xml/ns/javaee", "system-event-listener"), new QName("http://java.sun.com/xml/ns/javaee", "locale-config"), new QName("http://java.sun.com/xml/ns/javaee", "resource-bundle"), new QName("http://java.sun.com/xml/ns/javaee", "application-extension"), new QName("http://java.sun.com/xml/ns/javaee", "default-validators")); + // ELEMENT_REF: others + if (others == null) { + others = facesApplication.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (actionListener!= null) { @@ -432,6 +442,9 @@ public static final FacesApplication _read(XoXMLStreamReader reader, RuntimeCont if (defaultValidators!= null) { facesApplication.defaultValidators = defaultValidators; } + if (others!= null) { + facesApplication.others = others; + } context.afterUnmarshal(facesApplication, LifecycleCallback.NONE); @@ -715,6 +728,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesApplication faces } } + // ELEMENT_REF: others + List others = facesApplication.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesApplication, "others", othersItem); + } + } + context.afterMarshal(facesApplication, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehavior$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehavior$JAXB.java index 974f706391f..edf882672de 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehavior$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehavior$JAXB.java @@ -93,6 +93,7 @@ public static final FacesBehavior _read(XoXMLStreamReader reader, RuntimeContext List attribute1 = null; List property = null; List behaviorExtension = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -200,7 +201,16 @@ public static final FacesBehavior _read(XoXMLStreamReader reader, RuntimeContext } behaviorExtension.add(behaviorExtensionItem); } 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", "behavior-id"), new QName("http://java.sun.com/xml/ns/javaee", "behavior-class"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "behavior-extension")); + // ELEMENT_REF: others + if (others == null) { + others = facesBehavior.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (descriptions!= null) { @@ -229,6 +239,9 @@ public static final FacesBehavior _read(XoXMLStreamReader reader, RuntimeContext if (behaviorExtension!= null) { facesBehavior.behaviorExtension = behaviorExtension; } + if (others!= null) { + facesBehavior.others = others; + } context.afterUnmarshal(facesBehavior, LifecycleCallback.NONE); @@ -386,6 +399,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesBehavior facesBeh } } + // ELEMENT_REF: others + List others = facesBehavior.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesBehavior, "others", othersItem); + } + } + context.afterMarshal(facesBehavior, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponent$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponent$JAXB.java index a58bacff47a..486995a8d1c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponent$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponent$JAXB.java @@ -96,6 +96,7 @@ public static final FacesComponent _read(XoXMLStreamReader reader, RuntimeContex List attribute1 = null; List property = null; List componentExtension = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -220,7 +221,16 @@ public static final FacesComponent _read(XoXMLStreamReader reader, RuntimeContex } componentExtension.add(componentExtensionItem); } 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", "component-type"), new QName("http://java.sun.com/xml/ns/javaee", "component-class"), new QName("http://java.sun.com/xml/ns/javaee", "facet"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "component-extension")); + // ELEMENT_REF: others + if (others == null) { + others = facesComponent.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (descriptions!= null) { @@ -252,6 +262,9 @@ public static final FacesComponent _read(XoXMLStreamReader reader, RuntimeContex if (componentExtension!= null) { facesComponent.componentExtension = componentExtension; } + if (others!= null) { + facesComponent.others = others; + } context.afterUnmarshal(facesComponent, LifecycleCallback.NONE); @@ -435,6 +448,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesComponent facesCo } } + // ELEMENT_REF: others + List others = facesComponent.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesComponent, "others", othersItem); + } + } + context.afterMarshal(facesComponent, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfig$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfig$JAXB.java index 0b3dc9d3ea0..2762b29b4c8 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfig$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConfig$JAXB.java @@ -126,6 +126,7 @@ public static final FacesConfig _read(XoXMLStreamReader reader, RuntimeContext c List facesConfigExtension = null; List flowDefinitions = null; List protectedViews = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -373,7 +374,16 @@ public static final FacesConfig _read(XoXMLStreamReader reader, RuntimeContext c } protectedViews.add(protectedViewsItem); } else { - context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "application"), new QName("http://java.sun.com/xml/ns/javaee", "ordering"), new QName("http://java.sun.com/xml/ns/javaee", "absolute-ordering"), new QName("http://java.sun.com/xml/ns/javaee", "factory"), new QName("http://java.sun.com/xml/ns/javaee", "component"), new QName("http://java.sun.com/xml/ns/javaee", "converter"), new QName("http://java.sun.com/xml/ns/javaee", "managed-bean"), new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-rule"), new QName("http://java.sun.com/xml/ns/javaee", "referenced-bean"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit"), new QName("http://java.sun.com/xml/ns/javaee", "lifecycle"), new QName("http://java.sun.com/xml/ns/javaee", "validator"), new QName("http://java.sun.com/xml/ns/javaee", "behavior"), new QName("http://java.sun.com/xml/ns/javaee", "faces-config-extension"), new QName("http://java.sun.com/xml/ns/javaee", "flow-definition"), new QName("http://java.sun.com/xml/ns/javaee", "protected-views")); + // ELEMENT_REF: others + if (others == null) { + others = facesConfig.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (application!= null) { @@ -427,6 +437,9 @@ public static final FacesConfig _read(XoXMLStreamReader reader, RuntimeContext c if (protectedViews!= null) { facesConfig.protectedViews = protectedViews; } + if (others!= null) { + facesConfig.others = others; + } context.afterUnmarshal(facesConfig, LifecycleCallback.NONE); @@ -718,6 +731,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesConfig facesConfi } } + // ELEMENT_REF: others + List others = facesConfig.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesConfig, "others", othersItem); + } + } + context.afterMarshal(facesConfig, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverter$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverter$JAXB.java index 536b58f7146..5183426483b 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverter$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesConverter$JAXB.java @@ -93,6 +93,7 @@ public static final FacesConverter _read(XoXMLStreamReader reader, RuntimeContex List attribute1 = null; List property = null; List converterExtension = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -218,7 +219,16 @@ public static final FacesConverter _read(XoXMLStreamReader reader, RuntimeContex } converterExtension.add(converterExtensionItem); } 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", "converter-id"), new QName("http://java.sun.com/xml/ns/javaee", "converter-for-class"), new QName("http://java.sun.com/xml/ns/javaee", "converter-class"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "converter-extension")); + // ELEMENT_REF: others + if (others == null) { + others = facesConverter.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (descriptions!= null) { @@ -247,6 +257,9 @@ public static final FacesConverter _read(XoXMLStreamReader reader, RuntimeContex if (converterExtension!= null) { facesConverter.converterExtension = converterExtension; } + if (others!= null) { + facesConverter.others = others; + } context.afterUnmarshal(facesConverter, LifecycleCallback.NONE); @@ -428,6 +441,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesConverter facesCo } } + // ELEMENT_REF: others + List others = facesConverter.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesConverter, "others", othersItem); + } + } + context.afterMarshal(facesConverter, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactory$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactory$JAXB.java index e3d4d1c3fc5..6cd3c747f6c 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactory$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesFactory$JAXB.java @@ -90,6 +90,7 @@ public static final FacesFactory _read(XoXMLStreamReader reader, RuntimeContext List renderKitFactory = null; List visitContextFactory = null; List factoryExtension = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -336,7 +337,16 @@ public static final FacesFactory _read(XoXMLStreamReader reader, RuntimeContext } factoryExtension.add(factoryExtensionItem); } else { - context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "application-factory"), new QName("http://java.sun.com/xml/ns/javaee", "exception-handler-factory"), new QName("http://java.sun.com/xml/ns/javaee", "external-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "faces-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "partial-view-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "lifecycle-factory"), new QName("http://java.sun.com/xml/ns/javaee", "view-declaration-language-factory"), new QName("http://java.sun.com/xml/ns/javaee", "tag-handler-delegate-factory"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit-factory"), new QName("http://java.sun.com/xml/ns/javaee", "visit-context-factory"), new QName("http://java.sun.com/xml/ns/javaee", "factory-extension")); + // ELEMENT_REF: others + if (others == null) { + others = facesFactory.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (applicationFactory!= null) { @@ -372,6 +382,9 @@ public static final FacesFactory _read(XoXMLStreamReader reader, RuntimeContext if (factoryExtension!= null) { facesFactory.factoryExtension = factoryExtension; } + if (others!= null) { + facesFactory.others = others; + } context.afterUnmarshal(facesFactory, LifecycleCallback.NONE); @@ -609,6 +622,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesFactory facesFact } } + // ELEMENT_REF: others + List others = facesFactory.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesFactory, "others", othersItem); + } + } + context.afterMarshal(facesFactory, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycle$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycle$JAXB.java index e9c68f6409e..c581e90c293 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycle$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesLifecycle$JAXB.java @@ -81,6 +81,7 @@ public static final FacesLifecycle _read(XoXMLStreamReader reader, RuntimeContex List phaseListener = null; List lifecycleExtension = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -138,7 +139,16 @@ public static final FacesLifecycle _read(XoXMLStreamReader reader, RuntimeContex } lifecycleExtension.add(lifecycleExtensionItem); } else { - context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "phase-listener"), new QName("http://java.sun.com/xml/ns/javaee", "lifecycle-extension")); + // ELEMENT_REF: others + if (others == null) { + others = facesLifecycle.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (phaseListener!= null) { @@ -147,6 +157,9 @@ public static final FacesLifecycle _read(XoXMLStreamReader reader, RuntimeContex if (lifecycleExtension!= null) { facesLifecycle.lifecycleExtension = lifecycleExtension; } + if (others!= null) { + facesLifecycle.others = others; + } context.afterUnmarshal(facesLifecycle, LifecycleCallback.NONE); @@ -222,6 +235,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesLifecycle facesLi } } + // ELEMENT_REF: others + List others = facesLifecycle.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesLifecycle, "others", othersItem); + } + } + context.afterMarshal(facesLifecycle, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRule$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRule$JAXB.java index 877b5835e9b..a276fb37991 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRule$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesNavigationRule$JAXB.java @@ -90,6 +90,7 @@ public static final FacesNavigationRule _read(XoXMLStreamReader reader, RuntimeC LocalCollection icon = null; List navigationCase = null; List navigationRuleExtension = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -177,7 +178,16 @@ public static final FacesNavigationRule _read(XoXMLStreamReader reader, RuntimeC } navigationRuleExtension.add(navigationRuleExtensionItem); } 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", "from-view-id"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-case"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-rule-extension")); + // ELEMENT_REF: others + if (others == null) { + others = facesNavigationRule.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (descriptions!= null) { @@ -203,6 +213,9 @@ public static final FacesNavigationRule _read(XoXMLStreamReader reader, RuntimeC if (navigationRuleExtension!= null) { facesNavigationRule.navigationRuleExtension = navigationRuleExtension; } + if (others!= null) { + facesNavigationRule.others = others; + } context.afterUnmarshal(facesNavigationRule, LifecycleCallback.NONE); @@ -338,6 +351,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesNavigationRule fa } } + // ELEMENT_REF: others + List others = facesNavigationRule.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesNavigationRule, "others", othersItem); + } + } + context.afterMarshal(facesNavigationRule, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrdering$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrdering$JAXB.java index ffbabc0409f..11e08a465a1 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrdering$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesOrdering$JAXB.java @@ -17,6 +17,8 @@ package org.apache.openejb.jee; +import java.util.ArrayList; +import java.util.List; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import org.metatype.sxc.jaxb.JAXBObject; @@ -76,6 +78,7 @@ public static final FacesOrdering _read(XoXMLStreamReader reader, RuntimeContext FacesOrdering facesOrdering = new FacesOrdering(); context.beforeUnmarshal(facesOrdering, LifecycleCallback.NONE); + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -103,9 +106,21 @@ public static final FacesOrdering _read(XoXMLStreamReader reader, RuntimeContext FacesOrderingOrdering before = readFacesOrderingOrdering(elementReader, context); facesOrdering.before = before; } else { - context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "after"), new QName("http://java.sun.com/xml/ns/javaee", "before")); + // ELEMENT_REF: others + if (others == null) { + others = facesOrdering.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } + if (others!= null) { + facesOrdering.others = others; + } context.afterUnmarshal(facesOrdering, LifecycleCallback.NONE); @@ -155,6 +170,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesOrdering facesOrd writer.writeEndElement(); } + // ELEMENT_REF: others + List others = facesOrdering.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesOrdering, "others", othersItem); + } + } + context.afterMarshal(facesOrdering, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesReferencedBean$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesReferencedBean$JAXB.java index 17e35fa3be3..fd0200c7b8e 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesReferencedBean$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesReferencedBean$JAXB.java @@ -18,6 +18,7 @@ package org.apache.openejb.jee; import java.util.ArrayList; +import java.util.List; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; @@ -83,6 +84,7 @@ public static final FacesReferencedBean _read(XoXMLStreamReader reader, RuntimeC ArrayList descriptions = null; ArrayList displayNames = null; LocalCollection icon = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -159,7 +161,16 @@ public static final FacesReferencedBean _read(XoXMLStreamReader reader, RuntimeC facesReferencedBean.referencedBeanClass = referencedBeanClass; } 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", "referenced-bean-name"), new QName("http://java.sun.com/xml/ns/javaee", "referenced-bean-class")); + // ELEMENT_REF: others + if (others == null) { + others = facesReferencedBean.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (descriptions!= null) { @@ -179,6 +190,9 @@ public static final FacesReferencedBean _read(XoXMLStreamReader reader, RuntimeC if (icon!= null) { facesReferencedBean.icon = icon; } + if (others!= null) { + facesReferencedBean.others = others; + } context.afterUnmarshal(facesReferencedBean, LifecycleCallback.NONE); @@ -308,6 +322,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesReferencedBean fa context.unexpectedNullValue(facesReferencedBean, "referencedBeanClass"); } + // ELEMENT_REF: others + List others = facesReferencedBean.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesReferencedBean, "others", othersItem); + } + } + context.afterMarshal(facesReferencedBean, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKit$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKit$JAXB.java index 972292622fd..e579820eb74 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKit$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesRenderKit$JAXB.java @@ -93,6 +93,7 @@ public static final FacesRenderKit _read(XoXMLStreamReader reader, RuntimeContex List renderer = null; List clientBehaviorRenderer = null; List renderKitExtension = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -205,7 +206,16 @@ public static final FacesRenderKit _read(XoXMLStreamReader reader, RuntimeContex } renderKitExtension.add(renderKitExtensionItem); } 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", "render-kit-id"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit-class"), new QName("http://java.sun.com/xml/ns/javaee", "renderer"), new QName("http://java.sun.com/xml/ns/javaee", "client-behavior-renderer"), new QName("http://java.sun.com/xml/ns/javaee", "render-kit-extension")); + // ELEMENT_REF: others + if (others == null) { + others = facesRenderKit.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (descriptions!= null) { @@ -234,6 +244,9 @@ public static final FacesRenderKit _read(XoXMLStreamReader reader, RuntimeContex if (renderKitExtension!= null) { facesRenderKit.renderKitExtension = renderKitExtension; } + if (others!= null) { + facesRenderKit.others = others; + } context.afterUnmarshal(facesRenderKit, LifecycleCallback.NONE); @@ -397,6 +410,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesRenderKit facesRe } } + // ELEMENT_REF: others + List others = facesRenderKit.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesRenderKit, "others", othersItem); + } + } + context.afterMarshal(facesRenderKit, LifecycleCallback.NONE); } diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidator$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidator$JAXB.java index e703c9d0b82..cf76595ca19 100644 --- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidator$JAXB.java +++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesValidator$JAXB.java @@ -93,6 +93,7 @@ public static final FacesValidator _read(XoXMLStreamReader reader, RuntimeContex List attribute1 = null; List property = null; List validatorExtension = null; + List others = null; // Check xsi:type QName xsiType = reader.getXsiType(); @@ -205,7 +206,16 @@ public static final FacesValidator _read(XoXMLStreamReader reader, RuntimeContex } validatorExtension.add(validatorExtensionItem); } 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", "validator-id"), new QName("http://java.sun.com/xml/ns/javaee", "validator-class"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "property"), new QName("http://java.sun.com/xml/ns/javaee", "validator-extension")); + // ELEMENT_REF: others + if (others == null) { + others = facesValidator.others; + if (others!= null) { + others.clear(); + } else { + others = new ArrayList<>(); + } + } + others.add(context.readXmlAny(elementReader, Object.class, false)); } } if (descriptions!= null) { @@ -234,6 +244,9 @@ public static final FacesValidator _read(XoXMLStreamReader reader, RuntimeContex if (validatorExtension!= null) { facesValidator.validatorExtension = validatorExtension; } + if (others!= null) { + facesValidator.others = others; + } context.afterUnmarshal(facesValidator, LifecycleCallback.NONE); @@ -403,6 +416,14 @@ public static final void _write(XoXMLStreamWriter writer, FacesValidator facesVa } } + // ELEMENT_REF: others + List others = facesValidator.others; + if (others!= null) { + for (Object othersItem: others) { + context.writeXmlAny(writer, facesValidator, "others", othersItem); + } + } + context.afterMarshal(facesValidator, LifecycleCallback.NONE); } diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering.java index 21de13b6d82..671948c2562 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesAbsoluteOrdering.java @@ -20,6 +20,7 @@ import java.util.List; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElements; import jakarta.xml.bind.annotation.XmlType; @@ -47,7 +48,8 @@ */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "faces-config-absoluteOrderingType", propOrder = { - "nameOrOthers" + "nameOrOthers", + "others" }) public class FacesAbsoluteOrdering { @@ -57,6 +59,9 @@ public class FacesAbsoluteOrdering { }) protected List nameOrOthers; + @XmlAnyElement + protected List others; + /** * Gets the value of the nameOrOthers property. * diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesApplication.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesApplication.java index a77d2e32ebc..ff5c3287507 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesApplication.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesApplication.java @@ -20,6 +20,7 @@ import java.util.List; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlID; @@ -79,7 +80,8 @@ "localeConfig", "resourceBundle", "applicationExtension", - "defaultValidators" + "defaultValidators", + "others" }) public class FacesApplication { @@ -119,6 +121,9 @@ public class FacesApplication { @XmlSchemaType(name = "ID") protected java.lang.String id; + @XmlAnyElement + protected List others; + /** * Gets the value of the actionListener property. * diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesBehavior.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesBehavior.java index fd9487634ae..0dd8870666d 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesBehavior.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesBehavior.java @@ -22,6 +22,7 @@ import java.util.Map; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlTransient; import jakarta.xml.bind.annotation.XmlType; @@ -60,7 +61,8 @@ "behaviorClass", "attribute", "property", - "behaviorExtension" + "behaviorExtension", + "others" }) public class FacesBehavior { @@ -79,6 +81,9 @@ public class FacesBehavior { @XmlElement(name = "behavior-extension") protected List behaviorExtension; + @XmlAnyElement + protected List others; + @XmlElement(name = "description", required = true) public Text[] getDescriptions() { return description.toArray(); diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesComponent.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesComponent.java index 2dcccd7a27b..54606246426 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesComponent.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesComponent.java @@ -22,6 +22,7 @@ import java.util.Map; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlID; @@ -68,7 +69,8 @@ "facet", "attribute", "property", - "componentExtension" + "componentExtension", + "others" }) public class FacesComponent { @@ -93,6 +95,9 @@ public class FacesComponent { @XmlSchemaType(name = "ID") protected java.lang.String id; + @XmlAnyElement + protected List others; + @XmlElement(name = "description", required = true) public Text[] getDescriptions() { return description.toArray(); diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesConfig.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesConfig.java index 61cb97a695e..b9d4515eba4 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesConfig.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesConfig.java @@ -20,6 +20,7 @@ import java.util.List; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlID; @@ -87,7 +88,8 @@ "behavior", "facesConfigExtension", "flowDefinitions", - "protectedViews" + "protectedViews", + "others" }) public class FacesConfig { @@ -126,6 +128,9 @@ public class FacesConfig { @XmlAttribute(name = "metadata-complete") protected Boolean metadataComplete; + @XmlAnyElement + protected List others; + /** * Gets the value of the application property. * diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesConverter.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesConverter.java index 59196ee520a..4ee9aea4783 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesConverter.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesConverter.java @@ -22,6 +22,7 @@ import java.util.Map; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlID; @@ -70,7 +71,8 @@ "converterClass", "attribute", "property", - "converterExtension" + "converterExtension", + "others" }) public class FacesConverter { @@ -96,6 +98,9 @@ public class FacesConverter { @XmlSchemaType(name = "ID") protected java.lang.String id; + @XmlAnyElement + protected List others; + @XmlElement(name = "description", required = true) public Text[] getDescriptions() { return description.toArray(); diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesFactory.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesFactory.java index 6405c2b30ef..0f005af5d8a 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesFactory.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesFactory.java @@ -20,6 +20,7 @@ import java.util.List; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlID; @@ -72,7 +73,8 @@ "tagHandlerDelegateFactory", "renderKitFactory", "visitContextFactory", - "factoryExtension" + "factoryExtension", + "others" }) public class FacesFactory { @@ -104,6 +106,9 @@ public class FacesFactory { @XmlSchemaType(name = "ID") protected java.lang.String id; + @XmlAnyElement + protected List others; + /** * Gets the value of the applicationFactory property. * diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesLifecycle.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesLifecycle.java index c5a499b0d72..d8f6f9bf7b8 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesLifecycle.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesLifecycle.java @@ -20,6 +20,7 @@ import java.util.List; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlID; @@ -53,7 +54,8 @@ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "faces-config-lifecycleType", propOrder = { "phaseListener", - "lifecycleExtension" + "lifecycleExtension", + "others" }) public class FacesLifecycle { @@ -67,6 +69,9 @@ public class FacesLifecycle { @XmlSchemaType(name = "ID") protected java.lang.String id; + @XmlAnyElement + protected List others; + /** * Gets the value of the phaseListener property. * diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesNavigationRule.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesNavigationRule.java index c2185f166e1..6a41997e3da 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesNavigationRule.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesNavigationRule.java @@ -22,6 +22,7 @@ import java.util.Map; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlID; @@ -62,7 +63,8 @@ "icon", "fromViewId", "navigationCase", - "navigationRuleExtension" + "navigationRuleExtension", + "others" }) public class FacesNavigationRule { @@ -84,6 +86,9 @@ public class FacesNavigationRule { @XmlSchemaType(name = "ID") protected java.lang.String id; + @XmlAnyElement + protected List others; + @XmlElement(name = "description", required = true) public Text[] getDescriptions() { return description.toArray(); diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesOrdering.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesOrdering.java index 80f105b6cc6..5a27dd7ac20 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesOrdering.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesOrdering.java @@ -18,8 +18,11 @@ import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlType; +import java.util.List; + /** * web-facesconfig_2_0.xsd @@ -44,13 +47,18 @@ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "faces-config-orderingType", propOrder = { "after", - "before" + "before", + "others" }) public class FacesOrdering { protected FacesOrderingOrdering after; protected FacesOrderingOrdering before; + @XmlAnyElement + protected List others; + + /** * Gets the value of the after property. * diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesReferencedBean.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesReferencedBean.java index 877f56e0862..970a4edf0b8 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesReferencedBean.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesReferencedBean.java @@ -17,9 +17,11 @@ package org.apache.openejb.jee; import java.util.Collection; +import java.util.List; import java.util.Map; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlID; @@ -58,7 +60,8 @@ "displayNames", "icon", "referencedBeanName", - "referencedBeanClass" + "referencedBeanClass", + "others" }) public class FacesReferencedBean { @@ -78,6 +81,9 @@ public class FacesReferencedBean { @XmlSchemaType(name = "ID") protected java.lang.String id; + @XmlAnyElement + protected List others; + @XmlElement(name = "description", required = true) public Text[] getDescriptions() { return description.toArray(); diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesRenderKit.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesRenderKit.java index ebddbe2873e..a72187ac24a 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesRenderKit.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesRenderKit.java @@ -22,6 +22,7 @@ import java.util.Map; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlID; @@ -66,7 +67,8 @@ "renderKitClass", "renderer", "clientBehaviorRenderer", - "renderKitExtension" + "renderKitExtension", + "others" }) public class FacesRenderKit { @@ -91,6 +93,10 @@ public class FacesRenderKit { @XmlSchemaType(name = "ID") protected java.lang.String id; + + @XmlAnyElement + protected List others; + @XmlElement(name = "description", required = true) public Text[] getDescriptions() { return description.toArray(); diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesValidator.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesValidator.java index 572b2f2527f..31fea5b12ac 100644 --- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesValidator.java +++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/FacesValidator.java @@ -22,6 +22,7 @@ import java.util.Map; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlID; @@ -66,7 +67,8 @@ "validatorClass", "attribute", "property", - "validatorExtension" + "validatorExtension", + "others" }) public class FacesValidator { @@ -90,6 +92,9 @@ public class FacesValidator { @XmlSchemaType(name = "ID") protected java.lang.String id; + @XmlAnyElement + protected List others; + @XmlElement(name = "description", required = true) public Text[] getDescriptions() { return description.toArray(); From 3dec16eab3f59347ff3961bc9a4b41576f599c29 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Sat, 14 Sep 2024 17:52:30 +0200 Subject: [PATCH 13/13] fix web manifests in bval-evaluation-redeployment --- .../WebApp1/src/main/webapp/WEB-INF/web.xml | 4 +--- .../WebApp2/src/main/webapp/WEB-INF/web.xml | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/bval-evaluation-redeployment/WebApp1/src/main/webapp/WEB-INF/web.xml b/examples/bval-evaluation-redeployment/WebApp1/src/main/webapp/WEB-INF/web.xml index 73ff18d4519..aede97f465a 100644 --- a/examples/bval-evaluation-redeployment/WebApp1/src/main/webapp/WEB-INF/web.xml +++ b/examples/bval-evaluation-redeployment/WebApp1/src/main/webapp/WEB-INF/web.xml @@ -23,8 +23,6 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> - - 30 - + 30 diff --git a/examples/bval-evaluation-redeployment/WebApp2/src/main/webapp/WEB-INF/web.xml b/examples/bval-evaluation-redeployment/WebApp2/src/main/webapp/WEB-INF/web.xml index 73ff18d4519..aede97f465a 100644 --- a/examples/bval-evaluation-redeployment/WebApp2/src/main/webapp/WEB-INF/web.xml +++ b/examples/bval-evaluation-redeployment/WebApp2/src/main/webapp/WEB-INF/web.xml @@ -23,8 +23,6 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> - - 30 - + 30